From 4d408963765fec7fe80c81677bafd0cdd049287a Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Tue, 10 Dec 2024 22:23:07 +0400 Subject: [PATCH] Store autoplay state in localStorage. --- web/assets/js/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/assets/js/main.js b/web/assets/js/main.js index 53fb423..ce0b332 100644 --- a/web/assets/js/main.js +++ b/web/assets/js/main.js @@ -57,7 +57,11 @@ overlay_content.addEventListener("mousemove", e => { overlay_autoplay = document.getElementsByName("autoplay")[0]; +if (localStorage.getItem('autoplay') == null) + localStorage['autoplay'] = overlay_autoplay.checked = false; + overlay_autoplay.addEventListener("change", e => { + localStorage['autoplay'] = e.target.checked; if (e.target.checked && overlay_content.firstChild !== undefined) if (overlay_content.firstChild.tagName === "AUDIO" || overlay_content.firstChild.tagName === "VIDEO") if (overlay_content.firstChild.ended)