1
0

Set overlay_autoplay to saved state. Also add a missing semicolon. :)

This commit is contained in:
Alexander Andreev 2024-12-11 00:30:56 +04:00
parent ebcc15dc7b
commit 0bc11dd5f2
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -145,10 +145,12 @@ overlay_autoplay = document.getElementsByName("autoplay")[0];
if (localStorage.getItem('autoplay') == null) if (localStorage.getItem('autoplay') == null)
localStorage['autoplay'] = overlay_autoplay.checked = false; localStorage['autoplay'] = overlay_autoplay.checked = false;
else
overlay_autoplay.checked = localStorage['autoplay'];
overlay_autoplay.addEventListener("change", e => { overlay_autoplay.addEventListener("change", e => {
localStorage['autoplay'] = e.target.checked; 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 (e.target.checked && media_element !== undefined)
if (media_element.tagName === "AUDIO" || media_element.tagName === "VIDEO") if (media_element.tagName === "AUDIO" || media_element.tagName === "VIDEO")
if (media_element.ended) if (media_element.ended)