Skip to content

Instantly share code, notes, and snippets.

@gkucmierz
Created April 10, 2015 14:12
Show Gist options
  • Save gkucmierz/cf7d66a226a55d5cfc2b to your computer and use it in GitHub Desktop.
Save gkucmierz/cf7d66a226a55d5cfc2b to your computer and use it in GitHub Desktop.
setInterval(function() {
var count = {};
var spans = [].map.call(document.querySelectorAll('#box span'), function (span) {
var prop = span.style.backgroundColor;
if (count[prop]) {
++count[prop].q;
} else {
count[prop] = {q:1, span: span};
}
});
for (var i in count) {
if (count[i].q === 1) {
count[i].span.click();
}
}
}, 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment