<?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>Latent Motion &#187; Javascript</title>
	<atom:link href="http://www.latentmotion.com/category/web-programming/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.latentmotion.com</link>
	<description>Usability, Design and Front-Side Programming</description>
	<lastBuildDate>Tue, 27 Jul 2010 05:40:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Sort an Associative Array (object) in Javascript</title>
		<link>http://www.latentmotion.com/how-to-sort-an-associative-array-object-in-javascript/</link>
		<comments>http://www.latentmotion.com/how-to-sort-an-associative-array-object-in-javascript/#comments</comments>
		<pubDate>Fri, 21 May 2010 18:27:14 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[associative array]]></category>
		<category><![CDATA[sort array]]></category>
		<category><![CDATA[sort associative array]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=551</guid>
		<description><![CDATA[I&#8217;ve been working on an ajax site that needs to pass parameters elegantly via the hash tag. While working, I realized that there is usability value to a standardized URL (not to mention SEO value, if Google ever indexes such javascript based pages). In any event, I created this function to sort my hash arrays, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on an ajax site that needs to pass parameters elegantly via the hash tag. While working, I realized that there is usability value to a standardized URL (not to mention SEO value, if Google ever indexes such javascript based pages). In any event, I created this function to sort my hash arrays, and figured you might find it useful too:</p>
<pre><pre class="brush: jscript;">
function sortObj(arr){
	// Setup Arrays
	var sortedKeys = new Array();
	var sortedObj = {};

	// Separate keys and sort them
	for (var i in arr){
		sortedKeys.push(i);
	}
	sortedKeys.sort();

	// Reconstruct sorted obj based on keys
	for (var i in sortedKeys){
		sortedObj[sortedKeys[i]] = arr[sortedKeys[i]];
	}
	return sortedObj;
}
</pre></pre>
<p>You can construct a demo page with the following HTML:</p>
<pre><pre class="brush: jscript;">
&lt;html&gt;
&lt;body&gt;
&lt;script type=&quot;text/javascript&quot;&gt;

// These vars are for demonstration purposes
var alertSort = &quot;&quot;;
var blah = {}
blah.test2 = &quot;testb&quot;;
blah.test1 = &quot;testa&quot;;
blah.test3 = &quot;testc&quot;;

// This function sorts objects by key
function sortObj(arr){
	// Setup Arrays
	var sortedKeys = new Array();
	var sortedObj = {};

	// Separate keys and sort them
	for (var i in arr){
		sortedKeys.push(i);
	}
	sortedKeys.sort();

	// Reconstruct sorted obj based on keys
	for (var i in sortedKeys){
		sortedObj[sortedKeys[i]] = arr[sortedKeys[i]];
		alertSort += &quot;/&quot; + sortedKeys[i] + &quot;=&quot; + arr[sortedKeys[i]];
// This line is for demonstration purposes
	}
    alert(alertSort);   // This line is for demonstration purposes
	return sortedObj;
}

// Call the function
sortObj(blah);

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></pre>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-sort-an-associative-array-object-in-javascript%252F%26amp%3Btitle%3DHow%2520to%2520Sort%2520an%2520Associative%2520Array%2520%2528object%2529%2520in%2520Javascript%26amp%3Bbodytext%3DI%2527ve%2520been%2520working%2520on%2520an%2520ajax%2520site%2520that%2520needs%2520to%2520pass%2520parameters%2520elegantly%2520via%2520the%2520hash%2520tag.%2520While%2520working%252C%2520I%2520realized%2520that%2520there%2520is%2520usability%2520value%2520to%2520a%2520standardized%2520URL%2520%2528not%2520to%2520mention%2520SEO%2520value%252C%2520if%2520Google%2520ever%2520indexes%2520such%2520javascript%2520based%2520pages%2529.%2520';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-sort-an-associative-array-object-in-javascript%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-sort-an-associative-array-object-in-javascript%252F%26amp%3Btitle%3DHow%2520to%2520Sort%2520an%2520Associative%2520Array%2520%2528object%2529%2520in%2520Javascript%26amp%3Bnotes%3DI%2527ve%2520been%2520working%2520on%2520an%2520ajax%2520site%2520that%2520needs%2520to%2520pass%2520parameters%2520elegantly%2520via%2520the%2520hash%2520tag.%2520While%2520working%252C%2520I%2520realized%2520that%2520there%2520is%2520usability%2520value%2520to%2520a%2520standardized%2520URL%2520%2528not%2520to%2520mention%2520SEO%2520value%252C%2520if%2520Google%2520ever%2520indexes%2520such%2520javascript%2520based%2520pages%2529.%2520';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DHow%2520to%2520Sort%2520an%2520Associative%2520Array%2520%2528object%2529%2520in%2520Javascript%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fhow-to-sort-an-associative-array-object-in-javascript%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/how-to-sort-an-associative-array-object-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create a jQuery Bookmarklet</title>
		<link>http://www.latentmotion.com/how-to-create-a-jquery-bookmarklet/</link>
		<comments>http://www.latentmotion.com/how-to-create-a-jquery-bookmarklet/#comments</comments>
		<pubDate>Thu, 20 May 2010 16:00:15 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[favelet]]></category>
		<category><![CDATA[javascript bookmarklet]]></category>
		<category><![CDATA[jquery bookmarklet]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=475</guid>
		<description><![CDATA[
I suspect many of my readers have written at least one jQuery Plugin / Script. In this post, I&#8217;d like to show you how to get the most out of that script by also releasing it as a jQuery Bookmarklet. Below, you&#8217;ll find two examples of utilities that are ripe for bookmarkleting, as well as [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; padding-top: 5px;"><a class="trans80" style="margin: 0px 10px 20px 20px;" href="http://www.latentmotion.com/downloads/blank-bookmarklet-v1.js"><img style="border: none;" src="http://www.latentmotion.com/wp-content/themes/barecity_1.5/images/download-script.png" alt="" /></a></div>
<p>I suspect many of my readers have written at least one jQuery Plugin / Script. In this post, I&#8217;d like to show you how to get the most out of that script by also releasing it as a jQuery Bookmarklet. Below, you&#8217;ll find two examples of utilities that are ripe for bookmarkleting, as well as a prepared jQuery Bookmarklet file that you can easily modify for the purpose.</p>
<p><em>Note: Even if you haven&#8217;t written a jQuery plugin before, you&#8217;ll find bookmarkleting someone else&#8217;s plugin as easy as using it on a site.</em></p>
<p>Before I get to the code though &#8211; take a look at the payload. You can add the following links as bookmarklets by right-clicking and selecting &#8220;Add to bookmarks / favorites&#8221; (in Chrome, you press &#8220;ctrl+shift+b&#8221; to open the bookmark manager, and drag them over). You can try them before you bookmark them by simply clicking the links on this page too.</p>
<p><strong>Example One:<br />
<script type="text/javascript">// <![CDATA[
var linkster = "javascript:(function(){var head=document.getElementsByTagName('head')[0],script=document.createElement('script');script.type='text/javascript';script.src='http://www.latentmotion.com/downloads/tablesorter-bookmarklet-v1.js?' + Math.floor(Math.random()*99999);head.appendChild(script);})(); void 0";
linkster = '<a href="' + linkster + '">Table Column Sorter Bookmarklet</a>';
document.write(linkster);
// ]]&gt;</script></strong><br />
<a></a><br />
Clicking the above link will  add the <a href="http://tablesorter.com/docs/">table sorter jquery plugin</a> to the page, including its stylesheet, and it will apply the script to all tables on the page. Once it&#8217;s loaded, you can click on any of the table column headers to sort the rows by column values.</p>
<p><strong>Example Two:<br />
<script type="text/javascript">// <![CDATA[
var linkster = "javascript:(function(){var head=document.getElementsByTagName('head')[0],script=document.createElement('script');script.type='text/javascript';script.src='http://www.latentmotion.com/downloads/visualizer-bookmarklet-v1.js?' + Math.floor(Math.random()*99999);head.appendChild(script);})(); void 0";
linkster = '<a href="' + linkster + '">Table Visualizer Bookmarklet</a>';
document.write(linkster);
// ]]&gt;</script></strong><br />
<a></a></p>
<p>The visualizer bookmarklet will add graphical representations of the data in the table. As with the table sorter, this bookmarklet was adapted from a pre-existing plugin, Filament&#8217;s <a href="http://www.filamentgroup.com/lab/update_to_jquery_visualize_accessible_charts_with_html5_from_designing_with/">jQuery Visualize</a>.</p>
<table style="margin: 10px;">
<caption>2009 Employee Sales by Department</caption>
<thead>
<tr>
<td></td>
<th scope="col">food</th>
<th scope="col">auto</th>
<th scope="col">household</th>
<th scope="col">furniture</th>
<th scope="col">kitchen</th>
<th scope="col">bath</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Mary</th>
<td>190</td>
<td>160</td>
<td>40</td>
<td>120</td>
<td>30</td>
<td>70</td>
</tr>
<tr>
<th scope="row">Tom</th>
<td>3</td>
<td>40</td>
<td>30</td>
<td>45</td>
<td>35</td>
<td>49</td>
</tr>
<tr>
<th scope="row">Brad</th>
<td>10</td>
<td>180</td>
<td>10</td>
<td>85</td>
<td>25</td>
<td>79</td>
</tr>
<tr>
<th scope="row">Kate</th>
<td>40</td>
<td>80</td>
<td>90</td>
<td>25</td>
<td>15</td>
<td>119</td>
</tr>
</tbody>
</table>
<p><span id="more-475"></span></p>
<p>Cool stuff, right? Let&#8217;s get to how it works then &#8211; starting with the prepared jQuery Bookmarklet template. This is what I recommend you use when writing your own bookmarklets:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/*
 * jQuery Bookmarklet - version 1.0
 * Originally written by: Brett Barros
 * With modifications by: Paul Irish
 *
 * If you use this script, please link back to the source
 *
 * Copyright (c) 2010 Latent Motion (http://latentmotion.com/how-to-create-a-jquery-bookmarklet/)
 * Released under the Creative Commons Attribution 3.0 Unported License,
 * as defined here: http://creativecommons.org/licenses/by/3.0/
 *
 */</span>
&nbsp;
window.<span style="color: #660066;">bookmarklet</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>opts<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>fullFunc<span style="color: #009900;">&#40;</span>opts<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// These are the styles, scripts and callbacks we include in our bookmarklet:</span>
window.<span style="color: #660066;">bookmarklet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    css <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'http://www.site.com/your.css'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    js  <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'http://www.site.com/your.js'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>    
<span style="color: #006600; font-style: italic;">//	jqpath : 'myCustomjQueryPath.js', &lt;-- option to include your own path to jquery</span>
    ready <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>
&nbsp;
		<span style="color: #006600; font-style: italic;">// The meat of your jQuery code goes here</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;body&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello World&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   	    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> fullFunc<span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #003366; font-weight: bold;">function</span> d<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>b.<span style="color: #660066;">length</span><span style="color: #339933;">===</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>a.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>return <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>$.<span style="color: #660066;">getScript</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</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>d<span style="color: #009900;">&#40;</span>b.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #003366; font-weight: bold;">function</span> e<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">,</span>f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;link&gt;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>href<span style="color: #339933;">:</span>f<span style="color: #339933;">,</span>rel<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;stylesheet&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;head&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>a.<span style="color: #660066;">jqpath</span><span style="color: #339933;">=</span>a.<span style="color: #660066;">jqpath</span><span style="color: #339933;">||</span><span style="color: #3366CC;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #003366; font-weight: bold;">var</span> c<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;script&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>c.<span style="color: #660066;">type</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">;</span>c.<span style="color: #660066;">src</span><span style="color: #339933;">=</span>b<span style="color: #339933;">;</span>c.<span style="color: #000066;">onload</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>e<span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">css</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>d<span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">js</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">jqpath</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>From top to bottom, what the <a href="http://www.latentmotion.com/downloads/blank-bookmarklet-v1.js">jQuery Bookmarklet Template</a> does is:</p>
<ol>
<li>Prepare the full bookmarklet function. This is the call to the minified code in the last line of the js file. It is in an uncompressed format at the bottom of this post for those interested, but most will never need to see it..</li>
<li>Create the configurations, including arrays to your CSS and JS files. You can load as many as you see fit, and the JS files will load asynchronously, ensuring that each file can reliably depend on the file before it.</li>
<li>Provides the callback function for your editing. Place whatever jQuery code you like here.</li>
</ol>
<p>In order to use that script, though, you&#8217;ll need to create a link that calls it. Here&#8217;s the code for that link:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;javascript:(function(){var head=document.getElementsByTagName('head')[0],script=document.createElement('script');script.type='text/javascript';script.src='http://www.site.com/your-javascript.js?' + Math.floor(Math.random()*99999);head.appendChild(script);})(); void 0&quot;&gt;Your Bookmarklet Name&lt;/a&gt;</pre></div></div>

<p>To some that might look like a handful, but don&#8217;t worry, the hard work is already done. All you need to do is change the url in that link to point to your javascript file, and add a little regular-ol-jQuery to that javascript file.</p>
<p>Ok, still with me? Great! Now let&#8217;s look at one of the actual live examples we used earlier on the page. Here&#8217;s how I included table sorter, which requires both a JS and CSS  file:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/*
 * jQuery Bookmarklet - version 1.0
 * Originally written by: Brett Barros
 * With modifications by: Paul Irish
 *
 * If you use this script, please link back to the source
 *
 * Copyright (c) 2010 Latent Motion (http://latentmotion.com/how-to-create-a-jquery-bookmarklet/)
 * Released under the Creative Commons Attribution 3.0 Unported License,
 * as defined here: http://creativecommons.org/licenses/by/3.0/
 *
 */</span>
&nbsp;
window.<span style="color: #660066;">bookmarklet</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>opts<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>fullFunc<span style="color: #009900;">&#40;</span>opts<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// These are the styles, scripts and callbacks we include in our bookmarklet:</span>
window.<span style="color: #660066;">bookmarklet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    css <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'http://tablesorter.com/themes/blue/style.css'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    js  <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'http://tablesorter.com/jquery.tablesorter.js'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>    
<span style="color: #006600; font-style: italic;">//	jqpath : 'myCustomjQueryPath.js', &lt;-- option to include your own path to jquery</span>
    ready <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>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Initiate table sorter</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tablesorter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tablesorter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 	
&nbsp;
   	    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> fullFunc<span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #003366; font-weight: bold;">function</span> d<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>b.<span style="color: #660066;">length</span><span style="color: #339933;">===</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>a.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>return <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>$.<span style="color: #660066;">getScript</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</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>d<span style="color: #009900;">&#40;</span>b.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #003366; font-weight: bold;">function</span> e<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">,</span>f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;link&gt;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>href<span style="color: #339933;">:</span>f<span style="color: #339933;">,</span>rel<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;stylesheet&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;head&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>a.<span style="color: #660066;">jqpath</span><span style="color: #339933;">=</span>a.<span style="color: #660066;">jqpath</span><span style="color: #339933;">||</span><span style="color: #3366CC;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #003366; font-weight: bold;">var</span> c<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;script&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>c.<span style="color: #660066;">type</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">;</span>c.<span style="color: #660066;">src</span><span style="color: #339933;">=</span>b<span style="color: #339933;">;</span>c.<span style="color: #000066;">onload</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>e<span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">css</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>d<span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">js</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">jqpath</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>For your convenience, you can also <a href="http://www.latentmotion.com/jquery-bookmarklet/tablesorter-bookmarklet.js">download the script as a JS file</a>.</p>
<p>And that&#8217;s about it! Sorta, anyway. Here&#8217;re some bonus thoughts for the real enthusiasts:</p>
<ol>
<li>Bookmarklets leverage caching, big time. When developing, I found this to be a major frustration, so I added a large random number at the end of the js call, which effectively forces a reload each time the javascript is called. Upon deployment &#8211; you may choose to remove it, but keep it in mind next time you make a change and don&#8217;t see the effects.</li>
<li>Another reason I force refreshing of my js file is because I want to be able to update my scripts without forcing my users to re-bookmark them.</li>
<li>If you create your own bookmarklet and want to post about it in wordpress, you&#8217;ll quickly learn you need a workaround. The first one I used was hardcoding the links in an external page, and displaying them through an iframe. It worked, but was lame. Now I&#8217;m using javascript to store the desired a href as a variable, then I wrap that variable with the tags, and finally I document.write it. If you have a better idea, let me know.</li>
<li>The table examples that I&#8217;ve provided on this page are based on pre-existing jQuery plugins. Those plugins assume that tables are correctly formatted, with table headers etc. If a website&#8217;s layout was built in the 90s and still uses tables for page structure, the results won&#8217;t be pretty. </li>
<li>Sadly, Disqus (the host service for my comments below) uses tables. This of course conflicts with the specific table examples I used above, and can be resolved by refreshing. I&#8217;m sure it&#8217;s possible to set the bookmarklet to listen for a click of a table, but that&#8217;s beyond the scope of the current script/lesson.</li>
</ol>
<p>And here&#8217;s some extra credit reading:</p>
<ul>
<li><a href="http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet">Learning jQuery</a> made me realize that loading jQuery dynamically is possible. Almost ironically, Paul Irish helped with some modifications over there too.</li>
<li>After writing this article, I was informed <a href="http://benalman.com/projects/run-jquery-code-bookmarklet/">Ben Alman</a> had already written a similar script. His actually includes a &#8220;generator&#8221; that will use your jquery code and embed it for you, which is cool. It doesn&#8217;t include a loop to first include javascript / css files, but he probably figured it was easy enough to add yourself.</li>
<li><a href="http://iamnotagoodartist.com/">Tommy</a>, at <a href="http://www.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/">Smashing Magazine</a>, wrote a much more in-depth article about the details and options when writing a jQuery bookmarklet. Although it was posted a few days after I posted mine, he had submitted it months in advance. Smart guy <img src='http://www.latentmotion.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
<li><a href="http://marklets.com">Marklets</a> is a pretty nifty bookmark database that gives you searchable access to triggering any script in the arsenal. The creator and I are discussing a joint bookmarkleting project. Contact me if you&#8217;re interested in making bookmarklets kick ass again.</li>
</ul>
<p>If you have any ideas, questions, or musings, I&#8217;d love to hear &#8216;em! Please add your comment below.</p>
<p><em><strong>Update:</strong> <a href="http://paulirish.com/">Paul Irish</a> was kind enough to help improve this script and teach me a couple things along the way. The following is the unminified version of what I&#8217;ve listed above, and includes his structural changes.</em></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/*
 * jQuery Bookmarklet - version 1.0
 * Originally written by: Brett Barros
 * Heavily modified by: Paul Irish
 *
 * If you use this script, please link back to the source
 *
 * Copyright (c) 2010 Latent Motion (http://latentmotion.com/how-to-create-a-jquery-bookmarklet/)
 * Released under the Creative Commons Attribution 3.0 Unported License,
 * as defined here: http://creativecommons.org/licenses/by/3.0/
 *
 */</span>
&nbsp;
window.<span style="color: #660066;">bookmarklet</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>opts<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>fullFunc<span style="color: #009900;">&#40;</span>opts<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// These are the styles, scripts and callbacks we include in our bookmarklet:</span>
window.<span style="color: #660066;">bookmarklet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    css <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'http://tablesorter.com/themes/blue/style.css'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    js  <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'http://tablesorter.com/jquery.tablesorter.js'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>    
<span style="color: #006600; font-style: italic;">//	jqpath : 'myCustomjQueryPath.js', &lt;-- option to include your own jquery</span>
    ready <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>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Initiate table sorter</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tablesorter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tablesorter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 	
&nbsp;
   	    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> fullFunc<span style="color: #009900;">&#40;</span>opts<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// User doesn't have to set jquery, we have a default.</span>
    opts.<span style="color: #660066;">jqpath</span> <span style="color: #339933;">=</span> opts.<span style="color: #660066;">jqpath</span> <span style="color: #339933;">||</span> <span style="color: #3366CC;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> getJS<span style="color: #009900;">&#40;</span>jsfiles<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// Check if we've processed all of the JS files (or if there are none)</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>jsfiles.<span style="color: #660066;">length</span> <span style="color: #339933;">===</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		opts.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// Load the first js file in the array</span>
        $.<span style="color: #660066;">getScript</span><span style="color: #009900;">&#40;</span>jsfiles<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</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> 
&nbsp;
            <span style="color: #006600; font-style: italic;">// When it's done loading, remove it from the queue and call the function again    </span>
            getJS<span style="color: #009900;">&#40;</span>jsfiles.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Synchronous loop for css files</span>
    <span style="color: #003366; font-weight: bold;">function</span> getCSS<span style="color: #009900;">&#40;</span>csfiles<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>csfiles<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> val<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;link&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                    href<span style="color: #339933;">:</span> val<span style="color: #339933;">,</span>
                    rel<span style="color: #339933;">:</span> <span style="color: #3366CC;">'stylesheet'</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> getjQuery<span style="color: #009900;">&#40;</span>filename<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Create jQuery script element</span>
		<span style="color: #003366; font-weight: bold;">var</span> fileref <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>
		fileref.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">;</span>
		fileref.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span>  filename<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Once loaded, trigger other scripts and styles</span>
		fileref.<span style="color: #000066;">onload</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>
&nbsp;
			getCSS<span style="color: #009900;">&#40;</span>opts.<span style="color: #660066;">css</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// load CSS files</span>
			getJS<span style="color: #009900;">&#40;</span>opts.<span style="color: #660066;">js</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// load JS files</span>
&nbsp;
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
		document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>fileref<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	getjQuery<span style="color: #009900;">&#40;</span>opts.<span style="color: #660066;">jqpath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// kick it off</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// end of bookmarklet();</span></pre></div></div>





	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-create-a-jquery-bookmarklet%252F%26amp%3Btitle%3DHow%2520to%2520Create%2520a%2520jQuery%2520Bookmarklet%26amp%3Bbodytext%3D%250D%250AI%2520suspect%2520many%2520of%2520my%2520readers%2520have%2520written%2520at%2520least%2520one%2520jQuery%2520Plugin%2520%252F%2520Script.%2520In%2520this%2520post%252C%2520I%2527d%2520like%2520to%2520show%2520you%2520how%2520to%2520get%2520the%2520most%2520out%2520of%2520that%2520script%2520by%2520also%2520releasing%2520it%2520as%2520a%2520jQuery%2520Bookmarklet.%2520Below%252C%2520you%2527ll%2520find%2520two%2520examples%2520of%2520utilities%2520that';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-create-a-jquery-bookmarklet%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-create-a-jquery-bookmarklet%252F%26amp%3Btitle%3DHow%2520to%2520Create%2520a%2520jQuery%2520Bookmarklet%26amp%3Bnotes%3D%250D%250AI%2520suspect%2520many%2520of%2520my%2520readers%2520have%2520written%2520at%2520least%2520one%2520jQuery%2520Plugin%2520%252F%2520Script.%2520In%2520this%2520post%252C%2520I%2527d%2520like%2520to%2520show%2520you%2520how%2520to%2520get%2520the%2520most%2520out%2520of%2520that%2520script%2520by%2520also%2520releasing%2520it%2520as%2520a%2520jQuery%2520Bookmarklet.%2520Below%252C%2520you%2527ll%2520find%2520two%2520examples%2520of%2520utilities%2520that';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DHow%2520to%2520Create%2520a%2520jQuery%2520Bookmarklet%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fhow-to-create-a-jquery-bookmarklet%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/how-to-create-a-jquery-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>How to use Firebug in IE6 (and all other browsers)</title>
		<link>http://www.latentmotion.com/how-to-use-firebug-in-ie6-and-all-other-browsers/</link>
		<comments>http://www.latentmotion.com/how-to-use-firebug-in-ie6-and-all-other-browsers/#comments</comments>
		<pubDate>Fri, 07 May 2010 09:37:42 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[firebug]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=471</guid>
		<description><![CDATA[Yaknow, I&#8217;ve been using Firebug for quite some time, but I haven&#8217;t seen many places mention using it as a bookmarklet. Having gotten partway through programming my own makeshift javascript bookmarklet debugger, I was thrilled to find out Firebug Lite can be bookmarkletized too! Here&#8217;s the link &#8211; right click and add it to your [...]]]></description>
			<content:encoded><![CDATA[<p>Yaknow, I&#8217;ve been using Firebug for quite some time, but I haven&#8217;t seen many places mention using it as a bookmarklet. Having gotten partway through programming my own makeshift javascript bookmarklet debugger, I was thrilled to find out Firebug Lite can be bookmarkletized too! Here&#8217;s the link &#8211; right click and add it to your bookmarks to try it out:</p>
<p><script type="text/javascript">
var linkster = "javascript:var%20firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);";
linkster = '<a href="' + linkster + '">Firebug Bookmarklet</a>';
document.write(linkster);
</script></p>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-use-firebug-in-ie6-and-all-other-browsers%252F%26amp%3Btitle%3DHow%2520to%2520use%2520Firebug%2520in%2520IE6%2520%2528and%2520all%2520other%2520browsers%2529%26amp%3Bbodytext%3DYaknow%252C%2520I%2527ve%2520been%2520using%2520Firebug%2520for%2520quite%2520some%2520time%252C%2520but%2520I%2520haven%2527t%2520seen%2520many%2520places%2520mention%2520using%2520it%2520as%2520a%2520bookmarklet.%2520Having%2520gotten%2520partway%2520through%2520programming%2520my%2520own%2520makeshift%2520javascript%2520bookmarklet%2520debugger%252C%2520I%2520was%2520thrilled%2520to%2520find%2520out%2520Firebug%2520Lite';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-use-firebug-in-ie6-and-all-other-browsers%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fhow-to-use-firebug-in-ie6-and-all-other-browsers%252F%26amp%3Btitle%3DHow%2520to%2520use%2520Firebug%2520in%2520IE6%2520%2528and%2520all%2520other%2520browsers%2529%26amp%3Bnotes%3DYaknow%252C%2520I%2527ve%2520been%2520using%2520Firebug%2520for%2520quite%2520some%2520time%252C%2520but%2520I%2520haven%2527t%2520seen%2520many%2520places%2520mention%2520using%2520it%2520as%2520a%2520bookmarklet.%2520Having%2520gotten%2520partway%2520through%2520programming%2520my%2520own%2520makeshift%2520javascript%2520bookmarklet%2520debugger%252C%2520I%2520was%2520thrilled%2520to%2520find%2520out%2520Firebug%2520Lite';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DHow%2520to%2520use%2520Firebug%2520in%2520IE6%2520%2528and%2520all%2520other%2520browsers%2529%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fhow-to-use-firebug-in-ie6-and-all-other-browsers%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/how-to-use-firebug-in-ie6-and-all-other-browsers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Free RapidShare Service &amp; Countdown Bypass JavaScript</title>
		<link>http://www.latentmotion.com/free-rapidshare-service-countdown-bypass-javascript/</link>
		<comments>http://www.latentmotion.com/free-rapidshare-service-countdown-bypass-javascript/#comments</comments>
		<pubDate>Wed, 05 May 2010 01:55:57 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[bypass]]></category>
		<category><![CDATA[countdown]]></category>
		<category><![CDATA[skip]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=438</guid>
		<description><![CDATA[The free RapidShare downloads are pretty good &#8211; but the downloading process  is unnecessarily frustrating. Whereas many other providers drown their visitors with ads to generate revenue that pay for their servers (which is reasonable), RapidShare forces you to wait for no reason other than to frustrate you.
Fortunately, as adblocker has proven, we are capable and legally [...]]]></description>
			<content:encoded><![CDATA[<p>The free RapidShare downloads are pretty good &#8211; but the downloading process  is unnecessarily frustrating. Whereas many other providers drown their visitors with ads to generate revenue that pay for their servers (which is reasonable), RapidShare forces you to wait for no reason other than to frustrate you.</p>
<p>Fortunately, as adblocker has proven, we are capable and legally entitled to control the display of websites as we please. So, with no further ado, here is the solution:</p>
<p><script type="text/javascript">
// Wordpress messes up html bookmarklets
var linkster = "javascript:(function(){var head=document.getElementsByTagName('head')[0], script=document.createElement('script') ;script.type='text/javascript'; script.src='http://www.latentmotion.com/downloads/skip-timers.js?' + Math.floor(Math.random()*99999); head.appendChild(script);})(); void 0";
linkster = '<a href="' + linkster + '">Skip Timers Bookmarklet</a>';
document.write(linkster);
</script></p>
<p>Simply right click and bookmark the above link, so that next time you&#8217;re stuck on a web page that&#8217;s making you wait for <strong>no good reason</strong>, you can open the bookmark, and the countdown will immediately complete.</p>
<p>Here is a <a href="http://rs374.rapidshare.com/files/383226133/Penguins.jpg" rel="shadowbox[post-438];player=img;">Rapidshare File</a> to test it on.</p>
<p><span id="more-438"></span></p>
<p>For those interested, here is how the script works:</p>
<ol>
<li>The aforementioned link executes javascript on the page it&#8217;s loaded on. This javascript loads an external file.</li>
<li>In the external file, we pull all of the variables a page is using.</li>
<li>One second later, we pull all of the variables again.</li>
<li>We compare the first set of variables to the second set, and if any are exactly just one less, we identify a countdown timer</li>
<li>We now know which variable to set &#8211; and we set it to 1 (or very low).</li>
</ol>
<p>The bookmark link looks like this:</p>
<pre>
<pre class="brush: xml;">
&lt;a href=&quot;javascript:(function(){var head=document.getElementsByTagName('head')[0], script=document.createElement('script') ;script.type='text/javascript'; script.src='http://www.latentmotion.com/downloads/skip-timers.js?' + Math.floor(Math.random()*99999); head.appendChild(script);})(); void 0&quot;&gt;Skip Timers Bookmarklet&lt;/a&gt;
</pre>
</pre>
<p>And the external javascript looks like this:</p>
<pre>
<pre class="brush: jscript;">
/*
 * Skip Timers - version 0.1
 * Written By: Brett Barros
 *
 * The purpose of this script is to save you time by setting countdown
 * timers immediately to 1.
 *
 * If you use this script, please link back to my site with credit / kudos
 *
 * Copyright (c) 2010 Latent Motion (http://latentmotion.com/downloads/skip-timers.html)
 * Released under the Creative Commons Attribution 3.0 Unported License,
 * as defined here: http://creativecommons.org/licenses/by/3.0/
 *
 */

// List of original variables
var oldVars = {};
for (var name in this) {
	oldVars[name] = this[name];
}

// Compare variables one second later
function compareVars() {
	var newVars = {};
	for (var name in this) {
		newVars[name] = this[name];
	}
   for (var key in oldVars) {
     if (oldVars[key] !== (newVars[key])) {
	  	 window[key] = 1;
     }
   }
}

// Call function to compare variables
setTimeout(&quot;compareVars()&quot;,1000);
</pre>
</pre>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Ffree-rapidshare-service-countdown-bypass-javascript%252F%26amp%3Btitle%3DFree%2520RapidShare%2520Service%2520%2526%2520Countdown%2520Bypass%2520JavaScript%26amp%3Bbodytext%3DThe%2520free%2520RapidShare%2520downloads%2520are%2520pretty%2520good%2520-%2520but%2520the%2520downloading%2520process%2520%25C2%25A0is%2520unnecessarily%2520frustrating.%2520Whereas%2520many%2520other%2520providers%25C2%25A0drown%25C2%25A0their%2520visitors%2520with%2520ads%2520to%2520generate%2520revenue%2520that%2520pay%2520for%2520their%2520servers%2520%2528which%2520is%2520reasonable%2529%252C%2520RapidShare%2520';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Ffree-rapidshare-service-countdown-bypass-javascript%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Ffree-rapidshare-service-countdown-bypass-javascript%252F%26amp%3Btitle%3DFree%2520RapidShare%2520Service%2520%2526%2520Countdown%2520Bypass%2520JavaScript%26amp%3Bnotes%3DThe%2520free%2520RapidShare%2520downloads%2520are%2520pretty%2520good%2520-%2520but%2520the%2520downloading%2520process%2520%25C2%25A0is%2520unnecessarily%2520frustrating.%2520Whereas%2520many%2520other%2520providers%25C2%25A0drown%25C2%25A0their%2520visitors%2520with%2520ads%2520to%2520generate%2520revenue%2520that%2520pay%2520for%2520their%2520servers%2520%2528which%2520is%2520reasonable%2529%252C%2520RapidShare%2520';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DFree%2520RapidShare%2520Service%2520%2526%2520Countdown%2520Bypass%2520JavaScript%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Ffree-rapidshare-service-countdown-bypass-javascript%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/free-rapidshare-service-countdown-bypass-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automated Link Building &#8211; White Hat Style</title>
		<link>http://www.latentmotion.com/automated-link-building-white-hat-style/</link>
		<comments>http://www.latentmotion.com/automated-link-building-white-hat-style/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 13:00:26 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[SEO (Organic)]]></category>
		<category><![CDATA[automated link building]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[link building]]></category>
		<category><![CDATA[text selection]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=419</guid>
		<description><![CDATA[Yaknow, most of the time, black hat SEOs have all the fun. When you don&#8217;t have to follow the rules, the world of SEO opens up to mathematically generated content, canned-ham links, and any number of script based processes. Well, today is the day of the white hat, because I&#8217;ve just written a killer link [...]]]></description>
			<content:encoded><![CDATA[<p>Yaknow, most of the time, black hat SEOs have all the fun. When you don&#8217;t have to follow the rules, the world of SEO opens up to mathematically generated content, canned-ham links, and any number of script based processes. Well, today is the day of the white hat, because I&#8217;ve just written a killer link building script that will amplify your honest successes.</p>
<p><a href="http://www.seox.org">Link Building Pro</a>, based at seox.org, will automatically add a citation to the footer of any text copied from your website. Unlike other similar solutions, though, it specifically uses the meta keywords from the page as the anchor text &#8211; ensuring that the links use the precise keywords you&#8217;re optimizing for. And, here&#8217;s the best part, any text within the selection that matches the text of another link on the page will automatically be converted into that link. As a consequence, if this selection is then copied into the user&#8217;s site, you&#8217;ve not only gained one link of citation, but also as many links as logically apply to the text itself.</p>
<p>Of course, what makes this white hat is that it&#8217;s all <strong>voluntary</strong>. The user <em>could easily</em> remove the links if he chooses. But the default switches from being no citation or link to several, and as the default action is the easiest, it is also the one most often taken.</p>
<p>PS: Unfortunately, my previous script &#8220;Search and Share&#8221; interferes this script (doh!). For now, you&#8217;ll have to pick one or the other, but I&#8217;ve got big integration plans for the future!</p>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fautomated-link-building-white-hat-style%252F%26amp%3Btitle%3DAutomated%2520Link%2520Building%2520-%2520White%2520Hat%2520Style%26amp%3Bbodytext%3DYaknow%252C%2520most%2520of%2520the%2520time%252C%2520black%2520hat%2520SEOs%2520have%2520all%2520the%2520fun.%2520When%2520you%2520don%2527t%2520have%2520to%2520follow%2520the%2520rules%252C%2520the%2520world%2520of%2520SEO%2520opens%2520up%2520to%2520mathematically%2520generated%2520content%252C%2520canned-ham%2520links%252C%2520and%2520any%2520number%2520of%2520script%2520based%2520processes.%2520Well%252C%2520today%2520is%2520the%2520day%2520of%2520t';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fautomated-link-building-white-hat-style%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fautomated-link-building-white-hat-style%252F%26amp%3Btitle%3DAutomated%2520Link%2520Building%2520-%2520White%2520Hat%2520Style%26amp%3Bnotes%3DYaknow%252C%2520most%2520of%2520the%2520time%252C%2520black%2520hat%2520SEOs%2520have%2520all%2520the%2520fun.%2520When%2520you%2520don%2527t%2520have%2520to%2520follow%2520the%2520rules%252C%2520the%2520world%2520of%2520SEO%2520opens%2520up%2520to%2520mathematically%2520generated%2520content%252C%2520canned-ham%2520links%252C%2520and%2520any%2520number%2520of%2520script%2520based%2520processes.%2520Well%252C%2520today%2520is%2520the%2520day%2520of%2520t';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DAutomated%2520Link%2520Building%2520-%2520White%2520Hat%2520Style%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fautomated-link-building-white-hat-style%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/automated-link-building-white-hat-style/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using jQuery Clone to Add Dynamic Data</title>
		<link>http://www.latentmotion.com/using-jquery-clone-to-add-dynamic-data/</link>
		<comments>http://www.latentmotion.com/using-jquery-clone-to-add-dynamic-data/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 16:00:02 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[delicious feed]]></category>
		<category><![CDATA[dynamic data]]></category>
		<category><![CDATA[jquery clone]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rolling delicious]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=319</guid>
		<description><![CDATA[As a User Interface Expert first and Programmer second, I put a lot of consideration into how I code. With every step, I do my best to ensure that designers with less programming experience will be able to accomplish what they&#8217;d like. This distinction in programming methods is most clear in how I place dynamic [...]]]></description>
			<content:encoded><![CDATA[<p>As a User Interface Expert first and Programmer second, I put a lot of consideration into how I code. With every step, I do my best to ensure that designers with less programming experience will be able to accomplish what they&#8217;d like. This distinction in programming methods is most clear in how I place dynamic data onto the page.</p>
<p>Whereas many scripts embed the html markup into their javascript, I much prefer to leave it on the page. More specifically, I prefer to leave a <strong><em>model</em></strong> of the html on the page, and to inject the dynamic data using that model. As my example, I&#8217;ll continue <a href="http://www.latentmotion.com/calling-remote-json-files-via-javascript-jquery">yesterday&#8217;s post on a rolling delicious feed</a>.</p>
<p>If you&#8217;d like to skip ahead, you can <a href="http://www.latentmotion.com/downloads/dynamic-cloning.html">view the demo here</a>, or scroll down to view the whole block of code.</p>
<p>But I prefer to break things down first. Let&#8217;s look at my so-called <strong><em>model</em></strong>:</p>
<pre><pre class="brush: xml;">
&lt;div id=&quot;deliciousList&quot;&gt;
    &lt;div id=&quot;deliciousModel&quot; class=&quot;model item&quot;&gt;
        &lt;p&gt;&lt;a class=&quot;url&quot;&gt;&lt;span class=&quot;title&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
        &lt;p&gt;Posted by: &lt;span class=&quot;author&quot;&gt;&lt;/span&gt;&lt;/p&gt;
		&lt;p&gt;Tags: &lt;span class=&quot;tags&quot;&gt;&lt;/span&gt;&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre></pre>
<p>Notice that it creates the delicious list, and that inside it is an &#8220;item&#8221;. We&#8217;ll be identifying this model, and duplicating it as many times as we need to. When it&#8217;s duplicated, we&#8217;ll simply find the spans with the appropriate classes, and insert content. It&#8217;s easy and processor efficient, see for yourself:</p>
<pre><pre class="brush: jscript;">
// Clone duplicates the model (with bindings), strips model class/id, gives a unique id, and then adds it before the model
 $(&quot;#deliciousModel&quot;).clone(true).removeAttr(&quot;id&quot;) .removeClass(&quot;model&quot;).attr(&quot;id&quot;, &quot;del&quot; + i).insertBefore(&quot;#deliciousModel&quot;)

 // The finds get each class from within the model and replace it with values from the feed.
 .find(&quot;.url&quot;).attr(&quot;href&quot;, entry.u).end()
 .find(&quot;.author&quot;).html(entry.a).end()
 .find(&quot;.tags&quot;).html(processedTags).end()
 .find(&quot;.title&quot;).html(entry.d);
</pre></pre>
<p>The first line does the cloning, removes the identifying attributes (and class model causes a display:hide;), and inserts the new block.</p>
<p>The subsequent lines insert the appropriate data. Each &#8220;find&#8221; and &#8220;end&#8221; here is really important. By chaining the javascript, we&#8217;re preventing the code from constantly searching the entire document, and we&#8217;re containing the modifications to the model itself.</p>
<p>For the entire block of code, view below:</p>
<pre><pre class="brush: xml;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Delicious Feed&lt;/title&gt;
&lt;script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'&gt;&lt;/script&gt;
&lt;script type=&quot;application/javascript&quot;&gt;
    $(document).ready(function(){
// DELICIOUS JSON -- http://feeds.delicious.com/v2/json/tag/hyperstudio
$.getJSON('delicious-json.php', function(data){
$.each(data, function(i, entry) {

tags = entry.t;
tagLength = tags.length;
processedTags = '';

jQuery.each(tags, function(i, val) {
processedTags += ' ' + val;
if (i &lt; tagLength - 1) processedTags += ',';
});

// Clone duplicates the model (with bindings), strips model class/id, gives a unique id, and then adds it before the model
$(&quot;#deliciousModel&quot;).clone(true).removeAttr(&quot;id&quot;) .removeClass(&quot;model&quot;).attr(&quot;id&quot;, &quot;del&quot; + i).insertBefore(&quot;#deliciousModel&quot;)

// The finds get each class from within the model and replace it with values from the feed.
.find(&quot;.url&quot;).attr(&quot;href&quot;, entry.u).end()
.find(&quot;.author&quot;).html(entry.a).end()
.find(&quot;.tags&quot;).html(processedTags).end()
.find(&quot;.title&quot;).html(entry.d);

if ( i == 10 )  return false; // Limit to 10 entries

});
});
    });
&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
html { font-size:10px; font-family:Arial, Helvetica, sans-serif;}
a {color:#066; font-size:12px;}
p {margin:0; padding:0;}
a:hover {color:#099;}
#deliciousList {border:1px solid #333; width:400px; margin:0 auto; padding:0 10px;}
.item {margin:10px 0;}
.clear {clear:both;}
.model {display:none;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;deliciousList&quot;&gt;
    &lt;div id=&quot;deliciousModel&quot; class=&quot;model item&quot;&gt;
        &lt;p&gt;&lt;a class=&quot;url&quot;&gt;&lt;span class=&quot;title&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
        &lt;p&gt;Posted by: &lt;span class=&quot;author&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Tags: &lt;span class=&quot;tags&quot;&gt;&lt;/span&gt;&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></pre>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fusing-jquery-clone-to-add-dynamic-data%252F%26amp%3Btitle%3DUsing%2520jQuery%2520Clone%2520to%2520Add%2520Dynamic%2520Data%26amp%3Bbodytext%3DAs%2520a%2520User%2520Interface%2520Expert%2520first%2520and%2520Programmer%2520second%252C%2520I%2520put%2520a%2520lot%2520of%2520consideration%2520into%2520how%2520I%2520code.%2520With%2520every%2520step%252C%2520I%2520do%2520my%2520best%2520to%2520ensure%2520that%2520designers%2520with%2520less%2520programming%2520experience%2520will%2520be%2520able%2520to%2520accomplish%2520what%2520they%2527d%2520like.%2520This%2520distinctio';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fusing-jquery-clone-to-add-dynamic-data%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fusing-jquery-clone-to-add-dynamic-data%252F%26amp%3Btitle%3DUsing%2520jQuery%2520Clone%2520to%2520Add%2520Dynamic%2520Data%26amp%3Bnotes%3DAs%2520a%2520User%2520Interface%2520Expert%2520first%2520and%2520Programmer%2520second%252C%2520I%2520put%2520a%2520lot%2520of%2520consideration%2520into%2520how%2520I%2520code.%2520With%2520every%2520step%252C%2520I%2520do%2520my%2520best%2520to%2520ensure%2520that%2520designers%2520with%2520less%2520programming%2520experience%2520will%2520be%2520able%2520to%2520accomplish%2520what%2520they%2527d%2520like.%2520This%2520distinctio';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DUsing%2520jQuery%2520Clone%2520to%2520Add%2520Dynamic%2520Data%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fusing-jquery-clone-to-add-dynamic-data%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/using-jquery-clone-to-add-dynamic-data/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Remote JSON Files via Javascript / jQuery</title>
		<link>http://www.latentmotion.com/calling-remote-json-files-via-javascript-jquery/</link>
		<comments>http://www.latentmotion.com/calling-remote-json-files-via-javascript-jquery/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 16:00:10 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[data feeds]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[getjson]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=310</guid>
		<description><![CDATA[Not too long ago, I was asked to create a rolling delicious feed using their JSON data. It took me quite a while to realize what was going wrong &#8211; but the solution was obvious as soon as the problem became clear. If you&#8217;re going down the same path, maybe this bit of advice will [...]]]></description>
			<content:encoded><![CDATA[<p>Not too long ago, I was asked to create a rolling delicious feed using their JSON data. It took me quite a while to realize what was going wrong &#8211; but the solution was obvious as soon as the problem became clear. If you&#8217;re going down the same path, maybe this bit of advice will help.</p>
<p>Firstly, you have to create a local reference of the JSON data. As I understand it, this has to do with the <a href="http://en.wikipedia.org/wiki/JSON#Security_issues">JSON server settings and security</a>. In any event, it&#8217;s easy enough to do. Create a file, such as my delicious-json.php. All you need to put in it is this:</p>
<pre><pre class="brush: php;">

&lt;?php
echo file_get_contents(&quot;http://feeds.delicious.com/v2/json/tag/hyperstudio&quot;);
?&gt;

</pre></pre>
<p>Easy peasy. Now you can reference it via jQuery, like so:</p>
<pre><pre class="brush: jscript;">
&lt;script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'&gt;&lt;/script&gt;
$(document).ready(function(){
// DELICIOUS JSON -- http://feeds.delicious.com/v2/json/tag/hyperstudio
  $.getJSON('delicious-json.php', function(data){
    $.each(data, function(i, entry) {
      // Process your data here
    });
  });
});
</pre></pre>
<p>How you use the JSON is up to you. In tomorrow&#8217;s post, I&#8217;ll describe my preferred method &#8211; cloning a model. Doing so has a lot of speed benefits, but more importantly, it separates the html from the javascript. As a consequence, any web designer can easily step in and modify the aesthetics without touching code. This facilitates the very important separation of concerns.</p>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fcalling-remote-json-files-via-javascript-jquery%252F%26amp%3Btitle%3DCalling%2520Remote%2520JSON%2520Files%2520via%2520Javascript%2520%252F%2520jQuery%26amp%3Bbodytext%3DNot%2520too%2520long%2520ago%252C%2520I%2520was%2520asked%2520to%2520create%2520a%2520rolling%2520delicious%2520feed%2520using%2520their%2520JSON%2520data.%2520It%2520took%2520me%2520quite%2520a%2520while%2520to%2520realize%2520what%2520was%2520going%2520wrong%2520-%2520but%2520the%2520solution%2520was%2520obvious%2520as%2520soon%2520as%2520the%2520problem%2520became%2520clear.%2520If%2520you%2527re%2520going%2520down%2520the%2520same%2520path%252C%2520m';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fcalling-remote-json-files-via-javascript-jquery%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fcalling-remote-json-files-via-javascript-jquery%252F%26amp%3Btitle%3DCalling%2520Remote%2520JSON%2520Files%2520via%2520Javascript%2520%252F%2520jQuery%26amp%3Bnotes%3DNot%2520too%2520long%2520ago%252C%2520I%2520was%2520asked%2520to%2520create%2520a%2520rolling%2520delicious%2520feed%2520using%2520their%2520JSON%2520data.%2520It%2520took%2520me%2520quite%2520a%2520while%2520to%2520realize%2520what%2520was%2520going%2520wrong%2520-%2520but%2520the%2520solution%2520was%2520obvious%2520as%2520soon%2520as%2520the%2520problem%2520became%2520clear.%2520If%2520you%2527re%2520going%2520down%2520the%2520same%2520path%252C%2520m';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DCalling%2520Remote%2520JSON%2520Files%2520via%2520Javascript%2520%252F%2520jQuery%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fcalling-remote-json-files-via-javascript-jquery%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/calling-remote-json-files-via-javascript-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Div Class Clear &#8211; Without the Markup</title>
		<link>http://www.latentmotion.com/div-class-clear-without-the-markup/</link>
		<comments>http://www.latentmotion.com/div-class-clear-without-the-markup/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 16:00:00 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[background bugs]]></category>
		<category><![CDATA[background fix]]></category>
		<category><![CDATA[background stretching]]></category>
		<category><![CDATA[browser bugs]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[div class clear]]></category>
		<category><![CDATA[div clear]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[float nearly everything]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=302</guid>
		<description><![CDATA[The Div Class Clear is an old trick for getting container backgrounds to stretch down to the bottom of its contents. Although there has since been a push for the &#8220;float nearly everything&#8221; technique, I&#8217;m not convinced that constantly setting floats and widths across all elements is a sustainable method. Instead, let&#8217;s address the only [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.positioniseverything.net/easyclearing.html">Div Class Clear</a> is an old trick for getting container backgrounds to stretch down to the bottom of its contents. Although there has since been a push for the &#8220;<a href="http://orderedlist.com/articles/clearing-floats-the-fne-method">float nearly everything</a>&#8221; technique, I&#8217;m not convinced that constantly setting floats and widths across all elements is a sustainable method. Instead, let&#8217;s address the only problem people have with the Div Class Clear method &#8211; the added markup.</p>
<p>We can remove this markup quite simply with jQuery. Rather than mess with the actual on-page elements, why not insert it dynamically? Check out the code:</p>
<pre><pre class="brush: jscript;">
&lt;script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    $(document).ready(function(){
$(&quot;*:last-child&quot;).filter(function() {
return $(this).css('float') != 'none';
}).parent().append(&quot;&lt;div class='clear'&gt;&lt;/div&gt;&quot;);
    });
&lt;/script&gt;
&lt;style&gt;
.clear {clear:both;}
&lt;/style&gt;
</pre></pre>
<p>Note: As you may imagine, this method assumes that the viewer has javascript enabled. Given that the downside is a matter of background stretching, and considering all the numerous other things that break when javascript isn&#8217;t enabled, I (generally) readily accept this sacrifice. After all, it&#8217;s not like Flash, where they get no content at all.</p>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fdiv-class-clear-without-the-markup%252F%26amp%3Btitle%3DDiv%2520Class%2520Clear%2520-%2520Without%2520the%2520Markup%26amp%3Bbodytext%3DThe%2520Div%2520Class%2520Clear%2520is%2520an%2520old%2520trick%2520for%2520getting%2520container%2520backgrounds%2520to%2520stretch%2520down%2520to%2520the%2520bottom%2520of%2520its%2520contents.%2520Although%2520there%2520has%2520since%2520been%2520a%2520push%2520for%2520the%2520%2522float%2520nearly%2520everything%2522%2520technique%252C%2520I%2527m%2520not%2520convinced%2520that%2520constantly%2520setting%2520floats%2520an';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fdiv-class-clear-without-the-markup%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fdiv-class-clear-without-the-markup%252F%26amp%3Btitle%3DDiv%2520Class%2520Clear%2520-%2520Without%2520the%2520Markup%26amp%3Bnotes%3DThe%2520Div%2520Class%2520Clear%2520is%2520an%2520old%2520trick%2520for%2520getting%2520container%2520backgrounds%2520to%2520stretch%2520down%2520to%2520the%2520bottom%2520of%2520its%2520contents.%2520Although%2520there%2520has%2520since%2520been%2520a%2520push%2520for%2520the%2520%2522float%2520nearly%2520everything%2522%2520technique%252C%2520I%2527m%2520not%2520convinced%2520that%2520constantly%2520setting%2520floats%2520an';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DDiv%2520Class%2520Clear%2520-%2520Without%2520the%2520Markup%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fdiv-class-clear-without-the-markup%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/div-class-clear-without-the-markup/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Separating jQuery Functions into External Files (without selectors!)</title>
		<link>http://www.latentmotion.com/separating-jquery-functions-into-external-files-without-selectors/</link>
		<comments>http://www.latentmotion.com/separating-jquery-functions-into-external-files-without-selectors/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 13:00:54 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[external javascript]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[javascript files]]></category>
		<category><![CDATA[javascript function]]></category>
		<category><![CDATA[jquery function]]></category>
		<category><![CDATA[separating javascript]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=336</guid>
		<description><![CDATA[In javascript, writing reusable blocks of code is easy. You simply enter something like: &#8220;function myFunction() { &#8230; }&#8221;, and then you later call it by simply writing &#8220;myFunction();&#8221;. Consequently, when I write jQuery, I often use this javascript shorthand within my jQuery ready tags. As long as all the code stays in a single [...]]]></description>
			<content:encoded><![CDATA[<p>In javascript, writing reusable blocks of code is easy. You simply enter something like: &#8220;function myFunction() { &#8230; }&#8221;, and then you later call it by simply writing &#8220;myFunction();&#8221;. Consequently, when I write jQuery, I often use this javascript shorthand within my jQuery ready tags. As long as all the code stays in a single file, things go smoothly.</p>
<p>But sometimes code grows, and when it does, you&#8217;ve got to separate your logic into separate external js files. That&#8217;s when things break. You see, in each of these external files, you now have to separately reiterate the jQuery ready tags, and when you do, you&#8217;ve buried your functions in a (jQuery) function, rendering it hidden. Out of scope. Or as the error console will tell you, &#8220;Missing&#8221;.</p>
<p>The trick is to create a jQuery function. There are articles all over the place that tell you how to do this. But every one that I&#8217;ve found seems to assume that you want your function to act on a selector. What I needed (and you may as well), was a function that acted just like that regular old javascript function (with jQuery syntax enabled). Believe it or not, all it takes is a minor tweek. Check it out:</p>
<p>External File (tilex.js):</p>
<pre><pre class="brush: jscript;">
  (function($){
    tile = function() {
      $(&quot;body&quot;).append('See? It works.');
    };
  })(jQuery);
</pre></pre>
<p>Inline HTML:</p>
<pre><pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;HyperStudio Timeline&lt;/title&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;js/tilex.js&quot;&gt;&lt;/script&gt;

  &lt;script type=&quot;text/javascript&quot;&gt;
   $(document).ready(function(){
      tile();
    });
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></pre>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fseparating-jquery-functions-into-external-files-without-selectors%252F%26amp%3Btitle%3DSeparating%2520jQuery%2520Functions%2520into%2520External%2520Files%2520%2528without%2520selectors%2521%2529%26amp%3Bbodytext%3DIn%2520javascript%252C%2520writing%2520reusable%2520blocks%2520of%2520code%2520is%2520easy.%2520You%2520simply%2520enter%2520something%2520like%253A%2520%2522function%2520myFunction%2528%2529%2520%257B%2520...%2520%257D%2522%252C%2520and%2520then%2520you%2520later%2520call%2520it%2520by%2520simply%2520writing%2520%2522myFunction%2528%2529%253B%2522.%2520Consequently%252C%2520when%2520I%2520write%2520jQuery%252C%2520I%2520often%2520use%2520this%2520javascript%2520sho';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fseparating-jquery-functions-into-external-files-without-selectors%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fseparating-jquery-functions-into-external-files-without-selectors%252F%26amp%3Btitle%3DSeparating%2520jQuery%2520Functions%2520into%2520External%2520Files%2520%2528without%2520selectors%2521%2529%26amp%3Bnotes%3DIn%2520javascript%252C%2520writing%2520reusable%2520blocks%2520of%2520code%2520is%2520easy.%2520You%2520simply%2520enter%2520something%2520like%253A%2520%2522function%2520myFunction%2528%2529%2520%257B%2520...%2520%257D%2522%252C%2520and%2520then%2520you%2520later%2520call%2520it%2520by%2520simply%2520writing%2520%2522myFunction%2528%2529%253B%2522.%2520Consequently%252C%2520when%2520I%2520write%2520jQuery%252C%2520I%2520often%2520use%2520this%2520javascript%2520sho';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DSeparating%2520jQuery%2520Functions%2520into%2520External%2520Files%2520%2528without%2520selectors%2521%2529%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fseparating-jquery-functions-into-external-files-without-selectors%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/separating-jquery-functions-into-external-files-without-selectors/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Common SEO Mistakes: CSS Image Replacement</title>
		<link>http://www.latentmotion.com/css-image-replacement-mistakes/</link>
		<comments>http://www.latentmotion.com/css-image-replacement-mistakes/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 15:14:01 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SEO (Organic)]]></category>
		<category><![CDATA[CSS Image Replacement]]></category>
		<category><![CDATA[Dynamic Text Replacement]]></category>
		<category><![CDATA[Headers]]></category>
		<category><![CDATA[Logos]]></category>
		<category><![CDATA[On Page Optimization]]></category>
		<category><![CDATA[SEO Mistakes]]></category>

		<guid isPermaLink="false">http://www.latentmotion.com/?p=81</guid>
		<description><![CDATA[Knowing about CSS Image Replacement and  Dynamic Text Replacement, as well as how to implement them, is undeniably valuable. As with most of SEO, having a developer&#8217;s skill set (or at least a knowledge of your options), will enable you with a can-do world view. In this case, when a client tells you that they&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>Knowing about <a href="http://css-tricks.com/css-image-replacement/">CSS Image Replacement </a>and  <a href="http://www.seomoz.org/ugc/cloaking-vs-image-replacement-hiding-text-is-not-a-bad-thing">Dynamic Text Replacement</a>, as well as <a href="http://www.sifrgenerator.com/wizard.html">how to implement them</a>, is undeniably valuable. As with most of SEO, having a developer&#8217;s skill set (or at least a knowledge of your options), will enable you with a can-do world view. In this case, when a client tells you that they&#8217;re committed to a web unsafe font for their headers, and that they therefore can&#8217;t use the appropriate keyword rich header tags, you&#8217;ll answer &#8220;yes you can&#8221;.</p>
<p>But there is a very common problem with over-zealous implementation of such SEO tactics without full consideration of their impact. Even SEOs who I have high regard for are victims of this vice. Have a look:</p>
<p><img class="alignnone size-full wp-image-94" title="seomoz" src="http://www.latentmotion.com/wp-content/uploads/2009/07/seomoz.png" alt="seomoz" width="515" height="274" /><span id="more-81"></span></p>
<p><img class="alignnone size-full wp-image-97" title="seoroi" src="http://www.latentmotion.com/wp-content/uploads/2009/07/seoroi.png" alt="seoroi" width="515" height="286" /></p>
<p><img class="alignnone size-full wp-image-100" title="shoemoney" src="http://www.latentmotion.com/wp-content/uploads/2009/07/shoemoney1.png" alt="shoemoney" width="515" height="293" /></p>
<p>Notice how in each above case, the site represents its graphical logo as an unoptimized text link going back to the home page. And if you subscribe to the <a href="http://andybeard.eu/1775/first-link-priority-is-stompernet-wrong.html">first link theory</a>, (which as an astute reader, I&#8217;m sure you do), you&#8217;ll recognize that this renders any subsequently optimized link back to the homepage relatively (if not completely) limp.</p>
<p>ShoeMoney has it the worst of all, if you ask me. Why, praytell, is the h1 of EVERY page &#8220;Shoemoney – Skills To Pay The Bills&#8221;. This is only one step down from using the same title, or same description, which you&#8217;ll surely be alerted of if you use Google&#8217;s Webmaster Tools. And no offense to Gab, but SEOROI isn&#8217;t much better, depending on your perspective on the over-use of H1&#8217;s.</p>
<p>&#8220;Ok, Smartass&#8221; you&#8217;re probably thinking. &#8220;So you think I should go black hat and use cloaked optimized text?&#8221;</p>
<p>Well, I&#8217;d argue that if your text is descriptive of the graphic, it&#8217;s not black hat. But even if you disagree, that&#8217;s not your only option. You could also use the equally semantically valid &#8220;Alt Attribute&#8221; (it&#8217;s not a tag), which is designed to describe photos and the like to the blind. This old school method is clean as a whistle, allows you to label as you will (i.e., my: &#8220;Boston SEO Logo&#8221;), and doesn&#8217;t detract from your later carefully picked anchor text links.</p>
<p>So what&#8217;s the take away here? Don&#8217;t just blindly do what SEO Bloggers say (myself included). Always put yourself in the many shoes of a search engine spider, look at the source code (even if you don&#8217;t understand it all), and ask yourself of each element &#8220;what would I think of this?&#8221; You&#8217;ll probably be surprised with the result.</p>
<p>Side Note: In order to dispel any misconceptions right off the bat &#8211; I&#8217;m not opposed to text replacement. In fact, I think it&#8217;s brilliant for header (h1, h2, h3) replacement. Often times company branding dictates the use of a specific font &#8211; and this prevents SEO from getting in the way of that. So, if that&#8217;s what all you&#8217;re doing with it, well done and carry on!</p>




	<a rel="nofollow" class="digg" target="_blank" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fcss-image-replacement-mistakes%252F%26amp%3Btitle%3DCommon%2520SEO%2520Mistakes%253A%2520CSS%2520Image%2520Replacement%26amp%3Bbodytext%3DKnowing%2520about%2520CSS%2520Image%2520Replacement%2520and%25C2%25A0%2520Dynamic%2520Text%2520Replacement%252C%2520as%2520well%2520as%2520how%2520to%2520implement%2520them%252C%2520is%2520undeniably%2520valuable.%2520As%2520with%2520most%2520of%2520SEO%252C%2520having%2520a%2520developer%2527s%2520skill%2520set%2520%2528or%2520at%2520least%2520a%2520knowledge%2520of%2520your%2520options%2529%252C%2520will%2520enable%2520you%2520with%2520a%2520can-do';" title="Digg"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" class="sphinn" target="_blank" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fcss-image-replacement-mistakes%252F';" title="Sphinn"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" class="del.icio.us" target="_blank" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.latentmotion.com%252Fcss-image-replacement-mistakes%252F%26amp%3Btitle%3DCommon%2520SEO%2520Mistakes%253A%2520CSS%2520Image%2520Replacement%26amp%3Bnotes%3DKnowing%2520about%2520CSS%2520Image%2520Replacement%2520and%25C2%25A0%2520Dynamic%2520Text%2520Replacement%252C%2520as%2520well%2520as%2520how%2520to%2520implement%2520them%252C%2520is%2520undeniably%2520valuable.%2520As%2520with%2520most%2520of%2520SEO%252C%2520having%2520a%2520developer%2527s%2520skill%2520set%2520%2528or%2520at%2520least%2520a%2520knowledge%2520of%2520your%2520options%2529%252C%2520will%2520enable%2520you%2520with%2520a%2520can-do';" title="del.icio.us"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" class="rss" target="_blank" href="javascript:window.location='http%3A%2F%2Fwww.latentmotion.com%2Ffeed%2F';" title="RSS"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow" class="twitter" target="_blank" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DCommon%2520SEO%2520Mistakes%253A%2520CSS%2520Image%2520Replacement%2520-%2520http%253A%252F%252Fwww.latentmotion.com%252Fcss-image-replacement-mistakes%252F';" title="Twitter"><img src="http://www.latentmotion.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.latentmotion.com/css-image-replacement-mistakes/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
