Created
May 22, 2016 15:02
-
-
Save TheophileWalter/8b05003ad470de466eab0a5dcfd90ef9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Wololo Javascript | |
* By Théophile Walter | |
* | |
*/ | |
// Starts the Wololo | |
wololo_init(); | |
// Setting up some datas | |
wololo_color = "#0000CC"; | |
// Initialazing the Wololo | |
function wololo_init() { | |
// Set the cursor | |
document.body.style.cursor = "url(http://data.lecoindaide.com/data/wololo/cursor.png), auto"; | |
// Set the action | |
document.addEventListener('click', function(e) { | |
e = e || window.event; | |
var target = e.target || e.srcElement; | |
wololo(target); | |
}, false); | |
// Disable all elements action | |
var anchors = document.getElementsByTagName("*"); | |
for (var i = 0; i < anchors.length; i++) { | |
anchors[i].onclick = function() {return(false);}; | |
anchors[i].onmousedown = function() {return(false);}; | |
} | |
// Display the master | |
master_pic = document.createElement('img'); | |
master_pic.id = "wololo_master_pic"; | |
master_pic.src = "http://data.lecoindaide.com/data/wololo/wololo_master.png"; | |
master_pic.style.position = "fixed"; | |
master_pic.style.right = "0px"; | |
master_pic.style.bottom = "0px"; | |
document.body.appendChild(master_pic); | |
} | |
// Wololo the 'ref' element | |
function wololo(ref) { | |
// Play the sound | |
wolaudio = new Audio('http://data.lecoindaide.com/data/wololo/wololo.mp3'); | |
wolaudio.play(); | |
// Check if user clicks on the Wololo Master | |
if (ref.id == "wololo_master_pic") { | |
// We invert the color | |
wololo_color = (wololo_color == "#0000CC" ? "#CC0000" : "#0000CC") | |
} else { | |
// Color in blue | |
ref.style.backgroundColor = wololo_color; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment