Skip to content

Instantly share code, notes, and snippets.

@bibliotechy
Created November 14, 2012 14:04
Show Gist options
  • Save bibliotechy/4072275 to your computer and use it in GitHub Desktop.
Save bibliotechy/4072275 to your computer and use it in GitHub Desktop.
Makes currently winning proposals bada55. Any proposals tied for entry are yellow.
count = 0;
done = false;
$("table.table tbody tr td[class!='election_results_score']").each(function(index){
proposals = $(this).children();
if (count + proposals.length < 20 && done == false) {
proposals.css('background-color','#bada55');
count += proposals.length;
}
else if (count + proposals.length == 20 && done == false){
proposals.css('background-color','#bada55');
count += proposals.length;
done = true;
}
else if (done == false) {
//if more than one occupies the last slot, make them a different color, to show they are maybes.
proposals.css('background-color','yellow');
done = true;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment