Skip to content

Instantly share code, notes, and snippets.

@gkucmierz
Created April 10, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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