69 lines
1.9 KiB
JavaScript
69 lines
1.9 KiB
JavaScript
function onload() {
|
|
redirect();
|
|
sdocument.getElementById("body").style.fontFamily = "system-ui, sans-serif";
|
|
}
|
|
|
|
function toggleTheme() {
|
|
// Obtains an array of all <link>
|
|
// elements.
|
|
// Select your element using indexing.
|
|
if (document.getElementById("body").style.fontFamily !== "standardGalactic") {
|
|
document.getElementById("body").style.fontFamily = "standardGalactic";
|
|
} else {
|
|
document.getElementById("body").style.fontFamily = "system-ui, sans-serif";
|
|
}
|
|
}
|
|
|
|
function redirect() {
|
|
let chromium = /Chrome|Chromium|OPR|Opera|Edge|UC|QQ|Brave/.test(
|
|
navigator.userAgent
|
|
);
|
|
let disclaimer = `<div class="web-disclaimer">`;
|
|
if ((chromium) && (screen.width >= 699)) window.location.replace("/bsod");
|
|
if ((chromium) && (screen.width <= 699)) window.location.replace("/mobile-warn");
|
|
}
|
|
|
|
// Resizable textarea
|
|
const tx = document.getElementsByTagName("textarea");
|
|
for (let i = 0; i < tx.length; i++) {
|
|
tx[i].setAttribute(
|
|
"style",
|
|
"height:" + tx[i].scrollHeight + "px;overflow-y:hidden;"
|
|
);
|
|
tx[i].addEventListener("input", OnInput, false);
|
|
}
|
|
|
|
function OnInput() {
|
|
this.style.height = "auto";
|
|
this.style.height = this.scrollHeight + "px";
|
|
}
|
|
|
|
// Sound effects
|
|
function PlaySound(soundobj) {
|
|
var thissound = document.getElementById(soundobj);
|
|
thissound.play();
|
|
}
|
|
|
|
function StopSound(soundobj) {
|
|
var thissound = document.getElementById(soundobj);
|
|
thissound.pause();
|
|
thissound.currentTime = 0;
|
|
}
|
|
|
|
const audio = new Audio("/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3");
|
|
const buttons = document.querySelectorAll("button");
|
|
const links = document.querySelectorAll("a");
|
|
|
|
// biome-ignore lint/complexity/noForEach: <explanation>
|
|
links.forEach(a => {
|
|
a.addEventListener("click", () => {
|
|
audio.play();
|
|
})
|
|
})
|
|
|
|
// biome-ignore lint/complexity/noForEach: <explanation>
|
|
buttons.forEach(button => {
|
|
button.addEventListener("click", () => {
|
|
audio.play();
|
|
});
|
|
});
|