Skip to content

Instantly share code, notes, and snippets.

@mt3
Forked from irace/gist:1041837
Created October 21, 2012 07:00
Show Gist options
  • Save mt3/3926204 to your computer and use it in GitHub Desktop.
Save mt3/3926204 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