From 95843440f6c0a30ec45d4a4b5171cfec596b8a58 Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 27 Dec 2022 04:19:19 +0200 Subject: [PATCH] add event listeners to document instead of window --- files/assets/js/core.js | 2 +- files/assets/js/profile_song.js | 4 ++-- files/templates/submission.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index ee4791ec1..5ee5921a6 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -357,7 +357,7 @@ function prepare_to_pause(audio) { }); } - window.addEventListener('click', (e) => { + document.addEventListener('click', (e) => { if (e.target.tagName.toLowerCase() == "lite-youtube" && !audio.paused) audio.pause(); }); } diff --git a/files/assets/js/profile_song.js b/files/assets/js/profile_song.js index 3a3e2fa2c..9ed09a0de 100644 --- a/files/assets/js/profile_song.js +++ b/files/assets/js/profile_song.js @@ -19,7 +19,7 @@ if (u_username) } audio.play(); - window.addEventListener('click', () => { + document.addEventListener('click', () => { if (audio.paused) audio.play(); }, {once : true}); @@ -53,7 +53,7 @@ else if (!paused) { audio.play(); - window.addEventListener('click', () => { + document.addEventListener('click', () => { if (audio.paused) audio.play(); }, {once : true}); } diff --git a/files/templates/submission.html b/files/templates/submission.html index efb42d9ad..e6160ab88 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -455,7 +455,7 @@ audio.play(); if (audio.paused) { - window.addEventListener('click', () => { + document.addEventListener('click', () => { if (audio.paused) audio.play(); }, {once : true}) }