Created
April 10, 2015 14:12
-
-
Save gkucmierz/cf7d66a226a55d5cfc2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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