Provides a JavaScript script to assist all PDF file links in the Thunderbolt download page

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.