Created
July 22, 2009 15:12
-
-
Save plindberg/152040 to your computer and use it in GitHub Desktop.
Boilerplate for jQuery-powered bookmarklet
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
(function(){ | |
var run=function(){ | |
// code here... | |
}; | |
if(typeof jQuery=='undefined'){ | |
var s=document.createElement('script'); | |
s.src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js'; | |
s.loaded=false; | |
s.onload=function(){ | |
s.loaded=true; | |
run(); | |
}; | |
s.onreadystatechange=function(){ | |
if('loaded'==s.readyState&&!s.loaded){ | |
s.onload(); | |
} | |
}; | |
document.getElementsByTagName('head')[0].appendChild(s); | |
jQuery.noConflict(); | |
}else{ | |
run(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment