alt text!

This commit is contained in:
kleines Filmröllchen 2024-12-10 19:29:09 +01:00
parent 5720d7da31
commit 2edbb43b59
Signed by: filmroellchen
SSH key fingerprint: SHA256:UMhcHaeI+VGsiUL2Drpw3aj1iRiQUlx8nxZqUPvoaVw
3 changed files with 8 additions and 6 deletions

View file

@ -30,7 +30,7 @@ Weitere Treffen finden nach Bedarf meist sonntags statt. Tagesordnungen, Protoko
- Freifunk durch unsere Partnercommunity Freifunk Backnang - Freifunk durch unsere Partnercommunity Freifunk Backnang
<a href="https://hacknang.de/freifunk/" target="_blank"><img alt="Logo von Freifunk Stuttgart" src="/img/ffs-bk-paths.svg" class="small"></a> <a href="https://hacknang.de/freifunk/" target="_blank"><img alt="Logo von Freifunk Backnang" src="/img/ffs-bk-paths.svg" class="small"></a>
- Getränke und Snacks der Bar (auch Mate!) - Getränke und Snacks der Bar (auch Mate!)
- Sofas - Sofas

View file

@ -6,7 +6,8 @@ function checkSpace() {
const icon = document.getElementById("space-image"); const icon = document.getElementById("space-image");
const stateItem = document.getElementById("space-text"); const stateItem = document.getElementById("space-text");
let stateText = "", let stateText = "",
stateLastUpdate = ""; stateLastUpdate = "",
imageAlt = "";
fetch("https://spaceapi.ctbk.de/") fetch("https://spaceapi.ctbk.de/")
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
@ -24,16 +25,17 @@ function checkSpace() {
dateStyle: "medium", dateStyle: "medium",
}) })
: "unbekannt"; : "unbekannt";
imageAlt = `Space ${openText} seit ${lastchangeString}`;
stateText = `Space <strong>${openText}</strong> seit ${lastchangeString}`; stateText = `Space <strong>${openText}</strong> seit ${lastchangeString}`;
stateLastUpdate = `Letzte Statusänderung: ${lastchangeString}`; stateLastUpdate = `Letzte Statusänderung: ${lastchangeString}`;
}) })
.catch((error) => { .catch((error) => {
icon.src = "/img/unknown.png"; icon.src = "/img/unknown.png";
stateText = "Spacestatus unbekannt"; imageAlt = stateText = "Spacestatus unbekannt";
console.error("Error on space state retrieval:", error); console.error("Error on space state retrieval:", error);
}) })
.then(() => { .then(() => {
icon.alt = stateText; icon.alt = imageAlt;
icon.text = stateLastUpdate; icon.text = stateLastUpdate;
stateItem.innerHTML = stateText; stateItem.innerHTML = stateText;
}); });

View file

@ -72,13 +72,13 @@ truncate(length=150) %} {% else %} {% set description = "" %} {% endif %}
<a href="{{ get_url(path='/verein') }}">Verein</a> <a href="{{ get_url(path='/verein') }}">Verein</a>
<a href="https://fsck.ctbk.de/">FSCK</a> <a href="https://fsck.ctbk.de/">FSCK</a>
</nav> </nav>
<p id="space-text"></p> <p id="space-text">Spacestatus unbekannt</p>
<!-- TODO: explainer page for the spaceapi and how we implement it --> <!-- TODO: explainer page for the spaceapi and how we implement it -->
<a class="image-container" id="space-image-container" href="" <a class="image-container" id="space-image-container" href=""
><img ><img
id="space-image" id="space-image"
src="{{ get_url(path='/img/unknown.png') }}" src="{{ get_url(path='/img/unknown.png') }}"
alt="Space Icon" alt="Spacestatus unbekannt"
/></a> /></a>
</header> </header>
<main id="main-content"> <main id="main-content">