Created
September 3, 2010 20:12
-
-
Save blech75/564487 to your computer and use it in GitHub Desktop.
a little Prototype.js magic for returning the domains of external JS files
This file contains 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
$A(document.getElementsByTagName('SCRIPT')).reject(function(s){ | |
return !s.getAttribute('src'); | |
}).map(function(s){ | |
return s.getAttribute('src'); | |
}).reject(function(u){ | |
return u.charAt(0) == "/"; | |
}).map(function(u){ | |
return /^https?:\/\/([^/]+)/i.exec(u)[1]; | |
}).uniq(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment