new file: .dockerignore

new file:   Dockerfile
	new file:   __pycache__/app.cpython-310.pyc
	new file:   app.py
	new file:   requirements.txt
	new file:   static/css/style.css
	new file:   templates/base.html
	new file:   templates/index.html
	new file:   templates/weather.html
This commit is contained in:
SimolZimol
2026-04-21 09:01:53 +02:00
commit 2a9882c0aa
9 changed files with 1194 additions and 0 deletions

63
templates/base.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{% block title %}Wetter{% endblock %}</title>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}?v=2"/>
{% block head %}{% endblock %}
</head>
<body>
<nav class="nav">
<a href="/" class="nav-logo">DWD<span>Wetter</span></a>
<form class="nav-search" action="/wetter" method="get" autocomplete="off">
<div class="nav-search-wrap">
<svg class="nav-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="nav-ort" placeholder="Ort suchen …" value="{{ request.args.get('ort','') }}"/>
<ul class="ac-list" id="nav-ac"></ul>
</div>
</form>
</nav>
<main>{% block content %}{% endblock %}</main>
<footer class="footer">
Daten: <a href="https://opendata.dwd.de" target="_blank">Deutscher Wetterdienst Open Data</a>
</footer>
<script>
function setupAC(input, list) {
if (!input || !list) return;
let t;
input.addEventListener("input", () => {
clearTimeout(t);
const q = input.value.trim();
if (q.length < 2) { list.hidden = true; list.innerHTML = ""; return; }
t = setTimeout(async () => {
const r = await fetch(`/api/suggest?q=${encodeURIComponent(q)}`);
const data = await r.json();
list.innerHTML = "";
if (!data.length) { list.hidden = true; return; }
data.forEach(item => {
const li = document.createElement("li");
li.textContent = item.name;
li.addEventListener("click", () => {
input.value = item.name;
list.hidden = true;
input.closest("form").submit();
});
list.appendChild(li);
});
list.hidden = false;
}, 220);
});
document.addEventListener("click", e => { if (!list.contains(e.target) && e.target !== input) list.hidden = true; });
}
setupAC(document.getElementById("nav-ort"), document.getElementById("nav-ac"));
window.setupAC = setupAC;
</script>
{% block scripts %}{% endblock %}
</body>
</html>