adventskalender/2025/js/background.js aktualisiert
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// ============================================================
|
||||
// Adventskalender 2025 – Hintergrundwechsel nach Tag
|
||||
// Adventskalender 2025 – Hintergrund- & Favicon-Wechsel nach Tag
|
||||
// ============================================================
|
||||
|
||||
(function() {
|
||||
@@ -32,12 +32,27 @@
|
||||
imgPath = `assets/picture/${padded}.png`;
|
||||
}
|
||||
|
||||
// === Anwendung auf das Kalenderbild ===
|
||||
// === Funktion zum Setzen des Favicons ===
|
||||
function setFavicon(path) {
|
||||
let link = document.querySelector('link[rel="icon"]');
|
||||
if (!link) {
|
||||
link = document.createElement("link");
|
||||
link.rel = "icon";
|
||||
link.type = "image/png";
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
link.href = path;
|
||||
}
|
||||
|
||||
// === Anwendung auf das Kalenderbild & Favicon ===
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
const kalenderBild = document.querySelector(".kalenderbild img");
|
||||
if (!kalenderBild) return;
|
||||
|
||||
if (kalenderBild) {
|
||||
kalenderBild.src = imgPath;
|
||||
console.log(`[Bratonien] Hintergrund gesetzt: ${imgPath}`);
|
||||
}
|
||||
|
||||
setFavicon(imgPath);
|
||||
console.log(`[Bratonien] Favicon gesetzt: ${imgPath}`);
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user