$ jquery loading bookmarklet

by Laurens Maneschijn

HTML

<h1>
  JS bookmarklet for loading jQuery.
</h1>
<p>
	making window.$ available; for use in console, or other bookmarklets.
</p>

<p>
  See script panel for original (non minified) code.
</p>

<p>
  Drag link to bookmarks: 
  <a href="javascript:(function($){if($ && $.fn && $.fn.jquery){if(!confirm('$ already present (v'+$.fn.jquery+').\noverwrite with new jquery (v2.1.1)?\n(run: $.noConflict(); to restore $ to previous version)')){return;}}function s(u){var s = document.createElement('script');s.src = u;document.body.appendChild(s);}if(window.location.protocol == 'file:'){s('https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js');}else{s('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js');}})(window.$);">load jQuery</a>
</p>

CSS

h1,h2,h3,h4,h5,h6{font-size:1em;padding:0 0 0 0;margin:2px 0 2px 0;}
ul,li{margin:0 0 0 0;}

JavaScript

/*
javascript:
(function($){
	if($ && $.fn && $.fn.jquery){
		if(!confirm('$ already present (v'+$.fn.jquery+').\noverwrite with new jquery (v2.1.1)?\n(run: $.noConflict(); to restore $ to previous version)')){
			return;
		}
	}
	function s(u){
		var s = document.createElement('script');
		s.src = u;
		document.body.appendChild(s);
	}
	if(window.location.protocol == 'file:'){
		s('https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js');
	}else{
		s('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js');
	}
})(window.$);
*/