modified: app.py
modified: requirements.txt modified: static/css/style.css modified: templates/base.html modified: templates/weather.html
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{% block title %}{{ display_name.split(',')[0] }} – Skywatcher{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<meta name="location-tz" content="{{ location_tz }}">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.2/dist/chart.umd.min.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -22,7 +23,7 @@
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
|
||||
{{ display_name.split(',')[0] }}
|
||||
<span class="hero-meta-sub">{{ display_name.split(',')[1:3]|join(',') if ',' in display_name else '' }}</span>
|
||||
<span class="hero-meta-time">{{ now_local }} Uhr</span>
|
||||
<span class="hero-meta-time" id="hero-time">{{ now_local }} Uhr</span>
|
||||
</div>
|
||||
|
||||
<div class="hero-main">
|
||||
|
||||
Reference in New Issue
Block a user