Skip to content

Instantly share code, notes, and snippets.

@the5fire
Last active August 29, 2015 14:04
Show Gist options
  • Save the5fire/479b4a8c4b3d8323c65c to your computer and use it in GitHub Desktop.
Save the5fire/479b4a8c4b3d8323c65c to your computer and use it in GitHub Desktop.
color
//http://wbpkh5001.17c.cn/html5/
function clock(){
var color_map = {};
var unfound = true;
var children = $('#box').children();
var i = 0;
$.each(children, function(i, item){
var key = $(item).attr('style');
var nextkey = $(children[i+1]).attr('style');
var v = color_map[key];
console.log(key + ':' + v);
if (!jQuery.isEmptyObject(color_map) && v === undefined && key != nextkey) {
candidate = i;
$(item).click();
unfound = false;
return false;
}
color_map[key] = 'exist';
console.log('1');
i++;
});
if (unfound) {
$($('#box').children()[0]).click();
}
}
setInterval('clock()', 600);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment