From 0bc11dd5f2c3f2b464139364c0117a8d15ddc37b Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 11 Dec 2024 00:30:56 +0400 Subject: [PATCH] Set overlay_autoplay to saved state. Also add a missing semicolon. :) --- web/assets/js/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/assets/js/main.js b/web/assets/js/main.js index ab635a6..945627e 100644 --- a/web/assets/js/main.js +++ b/web/assets/js/main.js @@ -145,10 +145,12 @@ overlay_autoplay = document.getElementsByName("autoplay")[0]; if (localStorage.getItem('autoplay') == null) localStorage['autoplay'] = overlay_autoplay.checked = false; +else + overlay_autoplay.checked = localStorage['autoplay']; overlay_autoplay.addEventListener("change", e => { localStorage['autoplay'] = e.target.checked; - const media_element = overlay_content.firstChild + const media_element = overlay_content.firstChild; if (e.target.checked && media_element !== undefined) if (media_element.tagName === "AUDIO" || media_element.tagName === "VIDEO") if (media_element.ended)