<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learning jQuery &#187; Tools</title>
	<atom:link href="http://www.learningjquery.com/category/tools/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Sat, 06 Mar 2010 18:10:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up Visual Studio Intellisense for jQuery</title>
		<link>http://www.learningjquery.com/2009/07/setting-up-visual-studio-intellisense-for-jquery</link>
		<comments>http://www.learningjquery.com/2009/07/setting-up-visual-studio-intellisense-for-jquery#comments</comments>
		<pubDate>Thu, 16 Jul 2009 16:26:39 +0000</pubDate>
		<dc:creator>Ralph Whitbeck</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[jQuery Resources]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.learningjquery.com/?p=822</guid>
		<description><![CDATA[In September 2008, at the jQuery Conference, it was announced that Microsoft would be shipping its upcoming releases of Visual Studio with jQuery built in. They would not fork or change the jQuery code but ship it as is.  Microsoft also announced that they would distribute IntelliSense-annotated documentation JavaScript files for Visual Studio 2008 [...]]]></description>
			<content:encoded><![CDATA[<p>In September 2008, at the jQuery Conference, it was announced that Microsoft would be shipping its upcoming releases of Visual Studio with jQuery built in. They would not fork or change the jQuery code but ship it as is.  Microsoft also announced that they would distribute IntelliSense-annotated documentation JavaScript files for Visual Studio 2008 that developers can reference in their files to enable IntelliSense for jQuery. The following instructions will help you get started using this tool to make writing jQuery scripts faster than ever.</p>
<span id="more-822"></span>
<h4>Setting up Your Files for jQuery IntelliSense</h4>

<p>First, set up jQuery on your page by downloading the latest version from the <a href="http://docs.jquery.com/Downloading_jQuery">jQuery site</a>.</p>

<p>Next, you will need to download the <a href="http://docs.jquery.com/Downloading_jQuery">jQuery Documentation file from the jQuery site</a>.</p>

<p><img src="http://www.learningjquery.com/wp-content/uploads/vs-download.png" alt="download documentation" width="379" height="132" class="alignnone" /></p>

<p>Download the files and add them to your project.</p>
<h4>IntelliSense in external JavaScript files</h4>
<p>At the top of the JavaScript file in which you would like to have jQuery IntelliSense enabled, you will need to add a line to reference the documentation file:</p>
<pre class="highlight"><code><strong class="comment">/// &lt;reference path="jquery-1.3.2-vsdoc2.js" /&gt;</strong></code></pre>
<h4>IntelliSense inline on your ASPX page</h4>
<p>There are a couple of scenarios that may affect if you include a reference to the VSDOC file or not.  If in doubt, just add a reference to the documentation file.</p>
<p>If you are linking to jQuery by the <a href="http://code.google.com/apis/ajaxlibs/">Google Code AJAX Library</a> or are linking to jQuery from anywhere outside of your project you will need to reference the documentation file.</p>
<p>From each ASPX page you want jQuery IntelliSense you’ll want to call the reference within a server-side conditional statement so that the documentation file will still load in Visual Studio but will not load at run-time. Add the following after your jQuery declaration:</p>
<div class="igBar"><span id="lasp-2"><a href="#" onclick="javascript:showPlainTxt('asp-2'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">ASP:</span><br /><div id="asp-2">
<div class="asp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span> <span style="color:#990099; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2-vsdoc2.js&quot;&gt;&lt;/script&gt;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span></div></li>
</ol></div>
</div></div><br />
<p>If you downloaded jQuery and saved it to your project Visual Studio will look for the vsdoc.js file automatically if the following conditions are met.</p>
<p>You've downloaded and installed the <a href="http://blogs.msdn.com/webdevtools/archive/2008/11/07/hotfix-to-enable-vsdoc-js-intellisense-doc-files-is-now-available.aspx">hotfix</a> for Visual Studio.</p>

<p>jQuery and the documentation file need to be named the same with the exception that the documentation file end with -vsdoc.js.  So when you add jQuery to your project make sure to rename them similarly. For instance, <strong>jquery-1.3.2</strong>.js is your jQuery library, Visual Studio will look for the documentation file at <strong>jquery-1.3.2</strong>-vsdoc.js and load it.</p>
<p>(Note: the jQuery 1.3.2 documentation file is named jquery-1.3.2-vsdoc2.js on the Download page so make sure you take out the 2 so that the file will be found by Visual Studio)</p>
<p>If you can't meet these conditions you'll need to reference the documentation file as shown above.</p>
<p>To test to make sure the documentation file loaded correctly, you can type <code>$(</code> and you should be presented with some documentation.</p>
<p><img src="http://www.learningjquery.com/wp-content/uploads/vs-test.png" alt="test IntelliSense" width="576" height="96" class="alignnone" /></p>
<p>Additionally, you can type in <code>$(document).r</code> and you will be presented with a drop down of available options to choose from, one being "ready."</p>

<p><img src="http://www.learningjquery.com/wp-content/uploads/vs-docready.png" alt="test with document ready" width="541" height="169" class="alignnone" /></p>
<p>Now as you write your jQuery code, you'll be helped along by seeing what methods and properties are available to you.</p>
<h4>Related Links</h4>
<ul>
  <li><a href="http://blogs.msdn.com/webdevtools/archive/2008/10/28/rich-IntelliSense-for-jquery.aspx">Rich IntelliSense for jQuery</a></li>
  <li><a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx">jQuery and Microsoft</a></li>
  <li><a href="http://blog.jquery.com/2008/09/28/jquery-microsoft-nokia/">jQuery, Microsoft and Nokia</a></li>
  <li><a href="http://blogs.msdn.com/webdevtools/archive/2008/11/07/hotfix-to-enable-vsdoc-js-intellisense-doc-files-is-now-available.aspx">VS2008 SP1 Hotfix to Support "-vsdoc.js" IntelliSense Doc Files</a></li>
</ul>
<div class="update">
  <h4>Update</h4>
 <p>I've updated the post to reflect the hotfix for Visual Studio which enables Visual Studio to automatically load the documentation file for inline jQuery on ASPX pages if it's named similarly to the jQuery file.  Thanks to Dave Ward for pointing this out in the comments.</p>
</div>
[inline][/inline]
]]></content:encoded>
			<wfw:commentRss>http://www.learningjquery.com/2009/07/setting-up-visual-studio-intellisense-for-jquery/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Better, Stronger, Safer jQuerify Bookmarklet</title>
		<link>http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet</link>
		<comments>http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet#comments</comments>
		<pubDate>Wed, 29 Apr 2009 14:12:43 +0000</pubDate>
		<dc:creator>Karl Swedberg</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Beginner]]></category>
		<category><![CDATA[DOM Traversing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[jQuery Resources]]></category>
		<category><![CDATA[bookmarklets]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.learningjquery.com/?p=687</guid>
		<description><![CDATA[A long time ago I built myself a little bookmarklet to load jQuery on pages that don't already have it. The idea was to allow me to play around with any page on the web, using jQuery in the Firebug (and now Safari or IE8) console. I blogged about it, got lots of great feedback, [...]]]></description>
			<content:encoded><![CDATA[<p>A long time ago I built myself a little bookmarklet to load jQuery on pages that don't already have it. The idea was to allow me to play around with any page on the web, using jQuery in the Firebug (and now Safari or IE8) console. I <a href="http://www.learningjquery.com/2006/12/jquerify-bookmarklet">blogged about it</a>, got lots of great feedback, and then <a href="http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet">blogged about an improved version</a>. Now that a lot more great feedback has come through the comments of the updated bookmarklet post, I've decided to update it one more time.</p>
<span id="more-687"></span>
<h4>The Bookmarklet</h4>
<p>To use the bookmarklet, drag the following link to your bookmark/favorites list:</p>
<p> 
&raquo; [inline]<a href="javascript:%20(function(){var%20el=document.createElement('div'),b=document.getElementsByTagName('body')[0];otherlib=false,msg='';el.style.position='fixed';el.style.height='32px';el.style.width='220px';el.style.marginLeft='-110px';el.style.top='0';el.style.left='50%';el.style.padding='5px%2010px%205px%2010px';el.style.zIndex=1001;el.style.fontSize='12px';el.style.color='#222';el.style.backgroundColor='#f99';if(typeof%20jQuery!='undefined'){msg='This%20page%20already%20using%20jQuery%20v'+jQuery.fn.jquery;return%20showMsg();}else%20if(typeof%20$=='function'){otherlib=true;}%20function%20getScript(url,success){var%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&#038;&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();}};head.appendChild(script);}%20getScript('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',function(){if(typeof%20jQuery=='undefined'){msg='Sorry,%20but%20jQuery%20wasn\'t%20able%20to%20load';}else{msg='This%20page%20is%20now%20jQuerified%20with%20v'+jQuery.fn.jquery;if(otherlib){msg+='%20and%20noConflict().%20Use%20$jq(),%20not%20$().';}}%20return%20showMsg();});function%20showMsg(){el.innerHTML=msg;b.appendChild(el);window.setTimeout(function(){if(typeof%20jQuery=='undefined'){b.removeChild(el);}else{jQuery(el).fadeOut('slow',function(){jQuery(this).remove();});if(otherlib){$jq=jQuery.noConflict();}}},2500);}})();">jQuerify</a>[/inline] &laquo;
</p>
<p>Then, when you're on a page in which you want to play around with jQuery in the console, just click the bookmarklet.</p>

<h4>Problems with the Other One</h4>
<p>The biggest problem with the former version was that it didn't work when other libraries that use the <code>$</code> function, such as Prototype and Mootools, were already loaded on the page. A number of people in the comments suggested that I simply add a <code>jQuery.noConflict();</code> line to the script. But I wasn't crazy about the idea of having to use <code>jQuery()</code> instead of <code>$()</code> even if no other libraries had been loaded. </p>

<p>Another problem, one that I noticed while testing my new version, was that sometimes the jQuery file that I was inserting from the Google CDN wouldn't fully load by the time I attempted to use it later in the bookmarklet. At least, I think that's what was going on. In any case, it was throwing a "jQuery is not defined" error.</p>

<h4>A Few Improvements in This One</h4>
<p>To handle the problems, I'm having the script do a few things differently:</p>
<ul>
  <li>Set up a counter to check 10 times if jQuery is loaded before giving up. </li>
  <li>Use a setTimeout to put a one-quarter-second (250ms) delay interval in between attempts.</li>
  <li>Check if the <code>$()</code> function is already being used by another library. If it is:
    <ul>
      <li>use jQuery's $.noConflict function to release the <code>$()</code> to the other library. </li>
      <li>set <code>$jq</code> as an alias to <code>jQuery</code> for convenience.</li>
      <li>mention in the flash notice that jQuery is in noConflict mode and that <code>$jq()</code> should be used instead of <code>$()</code>.</li>
    </ul>
  </li>
  <li>If after multiple attempts jQuery still won't load for some reason, set the flash notice's message accordingly and then remove it through plain old JavaScript rather than jQuery.</li>
</ul>

<p>Here is the script in its unbookmarkleted form:</p>

<div class="igBar"><span id="ljavascript-5"><a href="#" onclick="javascript:showPlainTxt('javascript-5'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JavaScript:</span><br /><div id="javascript-5">
<div class="javascript" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> s<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; el<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; b<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#93;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> otherlib<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; startCounter<span style="color: #339933;">=</span>tryCounter<span style="color: #339933;">=</span><span style="color: #CC0000;color:#800000;">10</span><span style="color: #339933;">,</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; delay<span style="color: #339933;">=</span><span style="color: #CC0000;color:#800000;">250</span><span style="color: #339933;">,</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; msg<span style="color: #339933;">=</span><span style="color: #3366CC;">''</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; s.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js'</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=position"><span style="">position</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'fixed'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=height"><span style="">height</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'32px'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=width"><span style="">width</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'220px'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginLeft</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'-110px'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">top</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'0'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">left</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'50%'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'5px 10px 5px 10px'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">fontSize</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'12px'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'#222'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'#f99'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">!=</span><span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; msg<span style="color: #339933;">=</span><span style="color: #3366CC;">'This page already using jQuery v'</span><span style="color: #339933;">+</span>jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">jquery</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> showMsg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> $<span style="color: #339933;">==</span><span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; otherlib<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">function</span> showMsg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; el.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>msg;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; b.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; window.<span style="color: #660066;">setTimeout</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">==</span><span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; b.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=fadeOut"><span style="">fadeOut</span></a><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=remove"><span style="">remove</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>otherlib<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $jq<span style="color: #339933;">=</span>jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #339933;">,</span><span style="color: #CC0000;color:#800000;">2500</span><span style="color: #009900;">&#41;</span>; &nbsp; &nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> tryjQuery<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">==</span><span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tryCounter<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tryCounter<span style="color: #339933;">--</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tryjQuery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg<span style="color: #339933;">=</span><span style="color: #3366CC;">'Sorry, but after '</span> <span style="color: #339933;">+</span> startCounter <span style="color: #339933;">+</span> <span style="color: #3366CC;">' attempts, jQuery hasn'</span>t loaded<span style="color: #3366CC;">';</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showMsg();</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp; &nbsp; &nbsp;}</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp; &nbsp;} else {</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp; &nbsp; &nbsp;msg='</span><span style="color: #000066; font-weight: bold;">This</span> page <span style="color: #000066; font-weight: bold;">is</span> now jQuerified <span style="color: #000066; font-weight: bold;">with</span> v<span style="color: #3366CC;">' + jQuery.fn.jquery;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp; &nbsp; &nbsp;if (otherlib) {msg+='</span> and noConflict<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>. <span style="color: #003366; font-weight: bold;">Use</span> $jq<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=not"><span style="">not</span></a> $<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #3366CC;">';}</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp; &nbsp; &nbsp;showMsg();</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp; &nbsp;}</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp; &nbsp;}, delay);</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp;};</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;"> &nbsp;tryjQuery();</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3366CC;">})();</span></div></li>
</ol></div>
</div></div><br />
<p> I'm sure it can be improved even further. If you have suggestions for making it more elegant, more efficient, more betterer, I would love to hear them in the comments.</p>
<div class="update">
<h4>Update</h4>
<p>Based on a few comments, I've updated the script one more time to "basically watch the onload and readyState, and fire the callback, thus removing the necessity to poll," as <a href="#comment-72913">Paul Irish describes below</a>.</p>
<p>Here is the updated link (I also updated it above):</p>
<p>&raquo; [inline]<a href="javascript:%20(function(){var%20el=document.createElement('div'),b=document.getElementsByTagName('body')[0];otherlib=false,msg='';el.style.position='fixed';el.style.height='32px';el.style.width='220px';el.style.marginLeft='-110px';el.style.top='0';el.style.left='50%';el.style.padding='5px%2010px%205px%2010px';el.style.zIndex=1001;el.style.fontSize='12px';el.style.color='#222';el.style.backgroundColor='#f99';if(typeof%20jQuery!='undefined'){msg='This%20page%20already%20using%20jQuery%20v'+jQuery.fn.jquery;return%20showMsg();}else%20if(typeof%20$=='function'){otherlib=true;}%20function%20getScript(url,success){var%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&#038;&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();}};head.appendChild(script);}%20getScript('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',function(){if(typeof%20jQuery=='undefined'){msg='Sorry,%20but%20jQuery%20wasn\'t%20able%20to%20load';}else{msg='This%20page%20is%20now%20jQuerified%20with%20v'+jQuery.fn.jquery;if(otherlib){msg+='%20and%20noConflict().%20Use%20$jq(),%20not%20$().';}}%20return%20showMsg();});function%20showMsg(){el.innerHTML=msg;b.appendChild(el);window.setTimeout(function(){if(typeof%20jQuery=='undefined'){b.removeChild(el);}else{jQuery(el).fadeOut('slow',function(){jQuery(this).remove();});if(otherlib){$jq=jQuery.noConflict();}}},2500);}})();">jQuerify</a>[/inline] &laquo;</p>
<p>And here is the updated script:</p>
</div>
<div class="igBar"><span id="ljavascript-6"><a href="#" onclick="javascript:showPlainTxt('javascript-6'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JavaScript:</span><br /><div id="javascript-6">
<div class="javascript" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> el<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; b<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#93;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; otherlib<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; msg<span style="color: #339933;">=</span><span style="color: #3366CC;">''</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=position"><span style="">position</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'fixed'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=height"><span style="">height</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'32px'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=width"><span style="">width</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'220px'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginLeft</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'-110px'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">top</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'0'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">left</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'50%'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'5px 10px 5px 10px'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">zIndex</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;color:#800000;">1001</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">fontSize</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'12px'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'#222'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'#f99'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">!=</span><span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; msg<span style="color: #339933;">=</span><span style="color: #3366CC;">'This page already using jQuery v'</span><span style="color: #339933;">+</span>jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">jquery</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> showMsg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> $<span style="color: #339933;">==</span><span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; otherlib<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; </div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #006600; font-style: italic;">// more or less stolen form jquery core and adapted by paul irish</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">function</span> getScript<span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span>success<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> script<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; script.<span style="color: #660066;">src</span><span style="color: #339933;">=</span>url;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> head<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> </div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; done<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Attach handlers for all browsers</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; script.<span style="color: #000066;">onload</span><span style="color: #339933;">=</span>script.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>done &#038;& <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">readyState</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'loaded'</span> </div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'complete'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; done<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; success<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; head.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>script<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; getScript<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> </div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">==</span><span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; msg<span style="color: #339933;">=</span><span style="color: #3366CC;">'Sorry, but jQuery wasn<span style="color: #000099; font-weight: bold;">\'</span>t able to load'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; msg<span style="color: #339933;">=</span><span style="color: #3366CC;">'This page is now jQuerified with v'</span> <span style="color: #339933;">+</span> jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">jquery</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>otherlib<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>msg<span style="color: #339933;">+=</span><span style="color: #3366CC;">' and noConflict(). Use $jq(), not $().'</span>;<span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> showMsg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">function</span> showMsg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; el.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>msg;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; b.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; window.<span style="color: #660066;">setTimeout</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">==</span><span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; b.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=fadeOut"><span style="">fadeOut</span></a><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=remove"><span style="">remove</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>otherlib<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $jq<span style="color: #339933;">=</span>jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #339933;">,</span><span style="color: #CC0000;color:#800000;">2500</span><span style="color: #009900;">&#41;</span>; &nbsp; &nbsp;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
</ol></div>
</div></div><br />
<p>Let me know if this one causes any problems.</p>]]></content:encoded>
			<wfw:commentRss>http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet/feed</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>Updated jQuery Bookmarklet</title>
		<link>http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet</link>
		<comments>http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet#comments</comments>
		<pubDate>Sun, 08 Jun 2008 18:36:48 +0000</pubDate>
		<dc:creator>Karl Swedberg</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[jQuery Resources]]></category>
		<category><![CDATA[bookmarklets]]></category>
		<category><![CDATA[favelets]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet</guid>
		<description><![CDATA[
For the most recent version of the bookmarklet, see the Better, Stronger, Safer jQuerify Bookmarklet entry.

About 1 1/2 years ago I put together a little "jQuerify" Bookmarklet (and blogged about it here). It's a nice little tool that allows you to play around with jQuery on a page that doesn't already have jQuery loaded and [...]]]></description>
			<content:encoded><![CDATA[<div class="update">
<p>For the most recent version of the bookmarklet, see the <a href="http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet/">Better, Stronger, Safer jQuerify Bookmarklet</a> entry.</p>
</div>
<p>About 1 1/2 years ago I put together a little "jQuerify" Bookmarklet (and <a href="http://www.learningjquery.com/2006/12/jquerify-bookmarklet">blogged about it here</a>). It's a nice little tool that allows you to play around with jQuery on a page that doesn't already have jQuery loaded and see the results immediately. Based on feedback from others, I've updated the bookmarklet a bit. Now, it first checks to see if jQuery is already loaded on the page and doesn't bother loading it if it's there. Also, instead of showing an alert message, it temporarily places an absolutely positioned div at the top of the page with a message saying either "This page is now jQuerified" or "This page was already jQuerified." After 2 1/2 seconds, the message fades out and is removed from the DOM. Here is what the script looks like before it is converted to bookmarklet format (replacing spaces with %20, etc.): </p><span id="more-96"></span>

<div class="igBar"><span id="ljavascript-8"><a href="#" onclick="javascript:showPlainTxt('javascript-8'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JavaScript:</span><br /><div id="javascript-8">
<div class="javascript" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #003366; font-weight: bold;">var</span> s<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">s.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js'</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">!=</span><span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> msg<span style="color: #339933;">=</span><span style="color: #3366CC;">'This page already using jQuery v'</span> <span style="color: #339933;">+</span> jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">jquery</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> msg<span style="color: #339933;">=</span><span style="color: #3366CC;">'This page is now jQuerified'</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #003366; font-weight: bold;">var</span> el<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=position"><span style="">position</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'fixed'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=height"><span style="">height</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'30'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=width"><span style="">width</span></a><span style="color: #339933;">=</span><span style="color: #3366CC;">'200'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">margin</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'0 auto 0 auto'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">id</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'jq-kswedberg'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">top</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'0'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">left</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'40%'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'5px 10px 5px 10px'</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'#f99'</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; el.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>msg;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #003366; font-weight: bold;">var</span> b<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#93;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">b.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">window.<span style="color: #660066;">setTimeout</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#jq-kswedberg'</span><span style="color: #009900;">&#41;</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=fadeOut"><span style="">fadeOut</span></a><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=remove"><span style="">remove</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;color:#800000;">2500</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
</ol></div>
</div></div><br />
<p>It might look like a lot of code for something so simple, but most of it is just setting the styles for the inserted <code>div</code> element. Speaking of which, if you're using this in Internet Explorer 6, you might want to change <code>el.style.position='fixed'</code> to <code>el.style.position='absolute'</code>. Also, notice that the script's src is now pointing to the new Google CDN. Nice!</p>

<p>Here is the bookmarklet, ready to go:</p>

&raquo; <a href="javascript:(function(){var%20s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js');if(typeof%20jQuery!='undefined'){var%20msg='This%20page%20already%20using%20jQuery%20v'+jQuery.fn.jquery;}else{document.getElementsByTagName('head')[0].appendChild(s);var%20msg='This%20page%20is%20now%20jQuerified';}var%20el=document.createElement('div');el.style.position='fixed';el.style.height='30';el.style.width='200';el.style.margin='0%20auto%200%20auto';el.id='jq-kswedberg';el.style.top='0';el.style.left='40%';el.style.padding='5px%2010px%205px%2010px';el.style.backgroundColor='#f99';el.innerHTML=msg;var%20b=document.getElementsByTagName('body')[0];b.appendChild(el);window.setTimeout(function()%20{jQuery('#jq-kswedberg').fadeOut('slow',function(){jQuery(this).remove()});},2500);})();">jQuerify</a> &laquo;

<p>Just drag it up to your bookmarks (or favorites) toolbar. Then, when you're on a page that doesn't have jQuery, all you have to do is click on the bookmarklet and you'll be ready to play around with jQuery on that page through the browser's console.</p>

<p>What? Your browser doesn't have a console? If you're using <strong>Firefox</strong>, you can download the <a href="http://www.getfirebug.com/">Firebug</a> add-on and use its console (you should really have this add-on anyway; it's amazingly helpful for html/css/js development). For <strong>Safari</strong>, open the Advanced tab in the Preferences and check the checkbox for "Show Develop menu in menu bar." Then you can open the console by selecting <strong>Develop > Show Error Console</strong>. Finally, the <a href="http://www.debugbar.com/">DebugBar plugin</a> has a console that can be used in Internet Explorer.</p>

<h4>Update</h4>
<p>Thanks to Jonno's suggestion in <a href="#comment-49121">comment #4 below</a>, I've slightly modified the bookmarklet again to show which version of jQuery has been included on the page. If you ever want to know the jQuery version without using the bookmarklet, just type this in the console: <code>jQuery.fn.jquery</code>.</p>

<h4>Update 2</h4>
<p><a href="#comment-49132">Mark Fowler suggested</a> that I "properly scope" the bookmarklet so variables wouldn't pollute the global namespace. Makes sense to me, so now the bookmarklet is updated with a self-executing function wrapping it. No need anymore for the void(s) at the end, since the variable is only defined within th</p>]]></content:encoded>
			<wfw:commentRss>http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet/feed</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Have Your jQuery Fun on Any Site with Greasemonkey</title>
		<link>http://www.learningjquery.com/2007/02/have-your-jquery-fun-on-any-site-with-greasemonkey</link>
		<comments>http://www.learningjquery.com/2007/02/have-your-jquery-fun-on-any-site-with-greasemonkey#comments</comments>
		<pubDate>Fri, 02 Feb 2007 04:36:16 +0000</pubDate>
		<dc:creator>Karl Swedberg</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[jQuery Resources]]></category>

		<guid isPermaLink="false">http://www.learningjquery.com/2007/02/have-your-jquery-fun-on-any-site-with-greasemonkey</guid>
		<description><![CDATA[Hot on the heels of my jQuerify Bookmarklet entry [note: update bookmarklet here] and John Resig's Hacking Digg with Firebug and jQuery entry, Joan Piedra has put together a Greasemonkey user script (Firefox only) that lets jQuery load automatically on any site that you've set for it in the Greasemonkey preferences dialog. 


Not only that, [...]]]></description>
			<content:encoded><![CDATA[<p>Hot on the heels of my <a href="/2006/12/jquerify-bookmarklet">jQuerify Bookmarklet entry</a> [<ins datetime="2008-07-02T16:44:53+00:00">note: <a href="/2008/06/updated-jquery-bookmarklet">update bookmarklet here</a></ins>] and John Resig's <a href="http://ejohn.org/blog/hacking-digg-with-firebug-and-jquery/">Hacking Digg with Firebug and jQuery</a> entry, <a href="http://joanpiedra.com/jquery/greasemonkey/">Joan Piedra</a> has put together a <a href="https://addons.mozilla.org/firefox/748/">Greasemonkey</a> <a href="http://userscripts.org/">user script</a> (<a href="http://www.getfirefox.com">Firefox</a> only) that lets jQuery load automatically on any site that you've set for it in the Greasemonkey preferences dialog. </p>
<span id="more-50"></span>

<p>Not only that, but this user script even gives you a placeholder to add your own jQuery code, so you can create specialized user scripts that take advantage of jQuery. </p>
<div class="update">
<h4><ins datetime="2009-03-05T04:54:52+00:00">Update</ins></h4>
<p>There has been a lot of improvement in this area over the past couple years. For more information see <a href="http://wiki.greasespot.net/Code_snippets#jQuery_in_Greasemonkey_scripts_using_the_metadata_key_.40require">jQuery in Greasemonkey scripts using the metadata key @require</a></p>
</div>
<h4>The Script</h4>
<p>The default code, once jQuery has been loaded, is an alert, so you may want to comment out that line right away (unless, of course, you like alert messages popping up for every web page). For the time being, I've replaced it in mine with an inline message that is removed after making a cameo appearance. Here is what that looks like, with a little of Joan's context:</p>

<div class="igBar"><span id="ljavascript-11"><a href="#" onclick="javascript:showPlainTxt('javascript-11'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JavaScript:</span><br /><div id="javascript-11">
<div class="javascript" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #006600; font-style: italic;">// All your GM code must be inside this function</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #003366; font-weight: bold;">function</span> letsJQuery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #006600; font-style: italic;">//make sure there is no conflict between jQuery and other libraries</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=$.noConflict"><span style="">$.<span style="color: #660066;">noConflict</span></span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #006600; font-style: italic;">//notify that jQuery is running...</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div&gt;jQuery is running!&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; .<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=css"><span style="">css</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>padding<span style="color: #339933;">:</span> <span style="color: #3366CC;">'10px'</span><span style="color: #339933;">,</span> background<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#ffc'</span><span style="color: #339933;">,</span> <a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=position"><span style="">position</span></a><span style="color: #339933;">:</span> <span style="color: #3366CC;">'absolute'</span><span style="color: #339933;">,</span>top<span style="color: #339933;">:</span> <span style="color: #3366CC;">'0'</span><span style="color: #339933;">,</span> <a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=width"><span style="">width</span></a><span style="color: #339933;">:</span> <span style="color: #3366CC;">'100%'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; .<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=prependTo"><span style="">prependTo</span></a><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; .<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=fadeIn"><span style="">fadeIn</span></a><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'fast'</span><span style="color: #009900;">&#41;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; .<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=animate"><span style="">animate</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;color:#800000;">1.0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;color:#800000;">300</span><span style="color: #009900;">&#41;</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; .<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=fadeOut"><span style="">fadeOut</span></a><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'fast'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<a href="http://www.learningjquery.com/wp-content/themes/ljq/docs.php?fn=remove"><span style="">remove</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #006600; font-style: italic;">//start custom jQuery scripting.</span></div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li>
</ol></div>
</div></div><br />

<p><strong>Note:</strong> This is not the full user script. It is just a snippet that runs once jQuery has been loaded via Greasemonkey.</p>
 
<p>To be considerate of John Resig's bandwidth, we should all change the following line to point to our own copy of jquery.js:</p>

<div class="igBar"><span id="ljavascript-12"><a href="#" onclick="javascript:showPlainTxt('javascript-12'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JavaScript:</span><br /><div id="javascript-12">
<div class="javascript" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">GM_JQ.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://code.jquery.com/jquery-latest.pack.js'</span>;</div></li>
</ol></div>
</div></div><br />

<h4>Oh, the Possibilities!</h4>
<p>I am very excited about the possibilities that Joan's Greasemonkey script will open up for jQuery scripters. For example, John Resig's Digg hacks would work great in a user script. In fact, I just whipped one up this evening. Try it out: <a href="http://examples/learningjquery.com/50/hackingdigg.user.js">Hacking Digg with jQuery and Greasemonkey</a>! It attaches a "sticky" menu  of options (using <code>position:fixed</code>) to the top-right corner of any Digg page with buried comments:</p>

<img class="bordered" src="http://examples.learningjquery.com/50/gm-jq.gif" alt="hacking digg options - open" />

<p>And, you can tuck it to the side to keep it from getting in your way:</p>

<p><img class="bordered" src="http://examples.learningjquery.com/50/gm-jq2.gif" alt="hacking digg options - closed" /></p>

<p>Also, keep an eye out for a jQuery <em>extension</em> for Mozilla/Firefox, currently being worked on by <a href="http://www.dan-atkinson.com/wp/">Dan Atkinson</a>.</p>

<p>Get Joan Piedra's <a href="http://joanpiedra.com/jquery/greasemonkey/">jQuery for Greasemonkey user script</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.learningjquery.com/2007/02/have-your-jquery-fun-on-any-site-with-greasemonkey/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>jQuerify Bookmarklet</title>
		<link>http://www.learningjquery.com/2006/12/jquerify-bookmarklet</link>
		<comments>http://www.learningjquery.com/2006/12/jquerify-bookmarklet#comments</comments>
		<pubDate>Sat, 16 Dec 2006 03:55:32 +0000</pubDate>
		<dc:creator>Karl Swedberg</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[jQuery Resources]]></category>

		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/jquerify-bookmarklet</guid>
		<description><![CDATA[Someone recently asked if it was possible to somehow include jQuery in Firebug for testing jQuery code on web pages that don't already have it included. 

It's not only possible to include the jQuery source right from the Firebug console, but you can also add a bookmarklet to your Bookmarks toolbar for one-click jQuery action!

Here [...]]]></description>
			<content:encoded><![CDATA[<p>Someone recently asked if it was possible to somehow include jQuery in <a href="http://getfirebug.com">Firebug</a> for testing jQuery code on web pages that don't already have it included. </p>

<p>It's not only possible to include the jQuery source right from the Firebug console, but you can also add a bookmarklet to your Bookmarks toolbar for one-click jQuery action!</p>

<p>Here is an example of what you could type into the Firebug console, line by line, to make a page ready for jQuery fun:</p>
<div class="igBar"><span id="ljavascript-14"><a href="#" onclick="javascript:showPlainTxt('javascript-14'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JavaScript:</span><br /><div id="javascript-14">
<div class="javascript" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #003366; font-weight: bold;">var</span> s<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: bold; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">s.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'http://jquery.com/src/jquery-latest.js'</span><span style="color: #009900;">&#41;</span>;</div></li>
<li style="font-weight: normal; vertical-align:top;color:#ACAA9A;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span>;</div></li>
</ol></div>
</div></div><br />
<p>Or, simply drag the following link to your Bookmarks toolbar:</p> 
<h4>&gt; <a href="javascript:var%20s=document.createElement('script');s.setAttribute('src',%20'http://jquery.com/src/jquery-latest.js');document.getElementsByTagName('body')[0].appendChild(s);alert('thank you for using jquery!');void(s);">jQuerify</a> &lt;</h4>
<p><img id="image40" src="/wp-content/uploads/2006/12/google-jquerified.png" alt="google jquerified" /></p>

<p>Please note that both the JavaScript example code and the jQuerify bookmarklet point to the jQuery source code on <a href="http://jquery.com">jquery.com</a>. I've heard it's considered poor etiquette to freeload off of someone else's server like that, so if you plan to use the bookmarklet regularly, please point it to a copy of the source code on your own server if you have one.</p>

<p>Also, in the bookmarklet I added an alert message that says "Thank you for using jquery" when you activate it. I wanted that in there for myself because I like knowing for sure that it's working. Feel free to pluck that part out, though, if it annoys you.</p>

<p>Thanks to the folks at <a href="http://leftlogic.com">Left Logic</a> for their <a href="http://leftlogic.com/info/articles/microformats_bookmarklet">microformats bookmarklet</a>, which inspired me to make this one. In fact, the jQuerify bookmarklet is just a subset of theirs.</p>

<div class="update">
<h4>Update</h4>
<p>Please see my entry about the <del datetime="2009-05-16T03:28:58+00:00"><a href="http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet">updated and improved bookmarklet</a></del> <ins datetime="2009-05-16T03:28:58+00:00"><a href="http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet/">Better, Stronger, Safer jQuerify Bookmarklet</a></ins>.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.learningjquery.com/2006/12/jquerify-bookmarklet/feed</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>TextMate Bundle for jQuery</title>
		<link>http://www.learningjquery.com/2006/09/textmate-bundle-for-jquery</link>
		<comments>http://www.learningjquery.com/2006/09/textmate-bundle-for-jquery#comments</comments>
		<pubDate>Thu, 14 Sep 2006 21:00:20 +0000</pubDate>
		<dc:creator>Karl Swedberg</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Effects]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[jQuery Resources]]></category>

		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/textmate-bundle-for-jquery</guid>
		<description><![CDATA[JonBob and I have been working on a TextMate bundle for jQuery over the past few weeks. If you're not familiar with TextMate and you own a Mac, you should definitely check it out. It has saved me countless hours of repetitive keystrokes with its bundles, which contain commands, code snippets, templates, and macros that [...]]]></description>
			<content:encoded><![CDATA[<p>JonBob and I have been working on a <a href="http://www.macromates.com">TextMate</a> bundle for jQuery over the past few weeks. If you're not familiar with TextMate and you own a Mac, you should definitely check it out. It has saved me countless hours of repetitive keystrokes with its bundles, which contain commands, code snippets, templates, and macros that are triggered by pressing special key combinations or clicking menu items.</p>
<a href="http://www.macromates.com/"><img class="alignright" src="http://www.learningjquery.com/wp-content/uploads/2006/09/jq_textmate4.thumbnail.jpg" alt="jquery bundle for textmate" /></a>

<p>The jQuery bundle that we put together mostly consists of "tab triggers" for various functions, but it also includes context-sensitive help derived from the online documentation and some nice syntax highlighting. After selecting jQuery as your file type in TextMate, you could, for example, type <code>ready</code> and press the <kbd>Tab</kbd> key to produce this:</p>
<pre><code>$(document).ready(function() {
  <span class="comment">// Stuff to do as soon as the DOM is ready;</span>
});</code></pre>
It'll then select the commented line (line 2 in this example) for you so you can start typing right away, replacing the comment with your code. Hit the <kbd>Tab</kbd> key once more and it drops you onto a new line below the closing brackets. If you want to learn more about a function that you've typed in, just click anywhere inside its name and press <kbd>Control</kbd> + <kbd>H</kbd>. You'll get official documentation on the function.

<h3>Get the Bundle</h3>
So, how can you get this cool jQuery bundle and speed up your coding? First, you'll need TextMate, of course. If you don't have it yet, <a href="http://www.macromates.com">download the 30-day trial</a>. <del datetime="2009-05-01T16:30:42+00:00">Then you'll need to either <a href="http://macromates.com/wiki/Main/SubversionCheckout">check out the bundles from the Subversion repository</a> (advanced) or download and install the <a href="http://sg.validcode.net/2006/11/7/textmate-getbundle-bundle">GetBundles bundle</a>. </del>
<div class="update">
  <h4>Update</h4>
  I'm no longer supporting the version in the Macromates subversion repository. For the most recent version, with updates for version 1.3.x, download (or clone) the <a href="https://github.com/kswedberg/jquery-tmbundle/tree/master">jQuery TextMate bundle at GitHub</a>.
</div>]]></content:encoded>
			<wfw:commentRss>http://www.learningjquery.com/2006/09/textmate-bundle-for-jquery/feed</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
	</channel>
</rss>
