<?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>Pontus Östlund &#187; Javascript</title>
	<atom:link href="http://www.poppa.se/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.poppa.se/blog</link>
	<description>My blog about web development and such</description>
	<lastBuildDate>Mon, 16 Jan 2012 00:38:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Building the accessible web</title>
		<link>http://www.poppa.se/blog/building-the-accessible-web/</link>
		<comments>http://www.poppa.se/blog/building-the-accessible-web/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 00:38:45 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[User Science]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ARIA]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google IO]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://www.poppa.se/blog/?p=565</guid>
		<description><![CDATA[As a web developer for a relatively large company that provide basic societal services with a wide ranged target group, accessibility has always interested me. I&#8217;ve been to a few workshops regarding web accessibility and I try to, at least to a lesser degree, make our web sites accessible to visitors using various types of [...]]]></description>
			<content:encoded><![CDATA[<p>As a web developer for a relatively large company that provide basic societal services with a wide ranged target group, accessibility has always interested me. I&#8217;ve been to a few workshops regarding web accessibility and I try to, at least to a lesser degree, make our web sites accessible to visitors using various types of accessibility tools like screen readers and so on.</p>
<p>Creating accessible web sites isn&#8217;t that hard as long as they are static. But the web isn&#8217;t static any more! As the web technology evolves we tend to make more dynamic web sites that are becoming more and more state full than the old and boring state less web. We do this with the help of JavaScript and <a href="http://en.wikipedia.org/wiki/AJAX">AJAX</a> to update a part or section of the page if the user clicks this or that button or what ever. And this makes it way harder to create accessible web sites for visitors not using a mouse to navigate or who can&#8217;t see the actual page.</p>
<p>But as the &#8220;regular&#8221; web technology evolves with <a href="http://en.wikipedia.org/wiki/HTML5">HTML5</a> and such, so does the accessibility part of the web as well. I just stumbled upon this great talk from <a href="http://www.google.com/events/io/2011/">Google IO 2011</a>, and I think this is something that every web developer who likes to call her or him self a web developer should see. At least I know what I will do the next couple of weeks! With some really small efforts we can make the web much more accessible for people with various impairities.</p>
<div><iframe width="680" height="376" src="http://www.youtube.com/embed/lMrkCoqgoxw" frameborder="0" allowfullscreen></iframe></div>
<p>And I encourage every web developer to follow the <a href="http://www.youtube.com/user/GoogleDevelopers/">Google Developer Channel</a> at <a href="http://youtube.com">Youtube</a>. There&#8217;s a lot of good stuff there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poppa.se/blog/building-the-accessible-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript minifier filter module for Roxen</title>
		<link>http://www.poppa.se/blog/javascript-minifier-filter-module-for-roxen/</link>
		<comments>http://www.poppa.se/blog/javascript-minifier-filter-module-for-roxen/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 12:17:46 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Pike]]></category>
		<category><![CDATA[Roxen]]></category>

		<guid isPermaLink="false">http://www.poppa.se/blog/?p=441</guid>
		<description><![CDATA[Nowadays web sites and web applications tend to be more and more JavaScript driven which results in humongous JavaScript files. It&#8217;s not uncommon to have several 100 of bytes of JavaScript on a site. Of course web browsers cache stuff like JavaScript so that it only is requested from the server once. But judging from [...]]]></description>
			<content:encoded><![CDATA[<p>Nowadays web sites and web applications tend to be more and more JavaScript driven which results in humongous JavaScript files. It&#8217;s not uncommon to have several 100 of bytes of JavaScript on a site. Of course web browsers cache stuff like JavaScript so that it only is requested from the server once. But judging from the visitor logs at work most people only visit our site once a month or so which means that cache will expire and all those scripts has to be requested upon the first visit.</p>
<p>Now, there are several ways to compact JavaScripts: <a href="http://dean.edwards.name/packer/">Packer</a>, <a href="http://yuilibrary.com/downloads/#yuicompressor">YUI Compressor</a>, <a href="http://shrinksafe.dojotoolkit.org/">Shrink Safe</a>, <a href="http://www.crockford.com/javascript/jsmin.html">jsmin</a> and many more. Some of these just remove redundant white space and comments, some obfuscates the code and shortens variable and function names and what not. Many of these scripts and programs are very fine but they require you to manually minify your scripts, and that&#8217;s just a hassle! </p>
<p>But since we use <a href="http://www.roxen.com">Roxen</a> CMS at work things get much easier if you write your own <em>Roxen filter module</em> which automatically minifies JavaScripts on the fly, given they meet certain criteria. And so I did!</p>
<p>I ported the original <a href="http://www.crockford.com/javascript/jsmin.html">jsmin</a> code written in C to <a href="http://pike.ida.liu.se">Pike</a>. Then it was just a matter of creating a simple filter module for Roxen. And then it was all done.</p>
<p>You can use two criteria to determine if a script should be minified or not:</p>
<ol>
<li><strong>Path glob:</strong> In the module settings you can specify any number of directory globs or full paths. If a requested JavaScript either is in a directory matching a glob or is a direct match it will be minified.</li>
<li><strong>Query string variable:</strong> In the module settings you can define a variable name that if exists as a query string variable in the request the JavaScript will be minified. So:
<pre>&lt;script type="text/javascript" src="myscript.js?jsmin=1"&gt;&lt;/script&gt;</pre>
<p>will minify <code>myscript.js</code></li>
</ol>
<p>And that&#8217;s that!</p>
<p><a href="/blog/data/scripts/jsmin.pike">jsmin Roxen filter module</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poppa.se/blog/javascript-minifier-filter-module-for-roxen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JavaScript URI class</title>
		<link>http://www.poppa.se/blog/javascript-uri-class/</link>
		<comments>http://www.poppa.se/blog/javascript-uri-class/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 17:31:22 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Vala]]></category>

		<guid isPermaLink="false">http://www.poppa.se/blog/?p=319</guid>
		<description><![CDATA[The other day I needed an URI class for JavaScript. I was doing some stuff where I needed to alter certain parts of an URI. I bet there&#8217;s a couple of URI classes for JavaScript out there but I can be a bit nit-picky about code and how it&#8217;s written  
Anyway, I had a [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I needed an URI class for JavaScript. I was doing some stuff where I needed to alter certain parts of an URI. I bet there&#8217;s a couple of URI classes for JavaScript out there but I can be a bit nit-picky about code and how it&#8217;s written <img src='http://www.poppa.se/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Anyway, I had a URI parser <acronym title="Regular Expression">regexp</acronym> lying which I wrote for a <a href="http://live.gnome.org/Vala/">Vala</a> class (before I found the <code>Soup.URI</code> class) and I thought that since that&#8217;s reusable I could hack up a JavaScript URI class myself. So I did!</p>
<p>Here&#8217;s some examples of usage:</p>
<pre><code lang="js">
var uri = new URI("http://poppa.se/blog/javascript-uri-class/");
console.log(uri.scheme); //-> http
console.log(uri.host);   //-> poppa.se
console.log(uri.path);   //-> /blog/javascript-uri-class/
console.log(uri.port);   //-> 80
</code></pre>
<p>Now, if we want to alter the host so that it contains <code>www</code> we do:</p>
<pre><code lang="js">
uri.host = "www.poppa.se";
console.log(uri.toString()); //-> http://www.poppa.se/blog/javascript-uri-class/
</code></pre>
<p>It&#8217;s also easy to alter query string variables:</p>
<pre><code lang="js">
var uri = new URI("http://host.com/?name=poppa&#038;lang=se");
uri.variables["name"] = 'Günther';
uri.variables["lang"] = 'de';
console.log(uri.toString()); //-> http://host.com/?name=Günther&#038;lang=de
</code></pre>
<p>And I think that&#8217;s pretty smooth <img src='http://www.poppa.se/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="https://raw.github.com/poppa/PlayStation/master/javascript/uri/uri.js" class="download github"><span>Download the URI class</span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poppa.se/blog/javascript-uri-class/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

