var as = document.getElementsByTagName (' A '), var URLs = [];for (var i=0; i<as.length; ++i) { if (/\.pdf$/.test (As[i] . href)) Urls.push (as[i].href);} var E = document.createelement (' DIV '); E.innertext = Urls.join (' \ n ');d ocument.getelementsbytagname (' BODY ') [0].appendchild (E);
A little note:
1, using tagname query DOM elements, the use of full-size is a previous version of the old IE features;
2, set with [], collect elements with push operation, the last join
3. String test using regular expression pattern matching
4, the URL results display, this would like to pop up a popup, only, JS Alert window can not copy the content, the center display of the special modal layer box needs to set too many CSS styles, so it is simply added to the page at the end of the good (of course, you can insertbefore)
5, if the page imported into the query, it may not be so troublesome, but the simple DOM programming is enough
How to use:
F12 Open the Web Developer console, Ctrl + v pastes the above code in to execute. The results are then copied to the download input box of the Thunderbolt.
Provides a JavaScript script to assist all PDF file links in the Thunderbolt download page