forked from rDrama/rDrama
25 lines
654 B
HTML
25 lines
654 B
HTML
|
{% 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" %}
|
||
|
{% set song = "/" + path + "/" + listdir('files/' + path)|random() + '?v=45' %}
|
||
|
{% 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 %}
|