Skip to content

Instantly share code, notes, and snippets.

@cympfh
Last active August 29, 2015 14:17
Show Gist options
  • Save cympfh/140a8100d1a81237ac57 to your computer and use it in GitHub Desktop.
Save cympfh/140a8100d1a81237ac57 to your computer and use it in GitHub Desktop.
[看你有多色﹣暴走微遊戲](http://game.ioxapp.com/color/)
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