Created
August 6, 2025 07:48
-
-
Save leobm/63f5b3939ab6ee31a634a4e8b3be578b to your computer and use it in GitHub Desktop.
www.istspahnnochimamt.de mini Widget für die eigenen Webseite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| const e = document.createElement("style"); | |
| e.textContent = `.spahn-widget{background-color:#7c86ff;color:#fff;font-family:-apple-system,BlinkMacSystemFont,'SegoeUI',Roboto,Oxygen,Ubuntu,sans-serif;max-width:600px;padding:2rem;margin:1rem | |
| auto;text-align:center;border-radius:8px}.spahn-widget h1{font-size:4rem}.spahn-widget .answer{font-size:3rem;font-weight:bold;margin-bottom:1rem}.spahn-widget .description{font-size:1.5rem;line-height:1.4}`; | |
| document.head.appendChild(e); | |
| const t = document.createElement("div"); | |
| t.className = "spahn-widget", t.innerHTML = `<h1>Ist Spahn noch im Amt?</h1><div class="answer" id="spahn-answer">Lade...</div><div class="description" id="spahn-description"></div>`, document.body.appendChild(t), fetch("https://istspahnnochimamt.de/api/v1/inOffice").then(e => e.json()).then(e => { | |
| document.getElementById("spahn-answer").textContent = e.isSpahnStillInOffice ? "Leider ja" : "Endlich Nein 🥳", document.getElementById("spahn-description").innerHTML = "aktuell (" + e.lastUpdated + ")" | |
| }).catch(e => { | |
| document.getElementById("spahn-answer").textContent = "Fehler 😢", document.getElementById("spahn-description").textContent = "Konnte API nicht laden.", console.error("Fehler beim Laden der API:", e) | |
| }) | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment