ed1e3311a5
test / pytest (push) Successful in 37s
- serve manifest and service worker from the app root for install compatibility - add manifest metadata, service worker registration, and Apple touch icon links to the base template - add install icon assets for Android, iOS, and desktop install flows - document deployment and validation notes for the new PWA support - cover the new endpoints and template output with tests
74 lines
2.9 KiB
HTML
74 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="theme-color" content="#0b57d0">
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-title" content="搬家助手">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
<title>{{ page_title or "搬家助手" }}</title>
|
|
<link rel="manifest" href="/manifest.webmanifest">
|
|
<link rel="icon" href="/static/icons/icon-192.png" sizes="192x192" type="image/png">
|
|
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png" sizes="180x180">
|
|
<link rel="stylesheet" href="/static/style.css">
|
|
</head>
|
|
<body>
|
|
<main class="container">
|
|
<nav class="top-nav">
|
|
<a href="/boxes">箱子</a>
|
|
<a href="/search">搜索</a>
|
|
</nav>
|
|
{% block content %}{% endblock %}
|
|
</main>
|
|
<script>
|
|
if ("serviceWorker" in navigator) {
|
|
window.addEventListener("load", function () {
|
|
navigator.serviceWorker.register("/service-worker.js");
|
|
});
|
|
}
|
|
|
|
document.addEventListener("click", function (event) {
|
|
const card = event.target.closest(".clickable-card[data-href]");
|
|
if (!card) return;
|
|
if (event.target.closest("a, button, form, input, textarea, select, label")) return;
|
|
|
|
window.location.href = card.dataset.href;
|
|
});
|
|
|
|
document.addEventListener("keydown", function (event) {
|
|
const card = event.target.closest(".clickable-card[data-href]");
|
|
if (!card) return;
|
|
if (event.key !== "Enter" && event.key !== " ") return;
|
|
if (event.target.closest("a, button, form, input, textarea, select, label")) return;
|
|
|
|
event.preventDefault();
|
|
window.location.href = card.dataset.href;
|
|
});
|
|
|
|
document.addEventListener("keydown", function (event) {
|
|
if (event.key !== "Enter") return;
|
|
if (event.target.tagName === "TEXTAREA") return;
|
|
if (event.target.type === "submit") return;
|
|
if (!event.target.closest("form")) return;
|
|
|
|
const focusable = Array.from(
|
|
event.target.form.querySelectorAll(
|
|
'input:not([type="hidden"]):not([type="submit"]):not([type="checkbox"]), textarea, select'
|
|
)
|
|
).filter((element) => !element.disabled);
|
|
|
|
const index = focusable.indexOf(event.target);
|
|
if (index === -1 || index === focusable.length - 1) return;
|
|
|
|
event.preventDefault();
|
|
focusable[index + 1].focus();
|
|
if (focusable[index + 1].select) {
|
|
focusable[index + 1].select();
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|