A friend of mine asked me for a simple bookmarklet today. He uses Safari so that opens up a few possibilities.
Take a CSS Selector and run the click
method on each matching element.
And here it is:
Drag that link to your bookmarks and you’re good to go.
Known to work in Safari beta 4. Has not been tested anywhere else.
Could also work in IE8 or Firefox 3.1+ or Safari 3.1+
The code is all up on gist.github.com
javascript:function%20SubtleClickAll(SELECTOR,timeout){timeout=timeout||0;var%20node,nodes=Array.prototype.slice.call(document.querySelectorAll(SELECTOR));function%20NEXT(){node=nodes.pop();if(node)setTimeout(function(){node.click();NEXT();},timeout);};NEXT();};SubtleClickAll(prompt(%22SubtleClickAll%20(Thomas%20Aylott%20subtleGradient.com)%22,%22CSS3%20Selector%22),10); |
<a href="javascript:function%20SubtleClickAll(SELECTOR,timeout){timeout=timeout||0;var%20node,nodes=Array.prototype.slice.call(document.querySelectorAll(SELECTOR));function%20NEXT(){node=nodes.pop();if(node)setTimeout(function(){node.click();NEXT();},timeout);};NEXT();};SubtleClickAll(prompt(%22SubtleClickAll%20(Thomas%20Aylott%20subtleGradient.com)%22,%22CSS3%20Selector%22),10);" title="SubtleClickAll (Thomas Aylott subtleGradient.com)">SubtleClickAll</a> | |
<hr /> | |
Known to work in Safari beta 4. Has not been tested anywhere else.<br /> | |
Could also work in IE8 or Firefox 3.1+ or Safari 3.1+ |
function SubtleClickAll(SELECTOR,timeout){ | |
timeout=timeout||0; | |
var node,nodes=Array.prototype.slice.call(document.querySelectorAll(SELECTOR)); | |
function NEXT(){ | |
node=nodes.pop(); | |
if(node)setTimeout(function(){node.click();NEXT();},timeout); | |
};NEXT(); | |
}; | |
SubtleClickAll(prompt("SubtleClickAll (Thomas Aylott subtleGradient.com)","CSS3 Selector"),10); |
javascript:function%20SubtleClickAllJr(SELECTOR)%20{Array.prototype.slice.call(document.querySelectorAll(SELECTOR)).forEach(function(node)%20{node.click();});};SubtleClickAllJr(prompt(%22SubtleClickAll%20(Thomas%20Aylott%20subtleGradient.com)%22,%22CSS3%20Selector%22)); |
function SubtleClickAllJr(SELECTOR) { | |
Array.prototype.slice.call(document.querySelectorAll(SELECTOR)).forEach(function(node) { | |
node.click(); | |
}); | |
}; | |
SubtleClickAllJr(prompt("SubtleClickAllJr (Thomas Aylott subtleGradient.com)","CSS3 Selector")); |
Thomas Aylott / subtleGradient