<?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>Tim Banks</title>
	<atom:link href="http://thetimbanks.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://thetimbanks.com</link>
	<description></description>
	<lastBuildDate>Wed, 19 Oct 2011 19:29:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>jQuery Extension: removeClassExcept() method</title>
		<link>http://thetimbanks.com/2011/10/19/jquery-extension-removeclassexcept-method/</link>
		<comments>http://thetimbanks.com/2011/10/19/jquery-extension-removeclassexcept-method/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 19:27:51 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[jquery extension]]></category>
		<category><![CDATA[remove class]]></category>
		<category><![CDATA[remove class except]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=240</guid>
		<description><![CDATA[I came across a question on StackOverflow.com where the user wanted the ability to remove all classes from an element except certain ones.  For example if I had the following element How would you go about removing all classes except for &#8220;aa&#8221; and &#8220;bb&#8221;?  One way would be to just set the class attribute to the [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a question on <a href="http://stackoverflow.com/questions/7826379/jquery-removeclass-but-not-certain-classes/7826461">StackOverflow.com</a> where the user wanted the ability to remove all classes from an element except certain ones.  For example if I had the following element</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;aa bb cc dd ee&quot;&gt;Lorem Ipsum&lt;/div&gt;
</pre>
<p>How would you go about removing all classes except for &#8220;aa&#8221; and &#8220;bb&#8221;?  One way would be to just set the class attribute to the classes you wanted to keep.</p>
<pre class="brush: jscript; title: ; notranslate">

$(&quot;div&quot;).attr(&quot;class&quot;, &quot;aa bb&quot;);
</pre>
<p>That&#8217;s easy enough.  Another way would be to use some built in jQuery methods.</p>
<pre class="brush: jscript; title: ; notranslate">

$(&quot;div&quot;).removeClass().addClass(&quot;aa bb&quot;);
</pre>
<p>The previous code would remove all classes and then add back the ones that were needed.  That snippet could be put into a jQuery extension to make it easier to call.</p>
<pre class="brush: jscript; title: ; notranslate">

jQuery.fn.removeClassExcept = function (val) {
    return this.each(function () {
        $(this).removeClass().addClass(val);
    });
};

$(&quot;div&quot;).removeClassExcept(&quot;aa bb&quot;);
</pre>
<p>That makes the code look cleaner.  One problem both of these solutions have is they don&#8217;t check to see if the class already exists before adding it.  On the Stack Overflow question, <a href="http://stackoverflow.com/users/298053/brad-christie">Brad Christie</a> proposed a solution to handle the case where you didn&#8217;t want to add a class unless it already existed.  The updated extension now takes that into consideration.</p>
<pre class="brush: jscript; title: ; notranslate">

jQuery.fn.removeClassExcept = function (val) {
    return this.each(function (index, el) {
        var keep = val.split(&quot; &quot;),  // list we'd like to keep
            reAdd = [],          // ones that should be re-added if found
            $el = $(el);       // element we're working on

        // look for which we re-add (based on them already existing)
        for (var i = 0; i &lt; keep.length; i++){
            if ($el.hasClass(keep[i])) reAdd.push(keep[i]);
         }

         // drop all, and only add those confirmed as existing
         $el
            .removeClass()               // remove existing classes
            .addClass(reAdd.join(' '));  // re-add the confirmed ones
    });
};
</pre>
<p>Here is a jsFiddle showing the use of removeClassExcept(): <a href="http://jsfiddle.net/9xhND/1/">http://jsfiddle.net/9xhND/1/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/10/19/jquery-extension-removeclassexcept-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick tip: Get a darker/lighter version of a hex value</title>
		<link>http://thetimbanks.com/2011/09/27/quick-tip-get-a-darkerlighter-version-of-a-hex-value/</link>
		<comments>http://thetimbanks.com/2011/09/27/quick-tip-get-a-darkerlighter-version-of-a-hex-value/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 22:39:24 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=211</guid>
		<description><![CDATA[This tip is for Chrome users.  Inside of the Chrome Developer Tools you can view the color value of an element by inspecting the element.  You will see something like the following: If you click on the colored box, the value will rotate through the other possible values (hex, rgb, hsl).  Click on the box [...]]]></description>
			<content:encoded><![CDATA[<p>This tip is for Chrome users.  Inside of the Chrome Developer Tools you can view the color value of an element by inspecting the element.  You will see something like the following:</p>
<div id="attachment_224" class="wp-caption aligncenter" style="width: 301px"><a href="http://thetimbanks.com/wp-content/uploads/2011/09/CSSHex.png"><img class="size-full wp-image-224" title="Hex value of the color" src="http://thetimbanks.com/wp-content/uploads/2011/09/CSSHex.png" alt="" width="291" height="55" /></a><p class="wp-caption-text">Hex value of the color</p></div>
<p style="text-align: left;">If you click on the colored box, the value will rotate through the other possible values (hex, rgb, hsl).  Click on the box until you see the hsl of the color.  The last value is for &#8220;lightness&#8221;.  Changing the percentage makes the color lighter (higher percentage) or darker (lower percentage).  After changing the value just click on the colored box again to get back to the hex color value.</p>
<div id="attachment_225" class="wp-caption aligncenter" style="width: 294px"><a href="http://thetimbanks.com/wp-content/uploads/2011/09/CSShsl.png"><img class="size-full wp-image-225" title="HSL value of the color" src="http://thetimbanks.com/wp-content/uploads/2011/09/CSShsl.png" alt="" width="284" height="53" /></a><p class="wp-caption-text">The last percentage value is for &quot;lightness&quot;</p></div>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/09/27/quick-tip-get-a-darkerlighter-version-of-a-hex-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recreating Google+ Expanding Image Stack</title>
		<link>http://thetimbanks.com/2011/09/20/recreating-google-expanding-image-stack/</link>
		<comments>http://thetimbanks.com/2011/09/20/recreating-google-expanding-image-stack/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 14:34:45 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Walkthrough]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=194</guid>
		<description><![CDATA[Skip straight to the demo After taking some time to browse around Google+ I noticed a cool effect on the albums page when hovering over an album. If the album had multiple images in it, the stack would expand to show the first 3 images inside the album. You can see an example of it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/demos/GooglePlusImage/">Skip straight to the demo</a></p>
<p>After taking some time to browse around Google+ I noticed a cool effect on the albums page when hovering over an album. If the album had multiple images in it, the stack would expand to show the first 3 images inside the album. You can see an example of it here: <a href="https://plus.google.com/photos/105135327491673313070/albums">https://plus.google.com/photos/105135327491673313070/albums</a>.</p>
<p>I thought it would be neat to try and reproduce this effect. This example will work in Chrome, Firefox 4+, and Safari 4+.</p>
<p><strong>Step 1 &#8211; Get images</strong></p>
<p>The only thing we need to do in step 1 is get 3 images of the same size and put them into a block element.  I grabbed 3 images from my Google+ account and put them in a div with the id of &#8220;photo-stack&#8221;.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;photo-stack&quot;&gt;
    &lt;img src=&quot;https://lh3.googleusercontent.com/-khtZ0GBqcOI/Th2kD8vv0ZE/AAAAAAAAACU/rd3t2O6QI-o/s195-c/BVI2008&quot; /&gt;
    &lt;img src=&quot;https://lh3.googleusercontent.com/-ZpghGAz-jZE/Th2kECfNChI/AAAAAAAAACI/VAtLWAuUbf0/s195-c/photo.jpg&quot; /&gt;
    &lt;img src=&quot;https://lh4.googleusercontent.com/-xcrH8Z9qHqI/Th2kEMhqQ1I/AAAAAAAAACA/jL8ZZTTpqA4/s195-c/photo.jpg&quot; /&gt;
&lt;/div&gt;
</pre>
<p><a href="/demos/GooglePlusImage/step1.html">View Step 1</a></p>
<p><strong>Step 2 &#8211; Stacking</strong></p>
<p>Now that we have our 3 images let stack them on top of each other.  This is accomplished by positioning each of them absolutely on top of each other.</p>
<pre class="brush: css; title: ; notranslate">

#photo-stack { position: relative;}

#photo-stack img { position: absolute; top: 0; left: 0;}
</pre>
<p>That looks good, but I want the first image in the DOM to appear on top.  In that case we need to set the z-index of each image.  I am going to use the nth-child property so we don&#8217;t have to add classes to each image.</p>
<pre class="brush: css; title: ; notranslate">

#photo-stack img:nth-child(1) { z-index: 3;}

#photo-stack img:nth-child(2) { z-index: 2;}

#photo-stack img:nth-child(3) { z-index: 1;}
</pre>
<p>Now the first image is on the top!</p>
<p><a href="/demos/GooglePlusImage/step2.html">View Step 2</a></p>
<p><strong>Step 3 &#8211; Moving</strong></p>
<p>Let&#8217;s start working on the animation.  The animation has 3 parts to it: movement of the images, rotation of the images, and the size of the images.</p>
<p>We can handle the movement of the images by using the translate value of the transform property.  We are going to use the nth-child property just like we did in the last step in order to target each image individually.</p>
<p>Translate takes 2 values for the x and y movement.  Since the second image isn&#8217;t moving we are only going to move the first and last images.</p>
<pre class="brush: css; title: ; notranslate">

#photo-stack:hover img:nth-child(1) {
    -webkit-transform: translate(-50px, 0px);
}
#photo-stack:hover img:nth-child(3) {
    -webkit-transform: translate(50px, 0px);
}
</pre>
<p><a href="/demos/GooglePlusImage/step3.html">View Step 3</a></p>
<p><strong>Step 4 &#8211; Rotating</strong></p>
<p>Now that we have the images moving apart we can rotate the outer image.  Rotate only takes 1 argument for the amount of degrees you want to rotate the element.  Once again the middle image is not being rotated so we will not worry about it.</p>
<pre class="brush: css; title: ; notranslate">

#photo-stack:hover img:nth-child(1) {
    -webkit-transform: rotate(5deg);
}
#photo-stack:hover img:nth-child(3) {
    -webkit-transform: rotate(-5deg);
}
</pre>
<p>We are getting close!  <a href="/demos/GooglePlusImage/step4.html">View Step 4</a></p>
<p><strong>Step 5 &#8211; Scaling</strong></p>
<p>The images need to grow a little in size when they are spreading apart.  By using the scale property we can pass in a value to change the size of the image (1 being 100%).</p>
<pre class="brush: css; title: ; notranslate">

#photo-stack:hover img:nth-child(1) {
    -webkit-transform: scale(1.1);
}
#photo-stack:hover img:nth-child(2) {
    -webkit-transform: scale(1.1);
}
#photo-stack:hover img:nth-child(3) {
    -webkit-transform: scale(1.1);
}
</pre>
<p><a href="/demos/GooglePlusImage/step5.html">View Step 5</a></p>
<p><strong>Step 6 &#8211; Animating</strong></p>
<p>In order to get the transforms to animate when hovering, only 1 line of code needs to be added.  The -webkit-transition line takes 3 arguments: property to animate, amount of time, and animation timeline.  In our case we want to animate the -webkit-transorm property for .25 seconds and have a linear timeline.</p>
<pre class="brush: css; title: ; notranslate">

#photo-stack img {  -webkit-transition: -webkit-transform .25s linear;}
</pre>
<p><a href="/demos/GooglePlusImage/step6.html">View Step 6</a></p>
<p><strong>Step 7 &#8211; Cleanup</strong></p>
<p>The look can be cleaned up a little by applying some additional styles.  Now it looks like a real stack of photos!</p>
<p><a href="/demos/GooglePlusImage/">View Final Demo</a></p>
<p>Let me know what you thought of the tutorial or if you put this to use on one of your sites!</p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/09/20/recreating-google-expanding-image-stack/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Breville blender outlet plug</title>
		<link>http://thetimbanks.com/2011/08/03/breville-blender-outlet-plug/</link>
		<comments>http://thetimbanks.com/2011/08/03/breville-blender-outlet-plug/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 14:25:39 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Breville]]></category>
		<category><![CDATA[Plug]]></category>
		<category><![CDATA[Product Design]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=155</guid>
		<description><![CDATA[Why don&#8217;t more companies make outlet plugs like this?  It makes it much easier to remove from the outlet.]]></description>
			<content:encoded><![CDATA[<p>Why don&#8217;t more companies make outlet plugs like this?  It makes it much easier to remove from the outlet.</p>
<p><a href="http://thetimbanks.com/wp-content/uploads/2011/08/0-breville_plug2.jpg"><img class="aligncenter size-full wp-image-214" title="0-breville_plug2" src="http://thetimbanks.com/wp-content/uploads/2011/08/0-breville_plug2.jpg" alt="" width="468" height="263" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/08/03/breville-blender-outlet-plug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting a threshold on jQuery ajax callbacks using prefilters</title>
		<link>http://thetimbanks.com/2011/06/08/setting-a-threshold-on-jquery-ajax-callbacks-using-prefilters/</link>
		<comments>http://thetimbanks.com/2011/06/08/setting-a-threshold-on-jquery-ajax-callbacks-using-prefilters/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 14:42:53 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[prefilter]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=178</guid>
		<description><![CDATA[This is a cross post from my company&#8217;s blog. Skip straight to the demo. When developing interfaces that include ajax functionality there will come a time when you will be showing some sort of loading animation and it will only show for a split second since the ajax call finished so fast.  This can cause the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a cross post from my <a href="http://www.foliotek.com/devblog/setting-a-threshold-on-jquery-ajax-callbacks-using-prefilters/">company&#8217;s blog</a>.</p>
<div>
<p>Skip straight to the <a href="http://www.thetimbanks.com/demos/jquery/successThreshold/">demo</a>.</p>
<p>When developing interfaces that include ajax functionality there will come a time when you will be showing some sort of loading animation and it will only show for a split second since the ajax call finished so fast.  This can cause the user to be disoriented since they aren&#8217;t exactly sure what popped up.  It can be beneficial to slow down the interface so the user can see everything that is going on.</p>
<p>In jQuery 1.5, there is now a way to extend the $.ajax method.  There are three different ways to extend $.ajax: prefilters, converters, and transports.  I am going to use prefilters which the jQuery documentation describes as &#8220;generalized beforeSend callbacks to handle custom options or modify existing ones&#8221;.  I&#8217;m not going to go into details about what a prefilter is since the <a href="http://api.jquery.com/jQuery.ajaxPrefilter/">documentation</a> does a pretty good job.</p>
<p>Instead of setting up timeouts and clearing them out, I am wanting to pass a custom option to the ajax method.  Here is what I am trying to go for:</p>
<pre class="brush: jscript; title: ; notranslate">
$.ajax(url, {
    ...
    successThreshold: 3000,
    ...
})
</pre>
<p>The successThreshold option is my custom option.  The time passed into it will be the minimum amount of time it takes before the success callback gets called.  Now that I have my custom option, I can access it and modify the other options in my prefilter.</p>
<pre class="brush: jscript; title: ; notranslate">
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
    if (originalOptions.successThreshold &amp;amp;amp;&amp;amp;amp;  $.isFunction(originalOptions.success)) {
        var start, stop;
        options.beforeSend = function () {
            start = new Date().getTime();
            if ($.isFunction(originalOptions.beforeSend))
                originalOptions.beforeSend();
        };

        options.success = function (response) {
        var that = this, args = arguments;
        stop = new Date().getTime();

        function applySuccess() {
             originalOptions.success.apply(that, args);
        }

        var difference = originalOptions.successThreshold - (stop - start);
        if (difference &gt; 0)
            setTimeout(applySuccess, difference);
        else
            applySuccess();
        };
    }
});
</pre>
<p>The first thing I do in the prefilter is check to make sure both the successThreshold and success function are set.  I then override the beforeSend option in order to get the time before the ajax call starts.  In order to keep the success callback from firing before the threshold, the time difference needs to be calculated.  If the call didn&#8217;t take longer than the difference then set a timeout for the remaining time.  Otherwise just call the success callback immediately.</p>
<p>I have seen other solutions to this and all of them seem to set timeouts and clear them in different functions and it would have to be repeated for every call.  This can be defined in one place and used on any ajax call in the application.</p>
<p>I have added the code to my <a href="https://github.com/thetimbanks/successThreshold">Github repository</a>.  This <a href="http://www.thetimbanks.com/demos/jquery/successThreshold/">demo</a> shows the code in action.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/06/08/setting-a-threshold-on-jquery-ajax-callbacks-using-prefilters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chrome Dev Tools at Google I/O 2011</title>
		<link>http://thetimbanks.com/2011/05/25/chrome-dev-tools-at-google-io-2011/</link>
		<comments>http://thetimbanks.com/2011/05/25/chrome-dev-tools-at-google-io-2011/#comments</comments>
		<pubDate>Wed, 25 May 2011 15:20:27 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[dev tools]]></category>
		<category><![CDATA[Firebug]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=170</guid>
		<description><![CDATA[If you are still using Firefox just for Firebug, I bet you will switch to Chrome after watching this video.  I used to stick with Firefox while developing since Firebug was so good at what it did, but Google is doing great things with their dev tools.  The following talk is from Google I/O 2011 [...]]]></description>
			<content:encoded><![CDATA[<p>If you are still using Firefox just for Firebug, I bet you will switch to Chrome after watching this video.  I used to stick with Firefox while developing since Firebug was so good at what it did, but Google is doing great things with their dev tools.  The following talk is from Google I/O 2011 featuring Paul Irish and Pavel Feldman.  The talk mostly covers new features, but you can take a look at their <a href="http://code.google.com/chrome/devtools/">docs site</a> for all the features.</p>
<p>The video clocks in at just over 40 mins but it is well worth the time.</p>
<p><object width="560" height="349"><param name="movie" value="http://www.youtube.com/v/N8SS-rUEZPg?fs=1&amp;hl=en_US&amp;rel=0" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="560" height="349" src="http://www.youtube.com/v/N8SS-rUEZPg?fs=1&amp;hl=en_US&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/05/25/chrome-dev-tools-at-google-io-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Extension: toggleText() method</title>
		<link>http://thetimbanks.com/2011/03/22/jquery-extension-toggletext-method/</link>
		<comments>http://thetimbanks.com/2011/03/22/jquery-extension-toggletext-method/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 12:48:45 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[jquery extension]]></category>
		<category><![CDATA[jquery plugin]]></category>
		<category><![CDATA[toggle]]></category>
		<category><![CDATA[toggletext]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=153</guid>
		<description><![CDATA[Skip straight to the demo. Here&#8217;s a situation I have run into multiple times: I have a hidden area that is toggled by a link.  The link will usually say &#8220;Show *&#8221;, and once it is clicked it will say &#8220;Hide *&#8221;.  I would usually just check the text when the link is clicked and [...]]]></description>
			<content:encoded><![CDATA[<p>Skip straight to the <a href="http://thetimbanks.com/demos/jquery/extensions/toggleText/">demo</a>.</p>
<p>Here&#8217;s a situation I have run into multiple times: I have a hidden area that is toggled by a link.  The link will usually say &#8220;Show *&#8221;, and once it is clicked it will say &#8220;Hide *&#8221;.  I would usually just check the text when the link is clicked and switch it.  Similar to the following:</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;a&quot;).click(function() {
    var $self = $(this);
    if ($self.text() == &quot;Show items&quot;)
       $self.text(&quot;Hide items&quot;);
    else
        $self.text(&quot;Show items&quot;);
});
</pre>
<p>It would get tedious to add this to every link that toggled the view on an element.  In order to make it easier on myself I threw together a little extension for jQuery.  You pass it 2 string values representing the text that you would like to toggle.  Here is an example usage that does the same thing as the code block above:</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;a&quot;).click(function() {
    $(this).toggleText(&quot;Show&quot;, &quot;Hide&quot;);
});
</pre>
<p>The extension looks for the first value in the element&#8217;s text and if it exists, it is replaced with the second value.  If the first value doesn&#8217;t exist in the element&#8217;s text, it looks for the second value in the text and replaces it with the first value.   Here is the source:</p>
<pre class="brush: jscript; title: ; notranslate">
jQuery.fn.toggleText = function (value1, value2) {
    return this.each(function () {
        var $this = $(this),
            text = $this.text();

        if (text.indexOf(value1) &gt; -1)
            $this.text(text.replace(value1, value2));
        else
            $this.text(text.replace(value2, value1));
    });
};
</pre>
<p>To see it in action, you can <a href="http://thetimbanks.com/demos/jquery/extensions/toggleText/">view the demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/03/22/jquery-extension-toggletext-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Very poor use of CSS on the Netflix website</title>
		<link>http://thetimbanks.com/2011/02/23/very-poor-use-of-css-on-the-netflix-website/</link>
		<comments>http://thetimbanks.com/2011/02/23/very-poor-use-of-css-on-the-netflix-website/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 22:18:05 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Netflix]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=66</guid>
		<description><![CDATA[Awhile ago I was signing up to get the PS3 Netflix disc and decided to inspect the source of the page.  Shame on you Netflix.]]></description>
			<content:encoded><![CDATA[<p>Awhile ago I was signing up to get the PS3 Netflix disc and decided to inspect the source of the page.  Shame on you Netflix.</p>
<p><a href="http://thetimbanks.com/wp-content/uploads/2010/01/NetflixBadCss.png"><img class="aligncenter size-medium wp-image-67" title="Netflix does not use CSS correctly" src="http://thetimbanks.com/wp-content/uploads/2010/01/NetflixBadCss-300x199.png" alt="" width="300" height="199" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2011/02/23/very-poor-use-of-css-on-the-netflix-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS 4.2 features that I have been waiting for</title>
		<link>http://thetimbanks.com/2010/11/22/ios-4-2-features-that-i-have-been-waiting-for/</link>
		<comments>http://thetimbanks.com/2010/11/22/ios-4-2-features-that-i-have-been-waiting-for/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 05:13:57 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iOS 4.2]]></category>
		<category><![CDATA[SMS tones]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=141</guid>
		<description><![CDATA[So I finally got around to downloading the new iOS 4.2 update tonight and after reading through the list of updates I found a couple features that haven&#8217;t been talked about too much.  It seems all the hype has been around the AirPrint and AirPlay functionality.  The features I am happily looking forward to are: [...]]]></description>
			<content:encoded><![CDATA[<p>So I finally got around to downloading the new iOS 4.2 update tonight and after reading through the list of updates I found a couple features that haven&#8217;t been talked about too much.  It seems all the hype has been around the AirPrint and AirPlay functionality.  The features I am happily looking forward to are:</p>
<ul>
<li>Find text on the web page in Safari</li>
<li>New SMS/MMS text tones and the ability to set custom tones per contact</li>
</ul>
<p><strong>Find text on the web page in Safari</strong></p>
<p>I can&#8217;t recall the amount of times I have loaded a web page in mobile Safari and wished this feature existed.  It seems this feature would be very important for small screen devices since skimming large amounts of data is not easy.  I&#8217;m not sure how this will look in the UI, but I will update this post once I get the update installed.</p>
<p>After I got the update installed I loaded up Safari to check out the new find feature.  I loaded up the Apple website and started poking around to try and find the feature.  The first button I tried was the middle button on the bottom bar that looks like a box with an arrow coming out of it.  It was the wrong choice, but it did show me where the &#8220;Print&#8221; button was.  I then tried clicking each button including the URL and Google search and still couldn&#8217;t find where the feature was.</p>
<div id="attachment_146" class="wp-caption aligncenter" style="width: 210px"><a href="http://thetimbanks.com/wp-content/uploads/2010/11/photo-1.png"><img class="size-medium wp-image-146" title="New bar above the keybaord" src="http://thetimbanks.com/wp-content/uploads/2010/11/photo-1-200x300.png" alt="The new bar above the keyboard" width="200" height="300" /></a><p class="wp-caption-text">The new bar above the keyboard</p></div>
<p style="text-align: center;">
<p>I then opened the Google search to see if anyone else is having problems.  As soon as I started typing a new bar appeared right above the keyboard saying how many matches there were on the current page.  Apparently you have to use the Google search feature to find items on the current page.  This to me doesn&#8217;t make sense at all.  How is that intuitive?  I click &#8220;Google&#8221; to find what is on the page?  Weird.</p>
<div id="attachment_147" class="wp-caption aligncenter" style="width: 210px"><a href="http://thetimbanks.com/wp-content/uploads/2010/11/photo-2.png"><img class="size-medium wp-image-147" title="Scrolling past the Google results" src="http://thetimbanks.com/wp-content/uploads/2010/11/photo-2-200x300.png" alt="Scrolling down past the Google results" width="200" height="300" /></a><p class="wp-caption-text">Scrolling down past the Google results</p></div>
<p style="text-align: center;">
<p>After typing in the term to find on the page, you then have to scroll down past all the results that Google returned.  Again, this seems a little out of place.  Finally, clicking on the &#8220;Find ****&#8221; line opens up the interface for the find feature.  The term you are searching for is highlighted similar to how the desktop version of Safari does it.  The term is highlighted in a yellow bubble.  A new toolbar at the bottom allows advancing through the matches and there is a &#8220;Done&#8221; button for when you are finished.</p>
<div id="attachment_148" class="wp-caption aligncenter" style="width: 210px"><a href="http://thetimbanks.com/wp-content/uploads/2010/11/photo-3.png"><img class="size-medium wp-image-148 " title="Bar for advancing" src="http://thetimbanks.com/wp-content/uploads/2010/11/photo-3-200x300.png" alt="Search term is highlighted and bar at the bottom to advance matches" width="200" height="300" /></a><p class="wp-caption-text">Search term is highlighted and bar at the bottom to advance matches</p></div>
<p style="text-align: center;">
<p>Overall I am not a big fan of how the feature is implemented.  I feel Apple could have done a better job with the user experience.</p>
<p><strong>New SMS/MMS text tones and the ability to set custom tones per contact</strong></p>
<p>This is another one of those features where you ask &#8220;Why wasn&#8217;t that in version 1.0?&#8221;.  It seems like it would be so easy to add this feature in, but apparently it never seemed important enough to Apple.  I have always been disappointed with the lack of choices for tones for SMS/MMS.  Not only that, there are only 1 or 2 that are any good and the others are just annoying.</p>
<p>Having the ability to assign certain tones per contact will nice.  However, if the new tones aren&#8217;t any good then you will be stuck using the annoying tones.</p>
<p>I still wish Apple would add the ability for custom SMS/MMS tones.  How hard would it be?  They could even sell them for $1 and make a killing.  I would assume they are eventually going to go this route.</p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2010/11/22/ios-4-2-features-that-i-have-been-waiting-for/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Intel should stick to processors</title>
		<link>http://thetimbanks.com/2010/11/18/intel-should-stick-to-processors/</link>
		<comments>http://thetimbanks.com/2010/11/18/intel-should-stick-to-processors/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 04:44:15 +0000</pubDate>
		<dc:creator>Tim Banks</dc:creator>
				<category><![CDATA[Funny]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[Intel Wireless controller]]></category>

		<guid isPermaLink="false">http://thetimbanks.com/?p=134</guid>
		<description><![CDATA[I was taking some old clothes up to the local Goodwill to donate them and decided to browse around while I was there.  I found myself in the back of the store where they keep all the electronics, secretly hoping to find a good deal on something.  As I was skimming the less than desirable [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thetimbanks.com/wp-content/uploads/2010/11/photo-e1290141519835.jpg"><img class="aligncenter size-medium wp-image-135" title="Intel Wireless Gamepad" src="http://thetimbanks.com/wp-content/uploads/2010/11/photo-e1290141519835-224x300.jpg" alt="" width="224" height="300" /></a></p>
<p>I was taking some old clothes up to the local Goodwill to donate them and decided to browse around while I was there.  I found myself in the back of the store where they keep all the electronics, secretly hoping to find a good deal on something.  As I was skimming the less than desirable selection, something caught my eye.  At first I thought it was one of the original PS3 controllers (see below), but after taking a closer look I actually started laughing out loud.  It is a wireless controller from Intel that is a god awful shape.  The controller is apparently part of a series of wireless devices from Intel as you can see on front of the box.</p>
<p>I am not sure Intel is ready for the game peripheral market just yet.</p>
<p><a href="http://thetimbanks.com/wp-content/uploads/2010/11/ps3controller.jpg"><img class="aligncenter size-medium wp-image-136" title="Boomerang PS3 controller" src="http://thetimbanks.com/wp-content/uploads/2010/11/ps3controller-300x250.jpg" alt="" width="300" height="250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thetimbanks.com/2010/11/18/intel-should-stick-to-processors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

