mirror of
https://wiilab.wiimart.org/wiimart/WiiMart-github-io
synced 2025-09-02 19:40:59 +02:00
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
var loading = new Audio(""); var loadvolume; var spinnerallowed = true; var shouldaloadedalr = null; var playsound = null;
|
|
function showspinner() {
|
|
if (spinnerallowed === true) {
|
|
document.getElementById("wscspinnerbg").style.display="block";
|
|
|
|
if (shouldaloadedalr) {clearTimeout(shouldaloadedalr);}
|
|
|
|
shouldaloadedalr = setTimeout(stopspinner,3100);
|
|
|
|
if (playsound) {clearTimeout(playsound);}
|
|
|
|
/* moved down for compatability */
|
|
loading = new Audio("/media/load.wav");
|
|
loading.loop = true;
|
|
loading.play(); loading.currentTime=0; loadvolume = 0.01; loading.volume = loadvolume;
|
|
loadup();
|
|
} else {
|
|
|
|
}
|
|
|
|
function stopspinner() {
|
|
document.getElementById("wscspinnerbg").style.display="none";
|
|
loading.pause();
|
|
}
|
|
}
|
|
|
|
function loadrimg() {document.getElementById("wscspinner").style.outline="none";}
|
|
|
|
function loadup() {
|
|
if (loadvolume > 0) {
|
|
loadvolume += 0.01;
|
|
}
|
|
if (loadvolume >= 0.4) {
|
|
loadvolume = 0;
|
|
}
|
|
|
|
loading.volume = loadvolume;
|
|
playsound = setTimeout(loadup, 100);
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
|
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
const isConsoleBrowser =
|
|
userAgent.includes('wii') ||
|
|
userAgent.includes('nintendo ds') ||
|
|
userAgent.includes('nintendo 3ds') ||
|
|
userAgent.includes('nintendo');
|
|
if (isConsoleBrowser) {spinnerallowed = false;}
|
|
else
|
|
{
|
|
document.getElementById("wscspinnerbg").style.display="none";
|
|
document.querySelectorAll("a").forEach(link => {
|
|
link.addEventListener("click", showspinner);
|
|
});
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|