improve the build system

This commit is contained in:
2025-04-14 19:11:59 +02:00
parent c17bea6cb2
commit 247dcbe817
24 changed files with 59 additions and 61 deletions

33
scripts/countdown.js Normal file
View File

@@ -0,0 +1,33 @@
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
const target = new Date("May 7, 2025 16:30:00 GMT+0100");
function update_time() {
let countdown = document.querySelector(".countdown");
const now = new Date();
if(now >= target) {
countdown.innerHTML = "Akce již proběhla.<br>Děkujeme všem za návštěvu.";
return;
}
const dur = Math.floor((target - now) / 1000);
const day = Math.floor(dur / 86400).toFixed(0).padStart(2, "0");
const hour = Math.floor((dur / 3600) % 24).toFixed(0).padStart(2, "0");
const min = Math.floor((dur / 60) % 60).toFixed(0).padStart(2, "0");
const sec = Math.floor(dur % 60).toFixed(0).padStart(2, "0");
//const targetdate = `${target.getDate()}. ${target.getMonth()+1}. ${target.getFullYear()}`
//const targettime = `${target.getHours()}:${target.getMinutes()}`
//countdown.innerHTML = `${targetdate} v ${targettime}<br><br>${day}:${hour}:${min}:${sec}`;
countdown.innerHTML = `${day}:${hour}:${min}:${sec}`;
}
update_time();
setInterval(update_time, 1000);
// @license-end

17
scripts/lang.js Normal file
View File

@@ -0,0 +1,17 @@
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
function change_lang(base) {
let cz = document.querySelector(base + "_cz");
let en = document.querySelector(base + "_en");
if(cz.style.display == "none") {
cz.style.display = "";
en.style.display = "none";
} else {
cz.style.display = "none";
en.style.display = "";
}
}
// @license-end

34
scripts/theme.js Normal file
View File

@@ -0,0 +1,34 @@
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
function switch_theme() {
let el = document.documentElement;
if(el.getAttribute("data-color-scheme") === "invert") {
el.setAttribute("data-color-scheme", "normal");
localStorage.setItem("color-scheme", "normal");
} else {
el.setAttribute("data-color-scheme", "invert");
localStorage.setItem("color-scheme", "invert");
}
}
function switch_layout() {
let el = document.documentElement;
if(el.getAttribute("data-layout") === "wide") {
el.setAttribute("data-layout", "normal");
localStorage.setItem("layout", "normal");
} else {
el.setAttribute("data-layout", "wide");
localStorage.setItem("layout", "wide");
}
}
if(localStorage.getItem("color-scheme") === "invert") {
switch_theme();
}
if(localStorage.getItem("layout") === "wide") {
switch_layout();
}
// @license-end