Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Script for run on this site : http://colorrun.pl/
function run(){
function cal(rgb){
var color = 0;
for(var i=0 ; i<3 ; i++){
color = color + eval(rgb[i]);
}
return color;
}
function pickColor(){
var left = $('#color-1').css('background-color');
left = left.slice(4,left.length-1).split(',');
var right = $('#color-2').css('background-color');
right = right.slice(4,right.length-1).split(',');
if (cal(left) > cal(right)) {
$('#color-1').click();
} else {
$('#color-2').click();
}
}
$('.play').click();
setInterval(pickColor, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment