forked from MarseyWorld/MarseyWorld
pause background music when a video or audio is played
parent
67a6676bf8
commit
b2317a4563
|
@ -52,6 +52,26 @@ else
|
|||
}
|
||||
}
|
||||
|
||||
for (const video of document.getElementsByTagName('video'))
|
||||
{
|
||||
video.addEventListener('play', (event) => {
|
||||
if (!audio.paused)
|
||||
{
|
||||
audio.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const a of document.getElementsByTagName('audio'))
|
||||
{
|
||||
a.addEventListener('play', (event) => {
|
||||
if (!audio.paused)
|
||||
{
|
||||
audio.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function badge_timestamp(t) {
|
||||
const date = new Date(t.dataset.until*1000);
|
||||
const text = t.getAttribute("data-bs-original-title")
|
||||
|
|
|
@ -1165,6 +1165,26 @@
|
|||
window.addEventListener('click', () => {
|
||||
if (audio.paused) audio.play();
|
||||
}, {once : true});
|
||||
|
||||
for (const video of document.getElementsByTagName('video'))
|
||||
{
|
||||
video.addEventListener('play', (event) => {
|
||||
if (!audio.paused)
|
||||
{
|
||||
audio.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const a of document.getElementsByTagName('audio'))
|
||||
{
|
||||
a.addEventListener('play', (event) => {
|
||||
if (!audio.paused)
|
||||
{
|
||||
audio.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue