<?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>somedirection &#187; jQuery</title>
	<atom:link href="http://somedirection.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://somedirection.com</link>
	<description></description>
	<lastBuildDate>Mon, 19 Jul 2010 21:21:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3152</generator>
		<item>
		<title>LazyTagger, Get the most out of tagging on Delicious &#8211; Redux</title>
		<link>http://somedirection.com/2009/07/16/lazytagger-get-the-most-out-of-tagging-on-delicious/</link>
		<comments>http://somedirection.com/2009/07/16/lazytagger-get-the-most-out-of-tagging-on-delicious/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 05:00:59 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Life Hacks]]></category>
		<category><![CDATA[Shameless Promotion]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[del.icio.us]]></category>
		<category><![CDATA[lazy]]></category>
		<category><![CDATA[tagger]]></category>

		<guid isPermaLink="false">http://somedirection.com/?p=287</guid>
		<description><![CDATA[Over a year ago I put out a bookmarklet that I used for delicious. Then delicious did a redesign which broke the bookmarklet. Finally I got around to fixing it. Here&#8217;s the new bookmarklet. Enjoy! picture courtesy of bripblap.com So I have a confession to make, I love delicious, but I&#8217;m lousy at tagging bookmarks. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Over a year ago</strong> I put out a bookmarklet that I used for delicious. Then delicious did a redesign which broke the bookmarklet. Finally I got around to fixing it. Here&#8217;s the new bookmarklet. Enjoy!</p>

<div class="right" style="margin: 0 0 10px 10px;">
<img style="border:2px solid #cacaca;" src="http://somedirection.com/wp-content/uploads/2008/07/redneckcat.jpg" alt="redneckcat.jpg" border="0" width="250" />
<p class="small">picture courtesy of <a href="http://www.bripblap.com/">bripblap.com</a></p>
</div>

<p>So I have a confession to make, I love delicious, but I&#8217;m lousy at tagging bookmarks. I have a horrible memory so in my travels (and I delicious links a lot) I find myself wanting to tag a bookmark with as many keywords as possible on some off chance I don&#8217;t know what to search on to dig up the particular bookmark I&#8217;m trying to retrieve. I end up manually toggling every popular tag that is shown on a given post. It&#8217;s too time consuming for me.</p>

<p>I&#8217;ve been working with <a href="http://jquery.com">jQuery</a> and bookmarklets <em>a lot</em> lately so I had the idea of leveraging the two to create my own LazyTagger bookmarklet for <a href="http://del.icio.us">Del.icio.us</a>.</p>

<h3>The LazyTagger process is simple</h3>

<ol>
<li>You must have the <a href="http://del.icio.us/help/buttons">Del.icio.us &#8216;post&#8217; bookmarklet</a> installed. Try my customized version (does away w/ the popup window which I find annoying)
<a href="javascript:(function(){javascript:(function(){f='http://delicious.com/save?url='+encodeURIComponent(window.location.href)+'&#038;title='+encodeURIComponent(document.title)+'&#038;v=5&#038;';a=function(){location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()})();">post to delicious</a> &laquo; <b>drag this to your toolbar</b></li>
<li>Drag the LazyTagger bookmarklet to your browser <a rel="facebox" href="http://somedirection.com/wp-content/uploads/2008/07/toolbar.png">bookmarks toolbar</a>
<a title="LazyTagger" href="javascript:alert('replace me with pasted code!');"><img src="http://somedirection.com/wp-content/uploads/2008/07/lazy-tagger-btn.png" border="0" width="200" alt="LazyTagger"></a>
<br class="clear"/></li>
<li>Copy and paste this code into the &#8216;location&#8217; of your newly created bookmark &#8211; you&#8217;re going to have to go and edit the bookmark manually from the browser. This has to be done to the avoid character limit on drag-and-drop bookmarklets.<br />
<div class='code_parent'><div class='code_child'><code><pre>javascript:var%20s=document.createElement('script');s.setAttribute('src','http://code.jquery.com/jquery-latest.min.js');document.body.appendChild(s);s.onload=function(){var%20tags=[];$('#save-reco-tags%20ul.tag-list%20li,#save-pop-tags%20ul.tag-list%20li').addClass("on").each(function(){tags.push($(this).text().match(/\D*/g)[0]);});tagit=tags.join('%20');$('input#tags').val('').val(tagit+'%20').focus();};void(s);</pre></code></div></div></li>
<li><strong>&#8216;post to delicious&#8217;</strong> just like you normally would</li>
<li>When you&#8217;re at delicious, click the <strong>LazyTagger</strong> bookmarklet</li>
<li>All of the <a rel="facebox" href="http://somedirection.com/wp-content/uploads/2009/07/Picture-7.png">popular and recommended tags</a> will be selected automatically. Laziness rocks.</li>
<li>After all of the tags are toggled the focus will be placed on the tags input so you can begin typing any other tags you deem necessary.</li>
</ol>

<p>That&#8217;s LazyTagger. I&#8217;ve been using it for a long time and I can honestly say I don&#8217;t think I could go back. Feedback appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://somedirection.com/2009/07/16/lazytagger-get-the-most-out-of-tagging-on-delicious/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking about jQuery</title>
		<link>http://somedirection.com/2008/07/28/speaking-about-jquery/</link>
		<comments>http://somedirection.com/2008/07/28/speaking-about-jquery/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 23:26:16 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Shameless Promotion]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[talk]]></category>

		<guid isPermaLink="false">http://somedirection.com/?p=299</guid>
		<description><![CDATA[On August 7th I&#8217;ll be speaking at the Betahouse with John Resig about the jQuery Javascript Framework. My friend and colleague Patrick Haney put this talk together for Refresh Boston. Check out the Upcoming Event. Sign up sooner than later, as of this writing there were only about 20 slots left! I&#8217;ll be talking about [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jquery.com"><img class="pic right" src="http://somedirection.com/wp-content/uploads/2008/07/jquery-hat-90x73.png" alt="" border="0" width="90" height="73" /></a>
On August 7th I&#8217;ll be speaking at the <a href="http://betahouse.org">Betahouse</a> with <a href="http://ejohn.org">John Resig</a> about the <a href="http://jquery.com">jQuery</a> Javascript Framework. My friend and colleague <a href="http://notasausage.com">Patrick Haney</a> put this talk together for <a href="http://refreshboston.org/">Refresh Boston</a>.</p>

<p>Check out the <a href="http://upcoming.yahoo.com/event/925677">Upcoming Event</a>. Sign up sooner than later, as of this writing there were only about 20 slots left!</p>

<p>I&#8217;ll be talking about how I&#8217;ve used jQuery in some of my development projects and some tricks and best practices I&#8217;ve picked up along the way. I&#8217;ll also be talking about degradation, progressive enhancement and (time permitting) discuss how jQuery&#8217;s <a href="http://plugins.jquery.com/">Plugin</a> architecture lets small teams do a lot with little.</p>

<h3>Update</h3>

<p><a href="http://www.flickr.com/photos/somedirection/2798738397/" title="Resig and I by somedirection, on Flickr"><img class="pic right" src="http://farm4.static.flickr.com/3249/2798738397_3cee95a5dc_m.jpg" width="240" height="160" alt="Resig and I" /></a></p>

<p>The talk was a great success and I had a great time. I&#8217;ve posted my slides: <a href="http://kylebradshaw.com/presentations/jQuery/jQuery_Best_Practices.pdf">jQuery Best Practices</a>. Much thanks goes to the Betahouse for hosting the <a href="http://refreshboston.org">Refresh Boston</a> event.</p>

<p>As well as the accompanying demos on <strong>Progressive Enhancement</strong>:</p>

<ul>
<li><a href="http://kylebradshaw.com/presentations/jQuery/rating.php">jQuery Rating</a></li>
<li><a href="http://kylebradshaw.com/presentations/jQuery/comments.php">Toggle-able Forms</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://somedirection.com/2008/07/28/speaking-about-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Structuring jQuery For Speed and Efficiency</title>
		<link>http://somedirection.com/2008/03/14/structuring-jquery-for-speed-and-efficiency/</link>
		<comments>http://somedirection.com/2008/03/14/structuring-jquery-for-speed-and-efficiency/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 23:04:18 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://somedirection.com/2008/03/14/structuring-jquery-for-speed-and-efficiency/</guid>
		<description><![CDATA[I jQuery. There I said it loud and clear across the Internet so everyone knows it. I don&#8217;t ever want to use another framework. When I work with large sites with many jQuery rules that have to be applied, sometimes this can cause sluggishness &#8211; especially if you&#8217;re using jQuery for progressive enhancement. I was [...]]]></description>
			<content:encoded><![CDATA[<p><img class="right" src="http://somedirection.com/wp-content/uploads/2008/03/jquery-logo.gif" alt="jQuery-logo.gif" border="0" width="132" height="132" />
I <img src="http://somedirection.com/wp-content/uploads/2008/03/heart.png" alt="love" border="0" width="16" height="16" /> jQuery. There I said it loud and clear across the Internet so everyone knows it. I don&#8217;t ever want to use another framework.</p>

<p>When I work with large sites with many jQuery rules that have to be applied, sometimes this can cause sluggishness &#8211; especially if you&#8217;re using jQuery for progressive enhancement.</p>

<p>I was recently hit with a performance snag with jQuery &#8211; I just had too much going on in my jrules.js file &#8211; this is what I use to apply all of my <abbr title="Document Object Model">DOM</abbr> methods with jQuery. jQuery performance is great &#8211; and with the  packed version it&#8217;s footprint is miniscule but when you parse a massive <abbr title="Document Object Model">DOM</abbr> and apply a ton of rules sluggishness ensues especially when using progressive enhancement to hide/show multiple objects.</p>

<p>Right now I have a jrules.js file that is big, mean and has over 200+ lines of jQuery goodness to apply every time a page loads. </p>

<p>I hit performance issues when I have pages with hundreds of tags in the markup and a ton of content &#8211; you can see where I&#8217;m going with this. </p>

<p>What I came up with and use for most of my recent projects is a way to pass over those jQuery rules that don&#8217;t <strong>need</strong> to be applied or even looked at on certain pages. This is how I go about it:</p>

<p>First I break up my rules according to what page they&#8217;re on. </p>

<div class='code_parent'><div class='code_child'><code><pre>document.ready(function() {

// GLOBAL

// HOME

// LOGIN

});</pre></code></div></div>

<p>If you can segregate rules and only apply them when they&#8217;re needed you&#8217;ll significantly improve the speed with which jQuery can handle it all, especially when you&#8217;re dealing with massive <abbr title="Document Object Model">DOM</abbr> trees.</p>

<p>I leverage top level CSS inheritance to bring it together. On my pages assign an ID to the body tag from which all my jQuery rules will be executed upon.</p>

<div class='code_parent'><div class='code_child'><code><pre>&#60;body id="home"></pre></code></div></div>

<p>You can use <a href="http://docs.jquery.com/Core/length">.length</a> or <a href="http://docs.jquery.com/Core/size">.size()</a> &#8211; they&#8217;re synonymous to test if the jQuery object is <span class="underline">avaiable</span> in the <abbr title="Document Object Model">DOM</abbr>, if it doesn&#8217;t exist jQuery doesn&#8217;t have to bother with it. </p>

<p>Rules only used on certain pages can now be filtered and jQuery can pass over huge blocks of declarations of whom we know don&#8217;t exist in the current <abbr title="Document Object Model">DOM</abbr> anyhow.</p>

<div class='code_parent'><div class='code_child'><code><pre>document.ready(function() {

// GLOBAL
// DOM elements that exist on every page

$("input[@type=password], input[@type=text]").addClass("text");

$("input[@type=password], input[@type=text], textarea").focus(function() {
    $(this).addClass("focus");
});

// HOME body#home

if ($("body#home").size()) {
    // only applies rules on the homepage
    $("p").hover(function() {
        $(this).addClass("change")
    }, function() {
        $(this).removeClass("change")
    );
}

// LOGIN

if ($("body#login").size()) {
    // only applies rules on the login page
}

});</pre></code></div></div>

<p>For simple pages with a few rules and a small <abbr title="Document Object Model">DOM</abbr> this is definitely overkill, but if you&#8217;ve noticed even a nano second of lag when jQuery applies your rules and see the <abbr title="Document Object Model">DOM</abbr> rearrange itself at page load try this out and let me know how it worked for you.</p>

<p>Last night when I attended a meeting of <a href="http://markupandstyle.org/">The Markup &amp; Style Society</a> at the <a href="http://www.filamentgroup.com/">Filament Group</a> office. I got a chance to speak with Mr. jQuery himself &#8211; <a href="http://ejohn.org">John Resig</a> about my performance issue and I shared my solution to the problem. I was unsure I approached it the best way and there wasn&#8217;t a better solution available out there, but he assured me the way I was going about it was sound so consider this method <strong>Resig Approved</strong>&trade;.</p>

<h3>UPDATE</h3>

<p>John alerted me to this: Seems that <a href="http://www.google.com/trends?q=jquery%2C+prototype">jQuery is now more popular than Prototype</a> &#8211; far as search queries go at least. Congrats John &amp; the jQuery team!</p>
]]></content:encoded>
			<wfw:commentRss>http://somedirection.com/2008/03/14/structuring-jquery-for-speed-and-efficiency/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using jQuery to avoid classititis in IE6</title>
		<link>http://somedirection.com/2007/06/10/using-jquery-to-avoid-classitits-in-ie6/</link>
		<comments>http://somedirection.com/2007/06/10/using-jquery-to-avoid-classitits-in-ie6/#comments</comments>
		<pubDate>Sun, 10 Jun 2007 15:41:31 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://somedirection.com/2007/06/10/using-jquery-to-avoid-classitits-in-ie6/</guid>
		<description><![CDATA[IE6 lacks CSS 2 support and as a CSS guy &#8211; this generally sucks to deal with. One particular pain point is when stylizing form elements. Sometimes overlooked &#8211; it has become one of the first things I usually attack when developing a website. I canâ€™t stand unstylized forms. I tend to leave buttons alone, [...]]]></description>
			<content:encoded><![CDATA[<p>IE6 lacks CSS 2 support and as a CSS guy &#8211; this generally sucks to deal with. One particular pain point is when stylizing form elements. Sometimes overlooked &#8211; it has become one of the first things I usually attack when developing a website. I canâ€™t stand unstylized forms. I tend to leave buttons alone, but slapping a 1px border on input,textarea and select elements can work wonders. But due to lack of CSS 2 support in IE6 there is no easy way to differentiate html elements like these:
  <div class='code_parent'><div class='code_child'><code><pre>&#60;input type="text"/>
&#60;input type="submit" value="submit"/></pre></code></div></div> </p>

<p>This leads to a term <a href="http://zeldman.com">Jeffery Zeldman</a> coined as â€œclassititisâ€? &#8211; the extraneous use of class assignments in markup. To deal with IE6  I previously would create markup such as this: 
<div class='code_parent'><div class='code_child'><code><pre>&#60;input class="text" type="text" />
&#60;input class="submit"  type="submit" value="submit" /></pre></code></div></div></p>

<p>to give myself the proper style hooks required to differentiate the elements.</p>

<p>With browsers that support CSS2 &#8211; Firefox, IE7, Safari, etc (basically every one nowadays except IE6) it is easy to use proper CSS2 selectors<br />
<pre>
input[type=text] { /* styles <em>/}
input[type=submit] { /</em> styles */}
</pre></p>

<p>However, leveraging jQuery and some simple rules can cleanup our markup and avoid classititis. We can even add in sharp focus/blur based styling behaviors for an enhanced prettification of otherwise boring form elements.</p>

<h3>Enter jQuery</h3>

<p><p>I am a huge fan of <a href="http://jquery.com">jQuery</a>. I&#8217;ve used quite a javascript frameworks but none of them <em>stuck</em> more than jQuery. Between the thriving community, excellent documentation, and plethora of <a href="http://jquery.com/plugins/">plugins</a> &#8211; you canâ€™t go wrong.</p></p>

<p>I frequently reuse code snippets of useful functions and css rules that I&#8217;ve accrued over time (more on my CSS toolkit another time). Here is code that allows me to avoid the trap of classititis due to lack of CSS2 support in IE6:</p>

<pre>
$(document).ready(function() { 
        $("input[@type=password], input[@type=text]").addClass("text");

    $("input[@type=password], input[@type=text], textarea").focus(function() {
        $(this).addClass("focus"); 
                //focus class provides a hook to alert the user 
    });
    
    $("input[@type=password], input[@type=text], textarea").blur(function(){
        if ($(this).find(".focus")) {
            $(this).removeClass("focus");
        }
    });
});
</pre>

<p>input type=&#8221;text&#8221; <small>try typing in some text and taking focus off the input box</small>
<input type="text" /></p>

<p>textarea
<textarea>This is a textarea element with some content</textarea></p>

<p>CSS that will pull it all together

<pre>
input.text, textarea, select {
  color: #777;
  padding: 2px 5px;
  font-size: 110%;
  border: 1px solid #333;
  background: #fafafa;
}
.focus {
  background: #fff !important;
  color: #000 !important;
}
</pre>
</p>

<p><p>Be sure to check out <a href="http://www.456bereastreet.com/archive/200509/css_21_selectors_part_1/">456bereastreet</a> for an excellent article on CSS 2.1 selectors.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://somedirection.com/2007/06/10/using-jquery-to-avoid-classitits-in-ie6/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
