I'm working on a greasemonkey script and I'm having some trouble...
What I would like to do is to scan a page for links, store them, and then open them - one at a time - in a new window...eventually, I would like to have this timed (every 10 seconds or so) so that I could scan through a massive number of links automatically...
What I have so far is this:
Expand|Select|Wrap|Line Numbers
- var allLinks, thisLink;
- allLinks = document.evaluate(
- '//a[@href]',
- document,
- null,
- XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
- null);
- var counter, whilecounter;
- counter = 0;
- whilecounter = 0;
- while(counter<allLinks.snapshotLength && counter < 5){
- if(whilecounter == 10000){
- thisLink = allLinks.snapshotItem(counter);
- window.open(thisLink);
- counter++;
- whilecounter = 0;
- continue;
- }
- else{
- whilecounter++;
- }
- } // end while
This is also an extremely ineffective timing system...does js have a timer
/clock that I can utilize?
Firebug keeps giving me an error .... _uVoid undefined
Any ideas?
Tom