Skip to content

Instantly share code, notes, and snippets.

@plindberg
Created July 22, 2009 15:12
Show Gist options
  • Save plindberg/152040 to your computer and use it in GitHub Desktop.
Save plindberg/152040 to your computer and use it in GitHub Desktop.
Boilerplate for jQuery-powered bookmarklet
(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