Last active
August 29, 2015 14:21
-
-
Save RodolfoSilva/0eb43834e471c47a2ee7 to your computer and use it in GitHub Desktop.
Executando o jogo kolor.moro.es
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
"use strict"; | |
var interval_id; | |
var kolor_kolor = document.querySelector("#kolor-kolor"); | |
var kolor_options = document.querySelector("#kolor-options"); | |
var kolor_modal = document.querySelector("#kolor-end-block"); | |
var kolor_start = document.querySelector("#kolor-start"); | |
var kolor_restart = kolor_modal.querySelector("#kolor-restart"); | |
var onBackgroundChange = function (color) { | |
[].forEach.call(kolor_options .querySelectorAll('li a'), function(a) { | |
if (a.style.backgroundColor == color) { | |
a.click(); | |
return; | |
} | |
}); | |
}; | |
(function(){ | |
var last_bg; | |
kolor_start.click(); | |
interval_id = setInterval(function(){ | |
if (last_bg != kolor_kolor.style.backgroundColor) { | |
last_bg = kolor_kolor.style.backgroundColor; | |
onBackgroundChange(last_bg); | |
} else if (kolor_modal.style.display == "block") { | |
kolor_restart.click(); | |
} | |
}, 100); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment