Created
July 12, 2014 10:26
-
-
Save mmmaly/1b2be304a2c226ca57d4 to your computer and use it in GitHub Desktop.
pdf test greasemonkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name pdf test | |
// @namespace http://www.example.com | |
// @description Alerts with title and href of any pdf link. | |
// @include http*.sk/* | |
// ==/UserScript== | |
var links = document.getElementsByClassName('pdf'); | |
alert(links.length + ' pdfs on page'); | |
for (i=0; i<links.length; i++) | |
{ | |
alert(links[i].getElementsByTagName('a')[0].title); | |
alert(links[i].getElementsByTagName('a')[0].href); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment