modified: app.py

modified:   requirements.txt
	modified:   static/css/style.css
	modified:   templates/base.html
	modified:   templates/weather.html
This commit is contained in:
simon
2026-04-27 10:16:45 +02:00
parent 31d58800f0
commit e793804cea
5 changed files with 75 additions and 17 deletions

View File

@@ -19,6 +19,7 @@
<ul class="ac-list" id="nav-ac"></ul>
</div>
</form>
<span class="nav-clock" id="nav-clock"></span>
</nav>
<main>{% block content %}{% endblock %}</main>
@@ -65,6 +66,30 @@ function setupAC(input, list) {
}
setupAC(document.getElementById("nav-ort"), document.getElementById("nav-ac"));
window.setupAC = setupAC;
// Live clock — shows location's local time when a timezone meta tag is present
(function () {
const tzMeta = document.querySelector('meta[name="location-tz"]');
const tz = tzMeta ? tzMeta.getAttribute("content") : null;
const navClock = document.getElementById("nav-clock");
const heroTime = document.getElementById("hero-time");
function tick() {
const now = new Date();
const opts = { hour: "2-digit", minute: "2-digit", hour12: false };
let timeStr;
try {
timeStr = new Intl.DateTimeFormat("de-DE", tz ? { ...opts, timeZone: tz } : opts).format(now);
} catch (e) {
timeStr = new Intl.DateTimeFormat("de-DE", opts).format(now);
}
if (navClock) navClock.textContent = timeStr + " Uhr";
if (heroTime) heroTime.textContent = timeStr + " Uhr";
}
tick();
setInterval(tick, 10000);
})();
</script>
{% block scripts %}{% endblock %}
</body>