modified: app.py
modified: static/css/style.css modified: templates/base.html modified: templates/index.html modified: templates/weather.html new file: translations.py
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Skywatcher – Wetter für Deutschland{% endblock %}
|
||||
{% block title %}{{ T.page_title_home }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="home-wrap">
|
||||
<div class="home-bg-text" aria-hidden="true">WETTER</div>
|
||||
|
||||
<div class="home-center">
|
||||
<p class="home-eyebrow">Präzise Vorhersagen · Daten via DWD Open Data</p>
|
||||
<h1 class="home-title">Wo willst du<br>das Wetter wissen?</h1>
|
||||
<p class="home-eyebrow">{{ T.home_eyebrow }}</p>
|
||||
<h1 class="home-title">{{ T.home_headline|safe }}</h1>
|
||||
|
||||
<form class="home-form" action="/wetter" method="get" autocomplete="off">
|
||||
<div class="home-input-wrap">
|
||||
<svg class="home-search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>
|
||||
</svg>
|
||||
<input type="text" name="ort" id="home-ort" placeholder="Stadt, Gemeinde oder PLZ …" required autofocus/>
|
||||
<input type="text" name="ort" id="home-ort" placeholder="{{ T.home_placeholder }}" required autofocus/>
|
||||
<ul class="ac-list" id="home-ac"></ul>
|
||||
</div>
|
||||
<button type="submit" class="home-btn">
|
||||
Abrufen
|
||||
{{ T.home_btn }}
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
|
||||
</button>
|
||||
</form>
|
||||
@@ -30,9 +30,9 @@
|
||||
<a href="/wetter?ort={{ city }}" class="chip">{{ city }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button class="btn-location" id="btn-location" title="Meinen Standort nutzen">
|
||||
<button class="btn-location" id="btn-location" title="{{ T.btn_location }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3"/><circle cx="12" cy="12" r="9" opacity=".3"/></svg>
|
||||
Meinen Standort nutzen
|
||||
{{ T.btn_location }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -49,14 +49,20 @@
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
const _i18n = {
|
||||
locating: {{ T.locating | tojson }},
|
||||
locationUnavailable: {{ T.location_unavailable | tojson }},
|
||||
geoUnsupported: {{ T.geolocation_unsupported | tojson }},
|
||||
recentlySearched: {{ T.recently_searched | tojson }},
|
||||
};
|
||||
// Standort-Button
|
||||
document.getElementById("btn-location").addEventListener("click", function() {
|
||||
if (!navigator.geolocation) { alert("Geolocation nicht unterstützt."); return; }
|
||||
this.textContent = "Wird ermittelt …";
|
||||
if (!navigator.geolocation) { alert(_i18n.geoUnsupported); return; }
|
||||
this.textContent = _i18n.locating;
|
||||
this.disabled = true;
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
pos => { window.location = `/wetter?lat=${pos.coords.latitude}&lon=${pos.coords.longitude}&ort=Mein+Standort`; },
|
||||
() => { this.textContent = "Standort nicht verfügbar"; this.disabled = false; }
|
||||
() => { this.textContent = _i18n.locationUnavailable; this.disabled = false; }
|
||||
);
|
||||
});
|
||||
|
||||
@@ -67,7 +73,7 @@ document.getElementById("btn-location").addEventListener("click", function() {
|
||||
const wrap = document.getElementById("home-chips");
|
||||
const div = document.createElement("div");
|
||||
div.className = "recent-label";
|
||||
div.textContent = "Zuletzt gesucht:";
|
||||
div.textContent = _i18n.recentlySearched;
|
||||
wrap.before(div);
|
||||
const strip = document.createElement("div");
|
||||
strip.className = "home-chips home-chips--recent";
|
||||
|
||||
Reference in New Issue
Block a user