Skip to content

Instantly share code, notes, and snippets.

@coma
Created September 30, 2014 16:23
Show Gist options
  • Save coma/4dd4006ceb5c62b03f37 to your computer and use it in GitHub Desktop.
Save coma/4dd4006ceb5c62b03f37 to your computer and use it in GitHub Desktop.
(function () {
var box = document.getElementById('box');
var color = function (node) {
return node.style.backgroundColor;
};
var last, i = 0;
var hack = function () {
box.childNodes[i++].click();
last = setTimeout(hack, 1);
};
var observer = new MutationObserver(function () {
clearTimeout(last);
i = 0;
hack();
});
observer.observe(box, {
attributes: false,
childList: true,
characterData: false
});
hack();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment