Last active
August 29, 2015 14:07
-
-
Save kevcenteno/53ec1ba8144caab37e04 to your computer and use it in GitHub Desktop.
Cheat for http://game.ioxapp.com/color/
This file contains 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
(function () { | |
var cheatDelay = 1000; //set how fast you want to cheat | |
var cheat = function () { | |
var boxArr, tempColor, i, $firstBox, $tempBox; | |
boxArr = $('#box').find('span'); | |
$firstBox = $(boxArr[0]); | |
$firstBox.click(); //just click the first box in case it's the win | |
tempColor = $firstBox.css('background-color'); | |
for (i = 1; i < boxArr.length; i++) { | |
$tempBox = $(boxArr[i]); | |
if ( $tempBox.css('background-color') === tempColor ) continue; | |
else $tempBox.click(); return; | |
} | |
}; | |
//let's use MutationObserver | |
var boxEl = document.querySelector('#box'); | |
var observer = new MutationObserver(function(mutations) { | |
if (mutations) setTimeout(cheat, cheatDelay); | |
}); | |
var mutationConfig = { attributes: true }; | |
observer.observe(boxEl, mutationConfig); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey! Nice script 👍
Here is mine https://gist.github.com/vbarinov/e4f321a0832c21cf6f45