Add phase 3: comments and cooking mode
- Comments on visible recipes; author and admin may delete; per-user hourly rate limit (COMMENT_RATE_LIMIT_PER_HOUR) - Cooking mode with large text, tick-off checklists, serving scaling and Screen Wake Lock to keep the display on - Serving calculator auto-submits on change - Privacy tests cover comment and cooking-mode URLs Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6f7e4f92ca
commit
9256e94286
@@ -18,3 +18,24 @@ document.addEventListener("change", (event) => {
|
||||
const input = event.target.closest(".servings input[name=portionen]");
|
||||
if (input && input.value) input.form.requestSubmit();
|
||||
});
|
||||
|
||||
// Cooking mode: keep the screen on while the page is visible (Screen Wake Lock API).
|
||||
(() => {
|
||||
const page = document.querySelector("[data-wakelock]");
|
||||
if (!page || !("wakeLock" in navigator)) return;
|
||||
const status = page.querySelector(".wakelock-status");
|
||||
let lock = null;
|
||||
const acquire = async () => {
|
||||
try {
|
||||
lock = await navigator.wakeLock.request("screen");
|
||||
if (status) status.hidden = false;
|
||||
lock.addEventListener("release", () => { if (status) status.hidden = true; });
|
||||
} catch {
|
||||
// Not allowed right now (e.g. battery saver); the page still works.
|
||||
}
|
||||
};
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (document.visibilityState === "visible") acquire();
|
||||
});
|
||||
acquire();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user