Files
bug.tools/js/onLoad.js
2026-02-28 21:33:31 -06:00

52 lines
1.3 KiB
JavaScript

function newFact() {
const facts = [
'Are you watching me, or am I watching you?',
'Is the self you know, the self that exists?',
'When freedom is lost, what is left?',
'Protect your privacy, embrace your freedom',
'I am a wizard, and this is my realm.',
];
const randomFact = Math.floor(Math.random() * facts.length);
const factDisplayElement = document.getElementById("factDisplay");
if (factDisplayElement) {
factDisplayElement.innerHTML = facts[randomFact];
} else {
console.warn('Element with ID "factDisplay" not found.');
}
}
function initVideoControls() {
const video = document.getElementById("bgVideo");
const btn = document.getElementById("vidBtn");
window.PlayPauseVideo = function PlayPauseVideo() {
if (!video || !btn) return;
if (video.paused) {
video.play();
btn.innerHTML = "TURN OFF";
} else {
video.pause();
btn.innerHTML = "TURN ON";
}
};
}
function applyFadeIn() {
const fadeInElements = document.querySelectorAll(".fade-in");
fadeInElements.forEach((element) => {
requestAnimationFrame(() => {
element.classList.add("visible");
});
});
}
document.addEventListener("DOMContentLoaded", function () {
newFact();
applyFadeIn();
initVideoControls();
});