-
-
Save jed/974036 to your computer and use it in GitHub Desktop.
iterate over all script tags on the page that aren't scripts
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
function( | |
a, // callback | |
b, // placeholder for nodeList | |
c, // placeholder for "script" | |
d, // placeholder for cursor | |
e // placeholder for current element | |
){ | |
for( // for every | |
b = document // document | |
.getElementsByTagName( // element that is a | |
c = "script" // script, | |
), | |
d = 0; // starting with the first | |
e = b[d++]; // and working forward, | |
) e.src || // if the script has no source | |
/ipt$/.test(e.type || c) // and doesn't have a type ending in "ipt" | |
|| a.call( // call the callback | |
e, // scoped to the current element | |
e.innerHTML, // with its contents and | |
e.id // its id. | |
) | |
} |
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
function(a,b,c,d,e){for(b=document.getElementsByTagName(c="script"),d=0;e=b[d++];)e.src||/ipt$/.test(e.type||c)||a.call(e,e.innerHTML,e.id)} |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
0. You just DO WHAT THE FUCK YOU WANT TO. |
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
{ | |
"name": "nonscripts", | |
"keywords": [ "script", "template", "asset", "include" ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment