2022-11-30 21:10:20 +00:00
|
|
|
{% if not (v and v.poor) and (not g.event_v or g.event_v.event_music) and not (sub and sub.name == 'music') %}
|
|
|
|
{% if not song %}
|
|
|
|
{% set path = "assets/media/event/music" %}
|
2022-12-07 08:59:40 +00:00
|
|
|
{% set song = "/" ~ path ~ "/" ~ listdir('files/' ~ path)|random() ~ '?v=45' %}
|
2022-11-30 21:10:20 +00:00
|
|
|
{% endif %}
|
|
|
|
<script>
|
|
|
|
const audio = new Audio("{{song}}");
|
|
|
|
audio.loop=true;
|
|
|
|
|
|
|
|
function play() {
|
|
|
|
audio.play();
|
|
|
|
}
|
|
|
|
|
|
|
|
audio.loop=true;
|
|
|
|
|
|
|
|
window.addEventListener('load', function() {
|
|
|
|
audio.play();
|
|
|
|
document.getElementById('frontpage').addEventListener('click', () => {
|
|
|
|
if (audio.paused) audio.play();
|
|
|
|
}, {once : true});
|
|
|
|
prepare_to_pause(audio)
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endif %}
|