2023-09-28 23:58:09 +00:00
|
|
|
// Jump scare function
|
|
|
|
function scare() {
|
2023-10-12 18:47:03 +00:00
|
|
|
const image = document.getElementById("jumpscare-img");
|
2023-09-28 23:58:09 +00:00
|
|
|
image.style.display = "block";
|
|
|
|
|
|
|
|
const jumpscare_audio = document.getElementById('jumpscare-audio')
|
|
|
|
jumpscare_audio.play();
|
|
|
|
|
|
|
|
// Hide image and reset sound
|
|
|
|
setTimeout(function () {
|
|
|
|
image.style.display = "none";
|
|
|
|
jumpscare_audio.pause()
|
|
|
|
jumpscare_audio.currentTime = 0;
|
|
|
|
}, 3000);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.random() <= 0.1) {
|
|
|
|
setTimeout(function () {
|
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
|
xhr.open("POST", "/jumpscare");
|
|
|
|
xhr.setRequestHeader('xhr', 'xhr');
|
|
|
|
form = new FormData();
|
|
|
|
form.append("formkey", formkey());
|
|
|
|
xhr.send(form)
|
|
|
|
scare()
|
|
|
|
}, 3000);
|
|
|
|
}
|