<?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>Ian Oxley &#187; javascript</title>
	<atom:link href="http://ianoxley.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://ianoxley.com</link>
	<description>Web Developer</description>
	<lastBuildDate>Tue, 11 Oct 2011 08:33:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>encdec &#8211; BaseXX Encoding and Decoding in JavaScript</title>
		<link>http://ianoxley.com/2011/06/03/encdec-basexx-encoding-and-decoding-in-javascript/</link>
		<comments>http://ianoxley.com/2011/06/03/encdec-basexx-encoding-and-decoding-in-javascript/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 22:13:08 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/2011/06/03/encdec-javascript-library-for-base-encoding-and-decoding/</guid>
		<description><![CDATA[Recently, while hacking around with some Python code I came up with a Gist for base58 encoding and decoding. Now, just for fun, I thought it would be a good idea / exercise to port this over to JavaScript. This gave rise to encdec &#8211; a small base encoding / decoding library. By default if [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, while hacking around with some Python code I came up with a <a href="https://gist.github.com/865912" rel="external">Gist for base58 encoding and decoding</a>. Now, just for fun, I thought<br />
	it would be a good idea / exercise to port this over to JavaScript. This gave rise to <a href="https://github.com/ianoxley/encdec" rel="external"><strong>encdec</strong> &ndash; a small base encoding / decoding library</a>. </p>
<p>By default if uses base58 encoding, but it does let you pass it<br />
	your own base alphabet allowing you to do base16, base32 or base-whatever-you-like encoding.</p>
<p>Please <a href="https://github.com/ianoxley/encdec" rel="external" title="encdec on GitHub">have a play with it</a> and let me know what you think <img src='http://ianoxley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2011/06/03/encdec-basexx-encoding-and-decoding-in-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>2 Things I Learnt About JavaScript This Week</title>
		<link>http://ianoxley.com/2011/02/03/2-things-i-learnt-about-javascript-this-week/</link>
		<comments>http://ianoxley.com/2011/02/03/2-things-i-learnt-about-javascript-this-week/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 22:54:39 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/2011/02/03/2-things-i-learnt-about-javascript-this-week/</guid>
		<description><![CDATA[I recently picked up a copy of JavaScript: The Good Parts and have been reading it on the train to and from work. Although the book&#39;s preface states that the book is targeted at programmers who are venturing into JavaScript for the first time or who have been working with JavaScript at a novice level [...]]]></description>
			<content:encoded><![CDATA[<p>I recently picked up a copy of <a href="http://www.amazon.co.uk/gp/product/0596517742?ie=UTF8&amp;tag=strasanox-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0596517742">JavaScript: The Good Parts</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=strasanox-21&amp;l=as2&amp;o=2&amp;a=0596517742" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;display:none;" /> and have been reading it on the train to and from work. Although the book&#39;s preface states that the book is targeted at programmers who <q>are venturing into JavaScript for the first time</q> or <q>who have been working with JavaScript at a novice level</q> I&#39;m still finding it enjoyable to read and am managing to pick up a few tips along the way.</p>
<p>Two such tips that I picked up this week are:</p>
<ol>
<li>
		When using the <code>throw</code> statement you can use an object literal to give an exception a type and a message. For example:<br />
		<code></p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">throw {
	type: 'FooError',
	message: 'Invalid foo'
};</pre></div></div>

<p>		</code>
	</li>
<li>When using closures, avoid creating an anonymous function inside a loop as it can be computationally wasteful and potentially lead to confusing code. For example (this is taken from the book):<br />
	<code></p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">var add_the_handlers = function (nodes) { 
	var helper = function (i) {
		return function (e) { 
			alert(i);
		};
	}; 
&nbsp;
	var i; 
	for (i = 0; i &lt; nodes.length; i += 1) {
		nodes[i].onclick = helper(i);
	}
};</pre></div></div>

<p>	</code>
	</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2011/02/03/2-things-i-learnt-about-javascript-this-week/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GMail Toolbar Chrome Greasemonkey Script</title>
		<link>http://ianoxley.com/2010/12/10/gmail-toolbar-chrome-greasemonkey-script/</link>
		<comments>http://ianoxley.com/2010/12/10/gmail-toolbar-chrome-greasemonkey-script/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 21:07:38 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/2010/12/10/gmail-toolbar-chrome-greasemonkey-script/</guid>
		<description><![CDATA[I quite like the toolbar at the top of GMail. You know, the one with links to Google Calendar, Google Reader, Google Docs, et al. But I&#8217;m not that keen on having to scroll right back to the top of the page each time I need access to it. So, I created a simple Greasemonkey [...]]]></description>
			<content:encoded><![CDATA[<p>I quite like the toolbar at the top of GMail. You know, the one with links to Google Calendar, Google Reader, Google Docs, et al. But I&#8217;m not that keen on having to scroll right back to the top of the page each time I need access to it. So, I created a simple Greasemonkey script for Google Chrome to apply fixed positioning to the toolbar. That way it always stays at the top of your screen <img src='http://ianoxley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(Firefox users: I did create a <a href="https://github.com/ianoxley/userContent">user stylesheet that achieves the same effect</a><br />
 recently. However, that relies on the <code>@-moz-document domain(mail.google.com)</code> to restrict the <abbr title="Cascading Style Sheet">CSS</abbr> to GMail and Google seems to send different HTML to Firefox than it sends to Chrome).</p>
<p>You can fork a copy of the script from GitHub: <a href="https://github.com/ianoxley/gmailtoolbar">https://github.com/ianoxley/gmailtoolbar</a></p>
<p>
	Or alternatively download it from here: <a href="/greasemonkey/gmailtoolbar.user.js">gmailtoolbar.user.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2010/12/10/gmail-toolbar-chrome-greasemonkey-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving Greasemonkey Scripts To GitHub</title>
		<link>http://ianoxley.com/2010/08/18/moving-greasemonkey-scripts-to-github/</link>
		<comments>http://ianoxley.com/2010/08/18/moving-greasemonkey-scripts-to-github/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 21:05:57 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[greasemonkey]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/2010/08/18/moving-greasemonkey-scripts-to-github/</guid>
		<description><![CDATA[Recently I made a few amends to some Greasemonkey scripts I wrote a while back and, since I&#8217;ve been using git quite a bit recently, it made sense to me to move my Greasemonkey scripts onto GitHub. So I did And here they are: google-search-shortcut open-selected-links stackoverflow-tag-cloud straight-to-reader]]></description>
			<content:encoded><![CDATA[<p>Recently I made a few amends to some Greasemonkey scripts I wrote a while back and, since I&#8217;ve been <a href="http://www.strongasanox.co.uk/2010/04/27/using-git/">using git</a> quite a bit recently, it made sense to me to move my Greasemonkey scripts onto GitHub.</p>
<p>So I did <img src='http://ianoxley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  And here they are:</p>
<ul>
<li><a href="http://github.com/ianoxley/google-search-shortcut">google-search-shortcut</a></li>
<li><a href="http://github.com/ianoxley/open-selected-links">open-selected-links</a></li>
<li><a href="http://github.com/ianoxley/stackoverflow-tag-cloud">stackoverflow-tag-cloud</a></li>
<li><a href="http://github.com/ianoxley/straight-to-reader">straight-to-reader</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2010/08/18/moving-greasemonkey-scripts-to-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greasemonkey Open Selected Links Script</title>
		<link>http://ianoxley.com/2010/06/01/greasemonkey-open-selected-links-script/</link>
		<comments>http://ianoxley.com/2010/06/01/greasemonkey-open-selected-links-script/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 21:02:24 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[greasemonkey]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/?p=378</guid>
		<description><![CDATA[I hadn&#8217;t done any monkeying around with Greasemonkey for a while until the other day when I came up with this script: http://github.com/ianoxley/open-selected-links Any links that are present in the selected text will be opened on the mouseup event, except for the Cached and Similar links you get in Google search results. If you&#8217;ve got [...]]]></description>
			<content:encoded><![CDATA[<p>I hadn&#8217;t done any monkeying around with <a href="https://addons.mozilla.org/en-US/firefox/addon/748/">Greasemonkey</a> for a while until the other day when I came up with this script: <a href="http://github.com/ianoxley/open-selected-links">http://github.com/ianoxley/open-selected-links</a></p>
<p>Any links that are present in the selected text will be opened on the <code>mouseup</code> event, except for the <strong>Cached</strong> and <strong>Similar</strong> links you get in Google search results.</p>
<p>If you&#8217;ve got and suggestions for improvements, let me know in the comments <img src='http://ianoxley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>UPDATE</h3>
<p>The script has been updated so that you now have to press the <code>Ctrl</code> or <code>Cmd</code> key while selecting the text, in the same way that you would <code>Ctrl / Cmd + click</code> to open a link in a new tab.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2010/06/01/greasemonkey-open-selected-links-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript WebKit Notifications API Demo With Flickr and JSONP</title>
		<link>http://ianoxley.com/2010/04/24/javascript-webkit-notifications-api-demo-with-flickr-and-jsonp/</link>
		<comments>http://ianoxley.com/2010/04/24/javascript-webkit-notifications-api-demo-with-flickr-and-jsonp/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 21:12:52 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jsonp]]></category>
		<category><![CDATA[webkit notifications api]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/?p=324</guid>
		<description><![CDATA[I&#8217;ve been playing around with the JavaScript Notifications API recently &#8211; or to be a bit more specific the WebKit Notifications API &#8211; and put together this little demo using Flickr and JSONP: You search Flickr by entering a tag The JSONP callback function then displays the first few photos returned using the Notifications API [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with the JavaScript <a href="http://www.chromium.org/developers/design-documents/desktop-notifications/api-specification">Notifications API</a> recently &#8211; or to be a bit more specific the WebKit Notifications API &#8211; and put together <a href="http://lab.strongasanox.co.uk/notify.html">this little demo</a> using Flickr and JSONP:</p>
<ol>
<li>You search Flickr by entering a tag</li>
<li>The JSONP callback function then displays the first few photos returned using the Notifications API</li>
<li>Each notification is cancelled after 10 seconds (there is no Dismiss button, like there is when you use the API on <code>localhost</code>)</li>
</ol>
<p>You&#8217;ll need to grant notification permissions first to be able to view the notifications &#8211; you should see an info bar like the one below the first time you click on <code>Search</code>:</p>
<p><a href="http://ianoxley.com/wp-content/uploads/2010/04/Screenshot-Webkit-Notifications-API-request-permission1.png"><img class="size-medium wp-image-331 alignnone" title="WebKit Notifications API requestPermission screenshot" src="http://ianoxley.com/wp-content/uploads/2010/04/Screenshot-Webkit-Notifications-API-request-permission1-300x66.png" alt="WebKit Notifications API requestPermission screenshot" width="300" height="66" /></a></p>
<p>After that, you should see the notifications stack up in the bottom right-hand corner of your screen:</p>
<p><a href="http://ianoxley.com/wp-content/uploads/2010/04/Screenshot-notifications1.png"><img class="alignnone size-medium wp-image-339" title="Screenshot of the notifications" src="http://ianoxley.com/wp-content/uploads/2010/04/Screenshot-notifications1-300x168.png" alt="Screenshot of the notifications" width="300" height="168" /></a></p>
<p>At the time of writing, you&#8217;ll need to be using Google Chrome for the demo to work (although I&#8217;m pretty sure that support for the Notifications API in Safari is imminent).</p>
<p>And, as an aside, I managed to throw a bit of HTML 5 into the demo as well with some <a href="http://dev.w3.org/html5/spec/Overview.html#autofocusing-a-form-control">autofocus</a> and <a href="http://dev.w3.org/html5/spec/Overview.html#the-placeholder-attribute">placeholder</a> attributes on the <code>&lt;input type="text" /&gt;</code> field, just for good measure <img src='http://ianoxley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2010/04/24/javascript-webkit-notifications-api-demo-with-flickr-and-jsonp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple jQuery Print Page Plugin</title>
		<link>http://ianoxley.com/2010/02/26/a-simple-jquery-print-page-plugin/</link>
		<comments>http://ianoxley.com/2010/02/26/a-simple-jquery-print-page-plugin/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 20:25:22 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/?p=298</guid>
		<description><![CDATA[The other day I was after a really simple way to add a print page link to a page to, well, er, print it.  So I came up with my jQuery Print Page plugin and stuck it on GitHub with a demo page: http://github.com/ianoxley/jqueryprintpage This really is nothing fancy: it&#8217;s just a convenient way of adding [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was after a really simple way to add a <em>print page</em> link to a page to, well, er, print it.  So I came up with my jQuery Print Page plugin and stuck it on GitHub with a demo page: <a href="http://github.com/ianoxley/jqueryprintpage">http://github.com/ianoxley/jqueryprintpage</a></p>
<p>This really is nothing fancy: it&#8217;s just a convenient way of adding an &lt;a&gt; tag plus an event-handler to a page to print it. Using it is as simple as, well, using File -&gt; Print. But you can&#8217;t style the File menu with <abbr title="Cascading Style Sheets">CSS</abbr> so this is much more fun <img src='http://ianoxley.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2010/02/26/a-simple-jquery-print-page-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lorem Ipsum Bookmarklet</title>
		<link>http://ianoxley.com/2009/10/16/lorem-ipsum-bookmarklet/</link>
		<comments>http://ianoxley.com/2009/10/16/lorem-ipsum-bookmarklet/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 19:57:18 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[devtools]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.strongasanox.co.uk/?p=225</guid>
		<description><![CDATA[I often use a couple of paragraphs of Lipsum when testing forms containing &#60;textarea&#62; tags and have had this bookmarklet I cobbled together sitting on my Bookmarks Toolbar for a while now. Anyway, I thought it might be fun to hook it up to a HTML 5 form to let you customise how many paragraphs [...]]]></description>
			<content:encoded><![CDATA[<p>I often use a couple of paragraphs of Lipsum when testing forms containing <code>&lt;textarea&gt;</code> tags and have had this bookmarklet I cobbled together sitting on my Bookmarks Toolbar for a while now.</p>
<p>Anyway, I thought it might be fun to hook it up to a HTML 5 form to let you customise how many paragraphs of Lipsum you want each time you click it. So that&#8217;s what I went and did:</p>
<p><a href="http://www.strongasanox.co.uk/lorem-ipsum-bookmarklet-generator/">Lorem Ipsum Bookmarklet Generator</a></p>
<p>Hopefully it&#8217;ll save you a few mouse clicks next time you&#8217;re testing some forms.</p>
<p>(Please note that the form used in the generator uses the <code>&lt;input type="range" /&gt;</code> HTML 5 tag which currently works best in the <a href="http://www.opera.com/browser/">latest version of Opera</a>. <abbr title="Your mileage may vary"> YMMV</abbr> when using other browsers).</p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2009/10/16/lorem-ipsum-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Form Focus Plugin Released</title>
		<link>http://ianoxley.com/2008/06/09/jquery-form-focus-plugin-released/</link>
		<comments>http://ianoxley.com/2008/06/09/jquery-form-focus-plugin-released/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 21:49:42 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://ianoxley.wordpress.com/?p=21</guid>
		<description><![CDATA[I have released the first version of my jQuery Form Focus plugin. This lets you set the initial focus on any form element but is careful not to set the focus if the user has already started filling in the form. To use it you call something like: $('#username').formFocus(); $('form input:first').formFocus(); $('form#options input[type="checkbox"]:first').formFocus(); Hope you [...]]]></description>
			<content:encoded><![CDATA[<p>I have released the first version of my <a href="http://plugins.jquery.com/project/FormFocus">jQuery Form Focus plugin</a>. This lets you set the initial focus on any form element but is careful not to set the focus if the user has already <a href="http://www.themaninblue.com/writing/perspective/2005/10/27/">started filling in the form</a>. To use it you call something like:</p>
<p><code>$('#username').formFocus();<br />
$('form input:first').formFocus();<br />
$('form#options input[type="checkbox"]:first').formFocus();</code></p>
<p>Hope you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2008/06/09/jquery-form-focus-plugin-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSearch Added to Unobtrusive JavaScript Google Co-op Search</title>
		<link>http://ianoxley.com/2008/02/05/opensearch-added-to-unobtrusive-javascript-google-co-op-search/</link>
		<comments>http://ianoxley.com/2008/02/05/opensearch-added-to-unobtrusive-javascript-google-co-op-search/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 21:06:52 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[google co-op]]></category>

		<guid isPermaLink="false">http://ianoxley.wordpress.com/?p=8</guid>
		<description><![CDATA[I have added OpenSearch to my Google Co-op Search Engine Unobtrusive JavaScript. Now you use the search engine in OpenSearch aware browsers you can add it to the browser&#8217;s search box.]]></description>
			<content:encoded><![CDATA[<p>I have added <a HREF="http://www.opensearch.org">OpenSearch</a> to my Google Co-op Search Engine <a HREF="http://www.strongasanox.co.uk/http://www.strongasanox.co.uk/unobtrusivejavascript/">Unobtrusive JavaScript</a>. Now you use the search engine in <a HREF="http://www.getfirefox.com">OpenSearch aware browsers</a> you can add it to the browser&#8217;s search box.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianoxley.com/2008/02/05/opensearch-added-to-unobtrusive-javascript-google-co-op-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

