This commit is contained in:
vance 2024-05-02 21:47:14 -07:00
parent a307c5f743
commit 2602f82d26

View File

@ -134,34 +134,37 @@
'link': 'https://dreamsinco.de'
}
};
const cursor = document.getElementById('cursor');
const live = document.getElementById('live');
// bonzi cursor
['mousemove', 'touchstart', 'touchmove'].forEach(type => {
window.addEventListener(type, event => {
document.getElementById('cursor').style.top = (event.clientY || event.touches[0].clientY) + 'px';
document.getElementById('cursor').style.left = (event.clientX || event.touches[0].clientX) + 'px';
cursor.style.top = (event.clientY || event.touches[0].clientY) + 'px';
cursor.style.left = (event.clientX || event.touches[0].clientX) + 'px';
});
});
// remove stream if embedded
if (window.self !== window.top) {
document.getElementById('live').remove();
live.remove();
}
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
// resize iframe if view width is smaller than frame
if (document.getElementById('live').width > vw) {
document.getElementById('live').setAttribute('width', vw + 'px');
document.getElementById('live').setAttribute('height', vw * (9 / 16) + 'px');
if (parseInt(live.width, 10) > vw) {
live.width = vw + 'px';
live.height = vw * (9 / 16) + 'px';
}
// check if stream active every 5 seconds
setInterval(function checkLive() {
fetch(new URL('index.m3u8', socials.live.link))
.then(response => {
document.getElementById('live').style.display = response.ok ? 'inline' : 'none';
live.style.display = response.ok ? 'inline' : 'none';
});
return checkLive;
}(), 5000);