BibliographyBackbone: Difference between revisions
From Illustrations in German Translations of Mark Twain's Works
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{Seitenkopf|Bibliography Generator}} | {{Seitenkopf|Bibliography Generator}} | ||
<html> | <html> | ||
<button | <button id="testBtn" style=" | ||
background-color: #008CBA; | background-color: #008CBA; | ||
color: white; | color: white; | ||
| Line 24: | Line 24: | ||
overflow: auto; | overflow: auto; | ||
"></textarea> | "></textarea> | ||
<script> | |||
async function testYears() { | |||
console.log('testYears aufgerufen'); | |||
const output = document.getElementById('bibOutput'); | |||
if (!output) { | |||
console.error('bibOutput nicht gefunden'); | |||
return; | |||
} | |||
output.value = 'Lade Daten...\n'; | |||
try { | |||
const response = await fetch('https://illus.twainframe.org/BibliographyData?action=raw'); | |||
console.log('Response status:', response.status); | |||
if (!response.ok) throw new Error(`HTTP ${response.status}`); | |||
const entries = await response.json(); | |||
console.log('JSON geparst, Anzahl Einträge:', entries.length); | |||
let result = ''; | |||
entries.forEach((entry, index) => { | |||
const year = entry.year && entry.year.trim() ? entry.year : 'unknown'; | |||
result += `${index + 1}. ${year}\n`; | |||
}); | |||
output.value = result; | |||
console.log('Fertig'); | |||
} catch (error) { | |||
output.value = `ERROR: ${error.message}`; | |||
console.error('Fehler:', error); | |||
} | |||
} | |||
document.addEventListener('DOMContentLoaded', function() { | |||
const btn = document.getElementById('testBtn'); | |||
if (btn) { | |||
btn.addEventListener('click', testYears); | |||
console.log('Button bereit'); | |||
} | |||
}); | |||
</script> | |||
</html> | </html> | ||
Revision as of 00:41, 12 May 2026
Bibliography Generator