Last active
August 29, 2015 14:17
-
-
Save cympfh/140a8100d1a81237ac57 to your computer and use it in GitHub Desktop.
[看你有多色﹣暴走微遊戲](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
it = function () { | |
ls = box.getElementsByTagName('span'); | |
map = {}; | |
push = function (col, i) { | |
if (map[col]) map[col].push(i); | |
else map[col] = [i]; | |
}; | |
for(i=0;i<ls.length;++i) push(ls[i].style.backgroundColor, i); | |
for(col in map) { | |
if (map[col].length == 1) | |
ls[map[col][0]].style.backgroundColor = 'black'; | |
else | |
map[col].forEach(function(i) { | |
ls[i].style.backgroundColor = 'white'; | |
}); | |
} | |
}; | |
setInterval(it, 20); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment