<?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>Too many projects, too little time &#187; javascript</title>
	<atom:link href="http://joydutta.com/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://joydutta.com/blog</link>
	<description>Joy Dutta on technology, photography, motorcycling, aviation and other things</description>
	<lastBuildDate>Fri, 23 Mar 2012 22:45:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Speeding up Pixelpost blog browsing</title>
		<link>http://joydutta.com/blog/2010/03/05/speeding-up-pixelpost-blog-browsing/</link>
		<comments>http://joydutta.com/blog/2010/03/05/speeding-up-pixelpost-blog-browsing/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 05:16:16 +0000</pubDate>
		<dc:creator>therider</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pixelpost]]></category>

		<guid isPermaLink="false">http://joydutta.com/blog/?p=867</guid>
		<description><![CDATA[Pixelpost is a very popular framework for photoblogs due to its simplicity and ease of tweaking. A while back I posted an article on how to enable keyboard navigation on a pixelpost photoblog. It works very well considering it allows mouse free browsing. But the browsing experience can be improved even more. Lets consider how [...]]]></description>
			<content:encoded><![CDATA[<p>Pixelpost is a very popular framework for photoblogs due to its simplicity and ease of tweaking. A while back I posted an <a href="http://joydutta.com/blog/2009/09/04/the-importance-of-keyboard-navigation/">article</a> on how to enable keyboard navigation on a pixelpost photoblog. It works very well considering it allows mouse free browsing. But the browsing experience can be improved even more.</p>
<p>Lets consider how a photoblog is browsed most of the time. A visitor typically lands on a home page showing the latest image and goes through the previous images sequentially, spending a few seconds on each image. Leveraging this fact, if the &#8220;previous&#8221; image is downloaded in the background using javascript right after the current image, it will be almost if not completely ready for viewing when the visitor is on the &#8220;previous&#8221; image page. The same can be done for the &#8220;next&#8221; image, but in most of the cases that image will already be in the browser cache.</p>
<p>This is a very simple change for a tangible usability benefit. Below are my tweaks:</p>
<p><strong>index.php:</strong></p>
<div class="codesnip-container" >
<pre>
// expose the previous image name through tags, so previous images can be
// pre-downloaded in the background for faster browsing experience
$tpl = ereg_replace("&lt;IMAGE_PREVIOUS_NAME>",$image_previous_name,$tpl);
</pre>
</div>
<p><strong>templates/theworldin35mm/image_template.html:</strong></p>
<div class="codesnip-container" >
<pre>
window.onload = function() {
  ...
  var prevImg = new Image(); // for downloading prev image in background

  img.onload = function(evt) {
    ...
    // after current image load, load previous image in the background
    if('&lt;IMAGE_PREVIOUS_NAME>' != '') {
      prevImg.src = '&lt;SITE_URL>images/&lt;IMAGE_PREVIOUS_NAME>';
    }
  }
  ...
};
</pre>
</div>
<p>To verify that this extra javascript is actually doing its job, look at the Net section in Firebug (in Firefox browser, ofcourse). Clear the cache first. On first page load it will show several items getting downloaded. On left arrow, the previous image page will load, and then you can see that an extra image got downloaded at the bottom. Compare with and without my code. Here is a screenshot:</p>
<p><a href="http://www.flickr.com/photos/therider/4413061742/" title="Testing pre-download of previous image by therider, on Flickr"><img src="http://farm5.static.flickr.com/4046/4413061742_2cfe20dc76_o.png" width="594" height="189" alt="Testing pre-download of previous image" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://joydutta.com/blog/2010/03/05/speeding-up-pixelpost-blog-browsing/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

