limepot-xyz/public/scripts/limepot.js

68 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-07-04 00:16:49 -06:00
function onload() {
2024-07-13 00:03:34 -06:00
redirect();
sdocument.getElementById("body").style.fontFamily = "system-ui, sans-serif";
2024-07-04 00:16:49 -06:00
}
2024-07-13 00:03:34 -06:00
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";
}
}
2024-07-04 00:16:49 -06:00
function redirect() {
2024-07-13 00:03:34 -06:00
let chromium = /Chrome|Chromium|OPR|Opera|Edge|UC|QQ|Brave/.test(
2024-07-04 00:16:49 -06:00
navigator.userAgent
);
let disclaimer = `<div class="web-disclaimer">`;
2024-07-19 22:41:21 -06:00
if ((chromium) && (screen.width >= 699)) window.location.replace("/bsod");
2024-07-19 23:17:51 -06:00
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++) {
2024-07-13 00:03:34 -06:00
tx[i].setAttribute(
"style",
"height:" + tx[i].scrollHeight + "px;overflow-y:hidden;"
);
tx[i].addEventListener("input", OnInput, false);
}
function OnInput() {
2024-07-13 00:03:34 -06:00
this.style.height = "auto";
this.style.height = this.scrollHeight + "px";
}
2024-07-22 19:41:59 -06:00
// 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");
links.forEach(a => {
a.addEventListener("click", () => {
audio.play();
})
})
buttons.forEach(button => {
button.addEventListener("click", () => {
audio.play();
});
});