2022-07-16 21:00:02 +00:00
|
|
|
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();
|
|
|
|
document.getElementById('userpage').addEventListener('click', () => {
|
2022-09-04 23:15:37 +00:00
|
|
|
if (audio.paused) audio.play();
|
2022-07-16 21:00:02 +00:00
|
|
|
}, {once : true});
|
|
|
|
}
|
|
|
|
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;
|
2022-09-04 23:15:37 +00:00
|
|
|
|
2022-07-16 21:00:02 +00:00
|
|
|
function toggle() {
|
|
|
|
if (audio.paused)
|
|
|
|
{
|
|
|
|
audio.play()
|
|
|
|
localStorage.setItem("paused", "")
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
audio.pause()
|
|
|
|
localStorage.setItem("paused", "1")
|
|
|
|
}
|
|
|
|
}
|
2022-09-04 23:15:37 +00:00
|
|
|
|
2022-07-16 21:00:02 +00:00
|
|
|
if (!paused)
|
|
|
|
{
|
|
|
|
audio.play();
|
|
|
|
window.addEventListener('click', () => {
|
2022-09-04 23:15:37 +00:00
|
|
|
if (audio.paused) audio.play();
|
2022-07-16 21:00:02 +00:00
|
|
|
}, {once : true});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function badge_timestamp(t) {
|
|
|
|
const date = new Date(t.dataset.until*1000);
|
2022-09-04 23:15:37 +00:00
|
|
|
const text = t.getAttribute("data-bs-original-title")
|
2022-08-14 12:43:50 +00:00
|
|
|
t.setAttribute("data-bs-original-title", `${text} ${date.toString()}`);
|
2022-07-16 21:00:02 +00:00
|
|
|
t.removeAttribute("onmouseover")
|
|
|
|
}
|