Skip to content

Instantly share code, notes, and snippets.

@irace
Created June 23, 2011 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save irace/1041837 to your computer and use it in GitHub Desktop.
Save irace/1041837 to your computer and use it in GitHub Desktop.
Simple bookmarklet template with jQuery
// Stripped down jQuerify for modern browsers: http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
(function() {
var f = function() {
jQuery.noConflict()(function($) {
// Bookmarklet code goes here
});
};
if (typeof jQuery != 'undefined') {
f();
} else {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = 'http://code.jquery.com/jquery-latest.min.js';
script.onload = function() {
f();
head.removeChild(script);
};
head.appendChild(script);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment