- Joined
- Sep 6, 2013
- Messages
- 6,742
- open browser console
- paste code (see below)
- press enter
- close console
- press spooky button on/off
JavaScript:
let isSpooking = false;
let currentSkelleton = null;
let newStyle = null;
let skeletton_animation = [
"https://www.hiveworkshop.com/attachments/skelleton-1-gif.307520/",
"https://www.hiveworkshop.com/attachments/skeletton-2-gif.307521/",
"https://www.hiveworkshop.com/attachments/skeletton-3-gif.307522/",
"https://www.hiveworkshop.com/attachments/skeletton-4-gif.307523/",
"https://www.hiveworkshop.com/attachments/skeletton-5-gif.307524/",
"https://www.hiveworkshop.com/attachments/skeletton-6-gif.307525/",
"https://www.hiveworkshop.com/attachments/skeletton-7-gif.307526/",
"https://www.hiveworkshop.com/attachments/skeletton-8-gif.307527/",
"https://www.hiveworkshop.com/attachments/skeletton-9-gif.307528/",
];
let setRandomBackground = function(skeletton_array) {
let index = 1 + Math.floor(Math.random() * skeletton_array.length - 1);
document.body.style.background = "url('" + skeletton_array[index] + "')";
};
// Add div to HTML
let addDivElement = function(htmlCode, element) {
let divContainer = document.createElement("div");
divContainer.innerHTML = htmlCode;
divContainer.style.position = "relative";
divContainer.style.zIndex = "%";
element.appendChild(divContainer);
};
// Add style to head
let addStyleElement = function(styleString) {
let css = styleString;
let head = document.head || document.getElementsByTagName('head')[0];
let style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
head.appendChild(style);
return style;
};
let toggleSpook = function() {
isSpooking = !isSpooking;
if(isSpooking) {
setRandomBackground(skeletton_animation);
currentSkelleton = setInterval(function() { setRandomBackground(skeletton_animation); }, 5 * 1000);
newStyle = addStyleElement("div.item-container { background: #161618BB !important; } #footer-links { background: #161618BB !important; }");
toggleButton.src = "https://www.hiveworkshop.com/attachments/button-2-png.307519/";
musicPlayer.play();
}
else {
clearInterval(currentSkelleton);
document.body.style.background = "black";
newStyle.remove();
musicPlayer.pause();
toggleButton.src = "https://www.hiveworkshop.com/attachments/button-1-png.307518/";
}
}
addDivElement("<audio loop controls id=\"spookydoot\" style=\"display: none;\"><source src=\"https://www.hiveworkshop.com/attachments/andrew-gold-spooky-scary-skeletons-mp3.307517/\" type=\"audio/mpeg\"></audio>", document.body);
let musicPlayer = document.getElementById("spookydoot");
let toggleButton = document.createElement("img");
toggleButton.src = "https://www.hiveworkshop.com/attachments/button-1-png.307518/";
toggleButton.style = "position: fixed; top: 222.00px; left: 38.00px; width: 145px;";
toggleButton.addEventListener("click", toggleSpook);
document.body.appendChild(toggleButton);
Attachments
-
Andrew Gold - Spooky Scary Skeletons.mp32 MB · Views: 54
-
button 1.png64.1 KB · Views: 39
-
button 2.png46 KB · Views: 41
-
Skelleton 1.gif1.8 MB · Views: 55
-
Skeletton 2.gif746.2 KB · Views: 64
-
Skeletton 3.gif442.5 KB · Views: 40
-
Skeletton 4.gif1.1 MB · Views: 40
-
Skeletton 5.gif498.7 KB · Views: 37
-
Skeletton 6.gif494.4 KB · Views: 63
-
Skeletton 7.gif916.8 KB · Views: 65
-
Skeletton 8.gif2 MB · Views: 65
-
Skeletton 9.gif600.4 KB · Views: 37
Last edited: