forked from MarseyWorld/MarseyWorld
dont play profile songs during event
parent
1fd88dfd20
commit
ce93e4f3bc
|
@ -0,0 +1,57 @@
|
|||
let u_username = document.getElementById('u_username')
|
||||
|
||||
if (u_username)
|
||||
{
|
||||
u_username = u_username.innerHTML
|
||||
|
||||
let audio = new Audio(`/@${u_username}/song`);
|
||||
audio.loop=true;
|
||||
|
||||
function toggle() {
|
||||
if (audio.paused) audio.play()
|
||||
else audio.pause()
|
||||
}
|
||||
|
||||
audio.play();
|
||||
window.addEventListener('click', () => {
|
||||
if (audio.paused) audio.play();
|
||||
}, {once : true});
|
||||
|
||||
prepare_to_pause(audio)
|
||||
}
|
||||
else
|
||||
{
|
||||
let v_username = document.getElementById('v_username')
|
||||
if (v_username)
|
||||
{
|
||||
v_username = v_username.innerHTML
|
||||
|
||||
const paused = localStorage.getItem("paused")
|
||||
|
||||
let audio = new Audio(`/@${v_username}/song`);
|
||||
audio.loop=true;
|
||||
|
||||
function toggle() {
|
||||
if (audio.paused)
|
||||
{
|
||||
audio.play()
|
||||
localStorage.setItem("paused", "")
|
||||
}
|
||||
else
|
||||
{
|
||||
audio.pause()
|
||||
localStorage.setItem("paused", "1")
|
||||
}
|
||||
}
|
||||
|
||||
if (!paused)
|
||||
{
|
||||
audio.play();
|
||||
window.addEventListener('click', () => {
|
||||
if (audio.paused) audio.play();
|
||||
}, {once : true});
|
||||
}
|
||||
|
||||
prepare_to_pause(audio)
|
||||
}
|
||||
}
|
|
@ -1,61 +1,3 @@
|
|||
let u_username = document.getElementById('u_username')
|
||||
|
||||
if (u_username)
|
||||
{
|
||||
u_username = u_username.innerHTML
|
||||
|
||||
let audio = new Audio(`/@${u_username}/song`);
|
||||
audio.loop=true;
|
||||
|
||||
function toggle() {
|
||||
if (audio.paused) audio.play()
|
||||
else audio.pause()
|
||||
}
|
||||
|
||||
audio.play();
|
||||
window.addEventListener('click', () => {
|
||||
if (audio.paused) audio.play();
|
||||
}, {once : true});
|
||||
|
||||
prepare_to_pause(audio)
|
||||
}
|
||||
else
|
||||
{
|
||||
let v_username = document.getElementById('v_username')
|
||||
if (v_username)
|
||||
{
|
||||
v_username = v_username.innerHTML
|
||||
|
||||
const paused = localStorage.getItem("paused")
|
||||
|
||||
let audio = new Audio(`/@${v_username}/song`);
|
||||
audio.loop=true;
|
||||
|
||||
function toggle() {
|
||||
if (audio.paused)
|
||||
{
|
||||
audio.play()
|
||||
localStorage.setItem("paused", "")
|
||||
}
|
||||
else
|
||||
{
|
||||
audio.pause()
|
||||
localStorage.setItem("paused", "1")
|
||||
}
|
||||
}
|
||||
|
||||
if (!paused)
|
||||
{
|
||||
audio.play();
|
||||
window.addEventListener('click', () => {
|
||||
if (audio.paused) audio.play();
|
||||
}, {once : true});
|
||||
}
|
||||
|
||||
prepare_to_pause(audio)
|
||||
}
|
||||
}
|
||||
|
||||
function badge_timestamp(t) {
|
||||
const date = formatDate(new Date(t.dataset.until*1000));
|
||||
const text = t.getAttribute("data-bs-original-title")
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
<div id="username" class="d-none">{{u.username}}</div>
|
||||
{% endif %}
|
||||
<script defer src="{{'js/userpage.js' | asset}}"></script>
|
||||
{% if not HOLIDAY_EVENT %}
|
||||
<script defer src="{{'js/profile_song.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block pagenav %}
|
||||
|
|
Loading…
Reference in New Issue