Last active
August 29, 2015 14:17
-
-
Save nkpznkpz/764f15144b35056d4787 to your computer and use it in GitHub Desktop.
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
var nextzy = {}; | |
nextzy.checkAns = function(el) { | |
for (var i = 0; i < el.length - 1; i++) { | |
if ($((el)[i]).css("background-color") == $((el)[i + 1]).css( | |
"background-color")) { | |
nextzy.tmp = $((el)[i]); | |
} else {// if index 1 == index 2 diff is index 0 | |
if (i == 0 && $((el)[i + 1]).css("background-color") == $((el)[i + 2]).css("background-color")) { | |
$((el)[0]).fadeOut(300, function() {$(this).click()}); | |
break; | |
} else { | |
$((el)[i + 1]).fadeOut(300, function() {$(this).click() }); | |
break; | |
} | |
} | |
} | |
}; | |
(function theLoop(i) { | |
setTimeout(function() { | |
if (--i) { // If i > 0, keep going | |
nextzy.checkAns($("#box > span").get()); | |
theLoop(i); // Call the loop again, and pass it the current value of i | |
} | |
}, 300);//delay | |
})(500);//loop number |
Over engineering? I don't check this snippet whether it is correct or not. But the most easiest way that I do recently is loop click on span tag without specific span (but better to limit scope) with some human delay to avoid browser freeze. But it is not fun anymore.
But it is not fun anymore. 555
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
เอาไปวางใน Console แล้วรันโลดดดดด