<?xml version="1.0" encoding="UTF-8"?>
<rss 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/" version="2.0">

<channel>
	<title>a pint of javascript (and general web stuff)</title>
	
	<link>http://blog.gonchuki.com</link>
	<description />
	<lastBuildDate>Tue, 06 Jul 2010 21:45:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/apintofjavascript" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="apintofjavascript" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Standards Compliancy is a lie (or, how all browsers have a broken border-radius)</title>
		<link>http://blog.gonchuki.com/archives/standards-compliancy-is-a-lie-or-how-all-browsers-have-a-broken-border-radius/</link>
		<comments>http://blog.gonchuki.com/archives/standards-compliancy-is-a-lie-or-how-all-browsers-have-a-broken-border-radius/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 16:56:25 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/?p=170</guid>
		<description><![CDATA[Day after day we see a new release from one of the major internet browser developers boasting how they comply with web standards and how they are targeting a gazillion of experimental features that no one cares about (I bet only 3% of web developers cared to study the bible of -webkit prefixes), yet except [...]]]></description>
			<content:encoded><![CDATA[<p>Day after day we see a new release from one of the major internet browser developers boasting how they comply with web standards and how they are targeting a gazillion of experimental features that no one cares about (I bet only 3% of web developers cared to study the bible of -webkit prefixes), yet except for Firefox* all of them get border-radius completely wrong (Firefox actually has a minor annoyance but it&#039;s bearable). Can you say you are standards-compliant if you have a broken implementation?<br />
<span id="more-170"></span></p>
<h3 class="section">a little back story</h3>
<p>A few months ago, the <a href="http://blogs.msdn.com/b/ie/archive/2010/03/19/the-css-corner-about-css-corners.aspx"><acronym title="Internet Explorer">IE</acronym> Blog showcased some IE9 goodness</a> and made a call to action for better border-radius implementations. They rightfully shown how they are getting it right this time, and how most other browsers out there are broken, with Safari/Chrome (Webkit) being the worst still at the time of writing this article. But not everything in their implementation is correct, IE9 pre 3 still exhibits the same issue as the other browsers that I&#039;m presenting today.</p>
<h3 class="section">the big bug theory</h3>
<p>So what&#039;s the issue with border-radius? simple answer: the background color bleeds behind the radius when you also have a border in the same element.<br />
Let&#039;s first use a real world example of a live site that paradoxically exposes the bug: <a href="http://playground.html5rocks.com/">HTML5 Rocks Playground</a></p>
<div class="center"><img src="http://sandbox.gonchuki.com/border-radius/chrome5-firefox.png" alt="Chrome 5 vs. Firefox" /><span class="caption">Chrome 5.0.375.99 on the left, Firefox 3.6.6 on the right, Windows 7 with ATI X300</span></div>
<p><strong>See the blue garbage on the rounded corner?</strong> that&#039;s what most browsers do.</p>
<p>Now, to rule out a possible specific software/hardware combination, I went thru several test machines and browsers to see if the bug was repeatable:</p>
<div class="center showcase_img">
<img src="http://sandbox.gonchuki.com/border-radius/fx_366_winxp_ati4850.png" alt="" /><img src="http://sandbox.gonchuki.com/border-radius/chrome_5_winxp_ati4850.png" alt="" /><img src="http://sandbox.gonchuki.com/border-radius/opera_1060_winxp_ati4850.png" alt="" /><img src="http://sandbox.gonchuki.com/border-radius/chrome_5_ubuntu_vbox.png" alt="" /><img src="http://sandbox.gonchuki.com/border-radius/ie_9pre3_win7_intel.png" alt="" /><img src="http://sandbox.gonchuki.com/border-radius/chrome_6_winxp_8600.png" alt="" /><img src="http://sandbox.gonchuki.com/border-radius/chrome_6_win7_intel.png" alt="" /><img src="http://sandbox.gonchuki.com/border-radius/safari_5_winxp_ati.png" alt="" />
</div>
<p></p>
<h3 class="section">reproducing the bug</h3>
<p>So how hard is to reproduce the bug? sadly, not at all. Here&#039;s the base recipe for disaster:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f00</span><span style="color: #00AA00;">;</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span></pre></td></tr></table></div>

<style type="text/css">
div.border-radius-box {
border: 3px solid #999; background-color: #f80; float: left; width: 60px; height: 60px; margin: 0 7px;
}
div.box-2  { background-color: #0fa; -moz-border-radius: 5px;-webkit-border-radius: 5px; border-radius: 5px; }
div.box-3  { background-color: #f3a; -moz-border-radius: 10px;-webkit-border-radius: 10px; border-radius: 10px; }
div.box-4  { background-color: #1a0; -moz-border-radius: 15px;-webkit-border-radius: 15px; border-radius: 15px; }
div.box-5  { background-color: #07f;  -moz-border-radius: 20px;-webkit-border-radius: 20px; border-radius: 20px;}
div.box-6  { background-color: #f00;  -moz-border-radius: 25px;-webkit-border-radius: 25px; border-radius: 25px; }
div.box-7  { background-color: #377;  -moz-border-radius: 30px;-webkit-border-radius: 30px; border-radius: 30px; }
div.box-outer  { background-color: #999; padding: 3px; border: 0 none; }
div.box-inner  { border: 0 none; margin: 0; -moz-border-radius: 23px;-webkit-border-radius: 23px; border-radius: 23px;  }
.showcase_img img { margin: 5px 10px; border: 1px solid #ddd; }
</style>
<div class="border-radius-box"></div>
<div class="border-radius-box box-2"></div>
<div class="border-radius-box box-3"></div>
<div class="border-radius-box box-4"></div>
<div class="border-radius-box box-5"></div>
<div class="border-radius-box box-6"></div>
<div class="border-radius-box box-7"></div>
<p><br style="clear: left;" /><br />
zooming-in the issue:</p>
<div class="center"><img src="http://sandbox.gonchuki.com/border-radius/fx_366_demo.png" alt="" /><span class="caption">Firefox 3.6.6</span></div>
<p></p>
<div class="center"><img src="http://sandbox.gonchuki.com/border-radius/chrome_5_demo.png" alt="" /><span class="caption">Chrome 5</span></div>
<p></p>
<div class="center"><img src="http://sandbox.gonchuki.com/border-radius/opera_1060_demo.png" alt="" /><span class="caption">Opera 10.60</span></div>
<p></p>
<div class="center"><img src="http://sandbox.gonchuki.com/border-radius/ie_9pre3_demo.png" alt="" /><span class="caption">IE9 pre 3</span></div>
<p>given the previous example and screenshots, you might have noticed the other issue: <strong>Firefox is not actually bug-free.</strong> It has a slight issue blending the element background with the border. it&#039;s not as bad as the bleeding issue, but it&#039;s still annoying. Also from the previous set and this one, we notice how the IE9 and Opera 10.60 implementations are an order of magnitude better than what Webkit achieves.</p>
<h3 class="section">finding a work-around</h3>
<p>As you might have guessed, the only reliable work-around to date is nesting rounded elements when you need a distinctly colored border. Using padding on the outer box equal to the border-width required does the trick and works across all browsers:</p>
<div class="border-radius-box box-6 box-outer">
<div class="border-radius-box box-6 box-inner"></div>
</div>
<p>Of course it&#039;s not all fun and games, <strong>you need to specify a different border-radius for the inner box</strong> as they both have different sizes. In this case, the outer box has 25px while the inner one has 23px.<br style="clear: left;" /></p>
<p><strong>Can we stop with the pain already?</strong> How many years have passed since the first border-radius implementation and they are still getting it wrong?<br />
this is how I feel about the current state of border-radius:</p>
<div class="center"><img src="http://sandbox.gonchuki.com/border-radius/doin_it_wrong.jpg" alt="" /></div>
<p><strong>Can every browser get it right before boring us once again with their endless speech on how shiny and compliant they are?</strong> It&#039;s not <a href="http://farscape.wikia.com/wiki/Frell">frelling</a> rocket science.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/standards-compliancy-is-a-lie-or-how-all-browsers-have-a-broken-border-radius/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTML5 vs Flash take 2: what Steve Jobs doesn't want you to know</title>
		<link>http://blog.gonchuki.com/archives/html5-vs-flash-take-2-what-steve-jobs-doesnt-want-you-to-know/</link>
		<comments>http://blog.gonchuki.com/archives/html5-vs-flash-take-2-what-steve-jobs-doesnt-want-you-to-know/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 17:30:27 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/?p=134</guid>
		<description><![CDATA[Dear Steve Jobs: you don&#039;t have a clue.


Important:
This article is a follow up on 6 reasons why the &#034;HTML5 vs. Flash&#034; debate is idiotic, if you haven&#039;t read that article yet, it&#039;s strongly recommended that you do.

the sheeple herder has spoken
Today, April 29th 2010, our dearest dictator ruler decided to publish a pedantic article on [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Steve Jobs: you don&#039;t have a clue.<br />
<span id="more-134"></span></p>
<div class="big_sign notice">
<h3>Important:</h3>
<p>This article is a follow up on <a href="http://blog.gonchuki.com/archives/6-reasons-why-the-html5-vs-flash-debate-is-idiotic/">6 reasons why the &#034;HTML5 vs. Flash&#034; debate is idiotic</a>, if you haven&#039;t read that article yet, it&#039;s strongly recommended that you do.</p>
</div>
<h3 class="section">the sheeple herder has spoken</h3>
<p>Today, April 29th 2010, our dearest <del datetime="2010-04-29T15:21:32+00:00">dictator</del> <abbr title="Steve Jobs">ruler</abbr> decided to publish a <a href="http://www.apple.com/hotnews/thoughts-on-flash/">pedantic article on why he won&#039;t let Flash run on their mobile devices</a>. It&#039;s a nice read if you want to take a laugh or two, but at the end if you read between lines he will just self-promote his products based on false premises. I will be analyzing his speech on this post so it&#039;s not fully required to read his article first.</p>
<h3 class="section">at first I was like&#8230;</h3>
<p>In <a href="http://blog.gonchuki.com/archives/6-reasons-why-the-html5-vs-flash-debate-is-idiotic/">my recent article</a> I made a lot of things clear so that reading the aforementioned Steve Jobs article will be easier on your feelings. Thankfully, the article also warns people about the weak arguments that HTML5 fundamentalists are trying to push, ignoring every weakness of the spec.</p>
<h3 class="section">&#8230;but then I lol&#039;d</h3>
<p>now on to the analysis:</p>
<blockquote><p>First, there&#039;s &#034;Open&#034;.</p>
<p>Adobe&#039;s Flash products are 100% proprietary. They are only available from Adobe, and Adobe has sole authority as to their future enhancement, pricing, etc. While Adobe’s Flash products are widely available, this does not mean they are open, since they are controlled entirely by Adobe and available only from Adobe. By almost any definition, Flash is a closed system.</p></blockquote>
<p>Wrong.<br />
As stated in comments of my previous article only the &#034;official&#034; Flash plugin is proprietary, however <a href="http://www.adobe.com/devnet/swf/">the specs for running .swf content are open</a> and there&#039;s even an <a href="http://github.com/tobeytailor/gordon">open source Flash Player</a> implementation using Javascript+<acronym title="Scalable Vector Graphics">SVG</acronym> and <a href="http://osflash.org/open_source_flash_projects">tons of open source tools</a> for creation and running of SWF content.<br />
As for the rest of the components, the <acronym title="Virtual Machine">VM</acronym> responsible for interpreting ActionScript is Open Source (<a href="http://www.mozilla.org/projects/tamarin/">Tamarin</a>), and even the Flex SDK goes for free and is Open Source, so <strong>there&#039;s absolutely no charge for creating SWF content</strong>. Zero, <i>gratis</i>.</p>
<p>The only thing that Adobe charges for is the Flash IDE, the one that eases creation of content, the one that <strong>no one using HTML5 technologies has yet</strong>, and might take a few years until someone creates one comparable to what the Flash IDE allows you to do.</p>
<blockquote><p>Second, there&#039;s the &#034;full web&#034;.</p>
<p>Adobe has repeatedly said that Apple mobile devices cannot access “the full web” because 75% of video on the web is in Flash. What they don’t say is that almost all this video is also available in a more modern format, H.264, and viewable on iPhones, iPods and iPads.<br />
[snip]<br />
Another Adobe claim is that Apple devices cannot play Flash games. This is true. Fortunately, there are over 50,000 games and entertainment titles on the App Store, and many of them are free. There are more games and entertainment titles available for iPhone, iPod and iPad than for any other platform in the world.
</p></blockquote>
<p>Yet H.264 is not part of HTML5, <a href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-June/020620.html">or is it</a>? let me clear this for you, <a href="http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Patent_licensing">H.264 has royalty fees</a>, ones that you are paying when you buy an iProduct but don&#039;t really notice, and <strong>Apple is the only vendor opposing the adoption of Ogg Theora as a de-facto video format</strong>. <a href="http://arstechnica.com/open-source/news/2009/07/decoding-the-html-5-video-codec-debate.ars">This article from Ars Technica</a> has a very complete explanation on the points against Ogg Theora that Apple is trying to shove in the face of their users.</p>
<p>About the games, I&#039;m not keeping tabs but the number of Flash games easily dwarfs any number that Steve Jobs can throw. Even if you remove low quality games from both platforms, Flash would still be the clear winner.</p>
<blockquote><p>Third, there&#039;s reliability, security and performance.</p>
<p>Symantec recently highlighted Flash for having one of the worst security records in 2009. We also know first hand that Flash is the number one reason Macs crash. We have been working with Adobe to fix these problems, but they have persisted for several years now. We don’t want to reduce the reliability and security of our iPhones, iPods and iPads by adding Flash.</p></blockquote>
<p>Weak argument Mr. Jobs, Adobe has been working hard on Flash and the upcoming 10.1 rewrites history by fixing every problem that previous versions had on the Mac. They even try to use the most advanced rendering mode in Mac OS X, but <a href="http://www.kaourantin.net/2010/02/core-animation.html">dictatorial resolutions by Apple avoid third-party applications from accessing the fastest rendering path</a>. Does this ring a bell? oh yeah, <a href="http://www.tuaw.com/2010/04/07/apple-rejects-ipad-app-for-pinch-to-expand/">the App Store review team can reject your app for using a &#034;pinch to zoom&#034; gesture</a>.</p>
<p>Maybe it&#039;s not entirely Adobe&#039;s fault. Yes they have they part, but <strong>Apple is doing a terrible job at helping them</strong>.</p>
<blockquote><p>Fourth, there’s battery life.</p>
<p>To achieve long battery life when playing video, mobile devices must decode the video in hardware; decoding it in software uses too much power. Many of the chips used in modern mobile devices contain a decoder called H.264 – an industry standard that is used in every Blu-ray <acronym title="Digital Video Disc">DVD</acronym> player and has been adopted by Apple, Google (YouTube), Vimeo, Netflix and many other companies.</p></blockquote>
<p><strong>Flash 10.1 also uses hardware acceleration for H.264</strong>, so this argument is soon to get outdated. But even if the argument was true, isn&#039;t the end user the one responsible for deciding which content is right for them? If I want to drain my battery watching some indie video (that was not created in H.264 as it&#039;s not open) then I should be able to do it. It&#039;s my right as a customer, and as a web user.</p>
<p>There&#039;s also <a href="http://www.zingchart.com/blog/2010/04/07/zingchart-plots-to-end-the-war-between-html5-and-flash-in-web-based-charting/">a nice article that compares HTML5 and Flash performance</a> for a data graphing application. The results are not surprising: <strong>HTML5/Canvas is slower than Flash in many cases</strong>, and that translates to higher battery power usage. [<a href="http://www.craftymind.com/guimark2/">another bench here</a>, comparing mostly raw synthetic speed]</p>
<blockquote><p>Fifth, there’s Touch.</p>
<p>Flash was designed for PCs using mice, not for touch screens using fingers. For example, many Flash websites rely on “rollovers”, which <acronym title="Short for POP3, the Post Office Protocol for email">POP</acronym> up menus or other elements when the mouse arrow hovers over a specific spot. Apple’s revolutionary multi-touch interface doesn’t use a mouse, and there is no concept of a rollover. Most Flash websites will need to be rewritten to support touch-based devices. If developers need to rewrite their Flash websites, why not use modern technologies like HTML5, <acronym title="Cascading Style Sheets">CSS</acronym> and JavaScript?</p></blockquote>
<p>There have been numerous propositions on how to fix the &#034;rollover&#034; issue in Flash for touch devices, yet Steve Jobs won&#039;t acknowledge them. The Flash-to-iPhone compiler demonstrated how you can make Flash content without piggybacking on rollovers to deploy an iPhone application that seems like native.</p>
<p>But the most hilarious argument is how <strong>Steve Jobs dictates that we rewrite all the Flash content in HTML5</strong>, will he pay for it? I bet it&#039;s a no.</p>
<blockquote><p>Sixth, the most important reason.</p>
<p>Besides the fact that Flash is closed and proprietary, has major technical drawbacks, and doesn’t support touch based devices, there is an even more important reason we do not allow Flash on iPhones, iPods and iPads. We have discussed the downsides of using Flash to play video and interactive content from websites, but Adobe also wants developers to adopt Flash to create apps that run on our mobile devices.</p>
<p>We know from painful experience that letting a third party layer of software come between the platform and the developer ultimately results in sub-standard apps and hinders the enhancement and progress of the platform. If developers grow dependent on third party development libraries and tools, they can only take advantage of platform enhancements if and when the third party chooses to adopt the new features. We cannot be at the mercy of a third party deciding if and when they will make our enhancements available to our developers.</p>
<p>This becomes even worse if the third party is supplying a cross platform development tool. The third party may not adopt enhancements from one platform unless they are available on all of their supported platforms. Hence developers only have access to the lowest common denominator set of features. Again, we cannot accept an outcome where developers are blocked from using our innovations and enhancements because they are not available on our competitor’s platforms.</p></blockquote>
<p>Yet developers are at the mercy of Apple and their App Store policy, in which case <strong>if</strong> an app gets accepted,<strong> it might have taken a month to reach end users</strong>. Isn&#039;t this the same as waiting a month till the middle-ware developer adopts the new features in Apple&#039;s SDK? The end user will suffer just the same.</p>
<p>Let&#039;s be sincere, <strong>Apple doesn&#039;t care about developers</strong> (see all of the above points), they just care about making money.</p>
<h3 class="section">conclusions</h3>
<p>Apple wants your money, and native Flash in Safari won&#039;t bring them any as people would have access to an immense gallery of <strong>free content</strong>, <a href="http://kongregate.com">tons of nice games</a> that would affect the economy of their App Store.<br />
Apple also wants to kill Flash, so they won&#039;t allow you to develop native apps using Flash for arbitrary reasons. They created a closed ecosystem where your only options are to do what they say or GTFO.</p>
<p>Their &#034;open&#034; idea is to control what developers do, in what programming language, and even what APIs or <a href="http://www.tuaw.com/2010/04/07/apple-rejects-ipad-app-for-pinch-to-expand/">touch gestures they use</a>. By killing the Flash cross-compiler they are also giving the finger to Windows, so <strong>developers will still need to buy a Mac to develop for their mobile platform</strong>.</p>
<p>What comes next Steve? Wanna dictate the amount of sugar that we put to our coffees while we code?</p>
<h3 class="section">addendum</h3>
<p>some interesting arguments on different views of this same subject have been popping during the day, I will be adding these and anything interesting that comes next as they are a good complement to my thoughts on this matter.</p>
<ul>
<li><a href="http://www.adambanks.com/wordpress/thoughts-on-thoughts-on-flash/">http://www.adambanks.com/wordpress/thoughts-on-thoughts-on-flash/</a></li>
<li><a href="http://billmackin.com/2010/04/a-response-to-steve-jobs-thoughts-on-flash/">http://billmackin.com/2010/04/a-response-to-steve-jobs-thoughts-on-flash/</a></li>
<li><a href="http://jessewarden.com/2010/04/steve-jobs-on-flash-correcting-the-lies.html">http://jessewarden.com/2010/04/steve-jobs-on-flash-correcting-the-lies.html</a></li>
<li><a href="http://www.icodeflash.com/flashblog/?p=63">http://www.icodeflash.com/flashblog/?p=63</a></li>
<li><a href="http://uza.lt/blog/2010/04/my-take-html5-vs-flash/">http://uza.lt/blog/2010/04/my-take-html5-vs-flash/</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/html5-vs-flash-take-2-what-steve-jobs-doesnt-want-you-to-know/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>6 reasons why the "HTML5 vs. Flash" debate is idiotic</title>
		<link>http://blog.gonchuki.com/archives/6-reasons-why-the-html5-vs-flash-debate-is-idiotic/</link>
		<comments>http://blog.gonchuki.com/archives/6-reasons-why-the-html5-vs-flash-debate-is-idiotic/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 17:50:48 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/?p=77</guid>
		<description><![CDATA[Ladies and Gentlemen, welcome to the world of the sad truth you didn&#039;t want to read. Today is the day to settle once and for all the moot debate around &#034;HTML5 vs. Flash&#034;. The vicious debate that is clogging the intertubes is utterly pointless, yet still there&#039;s a big crowd of fundamentalists that don&#039;t get [...]]]></description>
			<content:encoded><![CDATA[<p>Ladies and Gentlemen, welcome to the world of the sad truth you didn&#039;t want to read. Today is the day to settle once and for all the moot debate around &#034;HTML5 vs. Flash&#034;. The vicious debate that is clogging the intertubes is utterly pointless, yet still there&#039;s a big crowd of fundamentalists that don&#039;t get why.</p>
<p>Let&#039;s put some nails in the idiotic debate coffin.</p>
<p><span id="more-77"></span></p>
<ol>
<li>
<h4 class="subsection bad">The HTML5 spec won&#039;t be ready for consumption for at least another 2 years.</h4>
<p>You avid HTML5 advocate, do you really have any idea on the actual HTML5 roadmap? Well, it&#039;s not <a href="http://wiki.whatwg.org/wiki/FAQ#When_will_HTML5_be_finished.3F">until 2012 that it will reach Candidate status</a> (an important milestone, which like in any software determines when all features are ready and only testing and minor bugs remain), and sometime around 2022 that it will be finally settled as an official <acronym title="World Wide Web Consortium">W3C</acronym> recommendation.</p>
<p><strong>What this means:</strong> whatever code you write based on today&#039;s working draft version of the specs is not assured to work in 2012. Yes, there are lots of sections on &#034;last call for comments&#034; status, but that also means a strong argument on said sections could potentially introduce a major breaking change over any current concept code you already wrote.</p>
</li>
<li>
<h4 class="subsection bad">Flash is a mature platform, HTML5 is just in its initial implementation phase.</h4>
<p>Let&#039;s face it, like it or not browser vendors haven&#039;t yet adopted every part of the current working draft. There are sections that were sitting for over two years in the spec (more specific, the form elements) and those haven&#039;t been yet fully implemented by any vendor. Having more browsers in play also doesn&#039;t help, as even Chrome&#039;s WebKit version doesn&#039;t behave exactly the same as Safari&#039;s version in regards of HTML5 completeness (or accuracy, for that matter).</p>
<p>We have at least a good one full year before mainstream browsers implement enough of the HTML5 spec to call it a stable and usable implementation. You can <a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML_5%29">check over on Wikipedia</a> to see a fairly well updated list on current support for the various HTML5 components, or you can even <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/index.html">check the working draft maintained by WHATWG</a> where each point of the spec is accompanied by a tool-tip displaying the level of support provided by each major rendering engine.</p>
</li>
<li>
<h4 class="subsection bad">Flash is made by a single vendor, HTML5 sees duplicate efforts by at least 5 different companies on at least 4 different platforms.</h4>
<p>Love it or hate it, Adobe is the only single vendor responsible of developing the Flash player. Yes, it might fail miserably on Linux for some use cases or cause unexpected crashes in Mac OS X, but the behavior is consistent. This single unified implementation is what web developers are desperately looking for.</p>
<p>HTML5 doesn&#039;t bring anything new compared to current HTML4/XHTML in regards of consistency. We will still be suffering from testing our sites across different browsers, operating systems and mobile devices. <strong>HTML5 won&#039;t steal the world&#039;s smallest violin from us</strong>, we will still play it to the end of the days. Yes, consistency across vendors is getting better every day, yet you will never experience the same exact representation in every one of them (that will be the day we only have one single browser to rule them all).</p>
<p>And don&#039;t get me started about the <var>&lt;audio&gt;</var> and <var>&lt;video&gt;</var> tags issue, the h264 vs Theora (or AAC vs Vorbis) debate is like the <var>&lt;blink&gt;</var> vs <var>&lt;marquee&gt;</var> nightmare all over again. The only current solution with HTML5 is the same as with Flash: target a single platform and your creation will work flawlessly.</p>
</li>
<li>
<h4 class="subsection bad">Flash is built as a multimedia and animation platform, HTML5 is a progressive enhancement over a content centric and descriptive language</h4>
<p>In case the title is not self-explanatory, or you still don&#039;t get the point: <strong>HTML5 is *not* a gaming platform nor its design was centered around building banners or vectorial animations</strong>.</p>
<p><strong>Want to cite Canvas?</strong> moot point, there are lots of options for layer compositing and using matrix transformations on bitmaps, yet it still falls short compared to Flash. Also notable are the lack of brightness/contrast/tint operations, and the lack of a native vector animation <acronym title="Application Programming Interface">API</acronym>.<br />
<strong>Want to cite WebGL?</strong> another moot point, WebGL isn&#039;t anything but a glorified &#034;native&#034; plugin that&#039;s not different from running the <a href="http://unity3d.com/webplayer/">Unity 3D plugin</a>: a rectangular viewport embedded inside your browser that talks directly with your GPU and has nothing to do with content or information <i>per-se</i>. Writing stuff for WebGL isn&#039;t any different than writing it for a standalone OpenGL viewport.</p>
</li>
<li>
<h4 class="subsection bad">Flash is good at what Flash does, HTML5 is good at what <acronym title="HyperText Markup Language">HTML</acronym> does</h4>
<p>You get it now? It&#039;s not like Flash is bundled with an IDE resembling an animation studio for nothing, or that the only reliable way to build a good piece of <acronym title="HyperText Markup Language">HTML</acronym> code is by hand coding for arbitrary reasons. Both are strong at what they do, but you need to understand that <var>&lt;canvas&gt;</var>, <var>&lt;video&gt;</var>, <var>&lt;audio&gt;</var> and the likes are just the &#034;nice to have&#034; in HTML5 and not the core itself. Heck, <strong>HTML5 can&#039;t even access the system&#039;s camera/microphone</strong> so there&#039;s absolutely no way to develop sites like <a href="http://tinychat.com">tinychat</a> or <a href="http://justin.tv">justin.tv</a> without requiring the end-user to install additional software to be able to communicate.<br />
This issue even gets magnified in the iPhone/iPad world, where you can only distribute such kind of software via the app store. An update for your chat app could even take a month to reach your end users!</p>
<p>As much as your zealot HTML5 advocacy urges you to debate about how *this* and *that* can be replicated using HTML5, one day you will realize that even trivial tasks in Flash like adding bones to an object (LMGTFY: <a href="http://www.google.com/search?q=inverse+kinematics">Inverse Kinematics</a>) can and will take enormous amounts of effort and time using whatever raw tool the Canvas+Javascript world provides you.</p>
<p>Yet again, don&#039;t fall in the trap of citing &#034;framework X uses Canvas and has support for inverse kinematics&#034; because you are back at square zero: depending on a third party vendor to add features/fix bugs so you can work on top of it.<br />
Are you aware you are already suffering from this with the video tag? These <a href="http://jilion.com/sublime/video">two</a> <a href="http://www.projekktor.com/">examples</a> just show how the native browser implementation is so barebones that you have to build an entire wrapper around the object.</p>
</li>
<li>
<h4 class="subsection bad">The Flash vs. HTML5 argument will implode after every Flash feature is ported into an HTML5/Canvas equivalent</h4>
<p><strong>So you don&#039;t like Flash Ads?</strong> say hello to <a href="http://www.apple.com/iphone/preview-iphone-os/">iAd</a>. As annoying as before, but you can&#039;t Flash-block or Ad-Block it as it can be served from within your very own <acronym title="Document Object Model">DOM</acronym> tree. Say hello to popunders with video, sound and flying colors.<br />
<strong>Flash is not accessible?</strong> then let me know how your Canvas or WebGL piece is in any way more accessible.<br />
<strong>Flash is a closed source platform?</strong> to certain extent, all the tools you will be using to &#034;compete&#034; against Flash will ultimately seem like closed source to you. You can only hack on so many projects at once. To make it worse, the browser upgrade cycle takes a lot more time than Flash and a buggy implementation might stay on the market for even 10 or more years (o hai IE6).<br />
<strong>Flash is slow and eats CPU time?</strong> Javascript is the same, and will even be slower as you will be running those framework layers over the Javascript <acronym title="Virtual Machine">VM</acronym> instead of running it as native compiled code.</p>
</li>
</ol>
<h3 class="section">Conclusions</h3>
<p>To quickly summarize the article, <strong>you must understand that Flash and HTML5 are completely different things</strong>. They share a lot of features, yet each technology remains so unique that both will stay in the market for many years to come. Neither the <strong>one-sided push from Apple</strong> nor the fanatic zealotry of HTML5 advocates will take Flash out of the market. But if one thing is certain,<strong> the days of using Flash for trivial tasks that *do* require accessibility are over</strong>. The bad side of Flash is not the product itself, it&#039;s developers misusing it for tasks it was not intended to do.</p>
<p>Let&#039;s continue using Flash for delivering heavy animations and interactive content, and of course <strong>try to avoid it at all times when there&#039;s an usability and accessibility friendly alternative</strong> be it using current (X)<acronym title="HyperText Markup Language">HTML</acronym>+Javascript or using the new HTML5 tools as soon as they are ready. Our friends from <a href="http://mootools.net">Mootools</a>, <a href="http://jquery.com">jQuery</a> and the likes are already doing their part to eradicate Flash from what is rightfully the <acronym title="HyperText Markup Language">HTML</acronym> domain.</p>
<div class="big_sign notice">
<p class="center"><a href="http://blog.gonchuki.com/archives/html5-vs-flash-take-2-what-steve-jobs-doesnt-want-you-to-know/">A follow up of this article has been posted on April 29th 2010</a>.<br /> The comments section for this post will remain closed in favor of moving the discussion to the new article.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/6-reasons-why-the-html5-vs-flash-debate-is-idiotic/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>CSS Sprites2 – It's MooTools Time</title>
		<link>http://blog.gonchuki.com/archives/css-sprites2-its-mootools-time/</link>
		<comments>http://blog.gonchuki.com/archives/css-sprites2-its-mootools-time/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 17:29:20 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[sprites]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/?p=34</guid>
		<description><![CDATA[A few months ago you may have read Dave Shea&#039;s entry on A List Apart &#034;CSS Sprites2 &#8211; It&#039;s JavaScript Time&#034; where he implemented a variant of his own CSS Sprites article by adding jQuery based animations. In this same article Dave encouraged us [developers] to port it to other libraries, so after a few [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago you may have read <a href="http://www.mezzoblue.com/">Dave Shea</a>&#039;s entry on A List Apart &#034;<a href="http://www.alistapart.com/articles/sprites2"><acronym title="Cascading Style Sheets">CSS</acronym> Sprites2 &#8211; It&#039;s JavaScript Time</a>&#034; where he implemented a variant of his own <a href="http://www.alistapart.com/articles/sprites"><acronym title="Cascading Style Sheets">CSS</acronym> Sprites</a> article by adding <a href="http://jquery.com">jQuery</a> based animations. In this same article Dave encouraged us [developers] to port it to other libraries, so after a few months of inactivity I&#039;m back with the <a href="http://mootools.net">MooTools</a> port of this slick effect.<br />
<span id="more-34"></span></p>
<link rel="stylesheet" type="text/css" href="http://sandbox.gonchuki.com/sprites2/sprites2.css" media="all" />
<h3 class="section">Enter the MooTools</h3>
<p>While the original version used jQuery (1.2.6 at that time) and lots of people like it, we (mootoolers) have a different approach to code specially emphasizing on OOP techniques and readability. Part of the issue might not be jQuery per-se and be Dave&#039;s code that was a little obfuscated, but it anyways has a lot of room for improvement.<br />
This article will just describe differences between the MooTools implementation and the Dave&#039;s jQuery one, so unless stated otherwise, everything from the ALA article applies here.</p>
<h3 class="section">enter the Sprites2 class</h3>
<p>Part of the requirements I imposed myself when porting to MooTools was that it had to be easier to use than the jQuery version, and that it should give a certain degree of flexibility to extend the possible transition effects.<br />
End result is a class intuitively named Sprites2, where you gracefully pass named parameters:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">new</span> Sprites2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>mode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'fade'</span><span style="color: #339933;">,</span> item_selector<span style="color: #339933;">:</span> <span style="color: #3366CC;">'ul.nav a'</span><span style="color: #339933;">,</span> duration<span style="color: #339933;">:</span> <span style="color: #CC0000;">250</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

Now that&#039;s classy! [stupid pun, I know]<br />
Notice that these parameters above are the class defaults, so you could have just as easily used <var>new Sprites2();</var> and the end result would be the same.</p>
<h3 class="section">changes to original code and idea</h3>
<p>Apart from moving the code to a class, a change to note is the removal of the :active state from the <acronym title="Cascading Style Sheets">CSS</acronym> and the <var>setActive</var> parameter in the <acronym title="JavaScript">JS</acronym> code. This was mostly a personal preference as the :active pseudo-class created a few issues when holding the mouse on the element and releasing outside of it. Other notable changes in the <acronym title="Cascading Style Sheets">CSS</acronym> are the simplification of the implementation/adaptation process by using a simpler approach on the styles (for example, using <var>height:100%;</var> where applicable instead of <a href="http://www.alistapart.com/d/sprites2/examples/example-script.css">redefining height:48px; 5 times in the <acronym title="Cascading Style Sheets">CSS</acronym></a>).</p>
<p>MooTools also has a free &#034;upgrade&#034; built-in: animations have an internal state so that if you roll out from the element and enter it again, the transition will continue to run smoothly. In contrast, jQuery version (may be by code design, maybe because of a library limitation) flickers madly when you roll over and out of the element repeatedly with an interval less than the effect duration.</p>
<p>Also to note, and as mentioned, the Sprites2 class can be easily extended outside of the sprites2.js file with just a few lines of code to create for example a horizontal slide effect:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">Sprites2.<span style="color: #660066;">implement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  effects<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    slide_x<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>fx_element<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      fx_element.<span style="color: #660066;">store</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'width'</span><span style="color: #339933;">,</span> fx_element.<span style="color: #660066;">getSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setStyles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'width'</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">show_fn</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>fx_element<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> fx_element.<span style="color: #660066;">tween</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'width'</span><span style="color: #339933;">,</span> fx_element.<span style="color: #660066;">retrieve</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'width'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hide_fn</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>fx_element<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> fx_element.<span style="color: #660066;">tween</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'width'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>and you can start using it right away with <var>new Sprites2({mode: &#039;slide_x&#039;});</var>. This obviously works any way you want, as you can manually add or remove the effects directly in the source file.</p>
<h3 class="section">download, full demo and requirements</h3>
<p>The example here is running on a standard <a href="http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js">google hosted version of mootools 1.2.1</a>. For those of you that use custom builds, just be sure to add FX.Tween and FX.Morph to your standard array of includes (morph is only used by the &#034;animate&#034; effect, so if you don&#039;t use that one you can exclude it.)</p>
<p><a href="http://sandbox.gonchuki.com/sprites2/sprites2_moo.html">View full online demo</a></p>
<p><a href="http://sandbox.gonchuki.com/sprites2/sprites2.zip" rel="download" class="download">Download Sprites2</a> for MooTools [zip].</p>
<p><strong>new!</strong> &#8211; by popular demand (not really), I have just set-up a git repo so you can fork the latest source: <a href="http://github.com/gonchuki/sprites2-moo">http://github.com/gonchuki/sprites2-moo</a></p>
<p><strong>License:</strong> <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a><br />
<small>disclaimer: original code did not contain any license whatsoever (like all ALA code), so I assumed a CC share-alike license applies perfectly in this case.</small><br />]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/css-sprites2-its-mootools-time/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>updating moopop for mootools 1.2</title>
		<link>http://blog.gonchuki.com/archives/updating-moopop-for-mootools-12/</link>
		<comments>http://blog.gonchuki.com/archives/updating-moopop-for-mootools-12/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 02:37:31 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[moopop]]></category>
		<category><![CDATA[mootools 1.2]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/?p=22</guid>
		<description><![CDATA[After several requests to update the script, I finally had time to make the update. In fact the script was under production for more than a month running over mootools SVN builds. The update also comes with a couple additions suggested by users, and also some optimizations thanks to the new mootools 1.2 element storage.

so&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>After several requests to update the script, I finally had time to make the update. In fact the script was under production for more than a month running over mootools SVN builds. The update also comes with a couple additions suggested by users, and also some optimizations thanks to the new mootools 1.2 <a href="http://blog.mootools.net/2008/1/22/Element_Storage">element storage</a>.</p>
<p><span id="more-22"></span></p>
<h3 class="section">so&#8230; what&#039;s new?</h3>
<p>the basic improvement is that the code now works with mootools 1.2, be warned that this actually *breaks* compatibility with mootools 1.11 so please use <a href="http://blog.gonchuki.com/archives/moopop-unobtrusive-popups-with-mootools/">the older version</a> if you haven&#039;t yet gone to 1.2</p>
<p>and then, what else?<br />
<strong>resizable windows</strong><br />
I got some requests for this feature, so it&#039;s here. Just mix a &#034;r&#034; parameter in this format: &#034;[600,400,r]&#034; and the popup window generated will be resizable.</p>
<p><strong>ability to reuse the same popup</strong><br />
the old moopop had a bad habit of creating a new popup window for each link and not offering an option to reuse the same window. now you can use the &#034;name&#034; attribute native to &lt;a&gt; tags to specify the target of the popup.</p>
<p><strong>defaulting to rel=&#034;popup&#034;</strong><br />
now you can just call moopop.captureByRel() without arguments and the script will default to the most common use case.</p>
<p><strong>under the hood&#8230;</strong><br />
optimized code a bit, and now it&#039;s using both element storage to avoid memory leaks and cleaner CSS2 selectors that got native in mootools 1.2</p>
<h3 class="section">documentation?</h3>
<p>yes sure, unless for the additions specified in this post, all documentation remains the same and you can get it either in <a href="http://blog.gonchuki.com/archives/moopop-unobtrusive-popups-with-mootools/">the original post</a>, or looking at the source of the uncompressed moopop 1.1</p>
<h3 class="section">download</h3>
<p>as with previous version, you just need Selectors and DomReady from the <a href="http://mootools.net/core">mootools core builder</a> and the rest of the dependencies are automatically selected.</p>
<p><a href="http://sandbox.gonchuki.com/moopop_1.1/moopop.js" rel="download" class="download">Download moopop 1.1</a> with documentation<br />
or<br />
<a href="http://sandbox.gonchuki.com/moopop_1.1/moopop_min.js" rel="download" class="download">Download minified version</a> without docs to save bandwidth.</p>
<p><strong>License:</strong> <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/updating-moopop-for-mootools-12/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>wordpress 2.5 – good idea, bad idea</title>
		<link>http://blog.gonchuki.com/archives/wordpress-25-good-idea-bad-idea/</link>
		<comments>http://blog.gonchuki.com/archives/wordpress-25-good-idea-bad-idea/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 16:04:19 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[metablogging]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/?p=21</guid>
		<description><![CDATA[Blog software upgrades are becoming more frequent than real content on this blog, so I guess it&#039;s a good time for a small review on WP 2.5. Let me start by telling this will be a mix on ranting, praising and random  bashing, so get tight on your seats and let&#039;s begin.

Navigation
Good Idea
The interface [...]]]></description>
			<content:encoded><![CDATA[<p>Blog software upgrades are becoming more frequent than real content on this blog, so I guess it&#039;s a good time for a small review on WP 2.5. Let me start by telling this will be a mix on ranting, praising and random  bashing, so get tight on your seats and let&#039;s begin.<br />
<span id="more-21"></span></p>
<h3 class="section">Navigation</h3>
<h4 class="subsection good">Good Idea</h4>
<p><strong>The interface overhaul.</strong> Old WordPress admin was really boring and suffered a lot from <a href="http://www.interaction-design.org/encyclopedia/featuritis_and_creeping_featurism.html">featuritis</a>, something that all big software suffers but the normal tendency is to redesign the interface when things get out of control. That time has come, and the new interface of the admin is really pleasant to use and almost perfectly organized.</p>
<h4 class="subsection bad">Bad Idea</h4>
<p><strong>The design tab should not be primary.</strong> Blogs don&#039;t change design as frequent as one changes it&#039;s own underwear (unless you are an extreme geek stereotype that doesn&#039;t even know the meaning of the word &#034;laundry&#034;, but that&#039;s a topic for another post). Even with the upgrade to 2.5, I guess I won&#039;t be touching that tab except for curiosity. The design tab should have been left at the top right, just next to settings and plugins.</p>
<h3 class="section">Plugins</h3>
<h4 class="subsection good">Good Idea</h4>
<p><strong>You can now upgrade plugins without manually uploading files.</strong> Great move, automatic upgrade of plugins is one of the most important functionalities that were missing. For heavy loaded blogs with tons of plugins this is a bless, no more downloading of the zip just to manually re-upload the files to the host.</p>
<div class="center append_to_top"><img src="http://blog.gonchuki.com/wp-content/uploads/2008/04/cforms_plugin.png" alt="new plugin upgrade interface" /><span class="caption">the new plugin upgrade interface</span></div>
<h4 class="subsection bad">Bad Idea</h4>
<p><strong>The plugin upgrade log screen is terrible, and the interface too</strong> I can not guess how they ended with this current screen, it&#039;s completely washed out and not really useful for the average Joe. I certainly expected a lot more from <a href="http://www.happycog.com">Happy Cog</a>. Worst part is, it would only have taken 5 minutes to give it proper styles and at least look like a real log screen.</p>
<div class="center"><img src="http://blog.gonchuki.com/wp-content/uploads/2008/04/upgrade_plugin.png" alt="bad idea, good idea" /><span class="caption">bad idea, good idea</span></div>
<h4 class="subsection great">A Better Idea</h4>
<p>While we are at it, here&#039;s another short suggestion: <strong>how about using ajax?</strong> click the upgrade link, a throbber replaces the link, and then a nice &#034;success&#034; status message replaces the whole row. <em>badabing!</em> that&#039;s what I would call a friendly one click upgrade process. I mean, is there a real need for Mr. Average Joe to read the log on what is happening in the background?</p>
<div class="center append_to_top"><img src="http://blog.gonchuki.com/wp-content/uploads/2008/04/plugin_ajax.png" alt="" /><span class="caption">Mr. Average Joe would be really pleased to see this happening!</span></div>
<p></p>
<h3 class="section">Widgetized Sidebar</h3>
<h4 class="subsection good">Good Idea</h4>
<p><strong>New widgets, and a usable new interface.</strong> The widgetized sidebar was one of the worst implemented features in previous wordpress versions, and (at least to me) it was kind of useless as I always ended manually editing de sidebar.php file. All that has ended with the new interface and I give it a great welcome.</p>
<h4 class="subsection bad">Bad Idea</h4>
<p><strong>The <acronym title="Really Simple Syndication">RSS</acronym> widget still comes with broken code.</strong> All the work you do on the front end is not good if you still keep the garbage at the back end. Is there a reason for one to want to have an orange background on the <acronym title="Really Simple Syndication">RSS</acronym> icon and make it be exactly 14&#215;14?</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">'background:orange;color:white;border:none;'</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">'14'</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">'14'</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">'$icon'</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">'RSS'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Hey Mr. WordPress, would you please let me customize my theme as I like?<br />
The outcome: I ended manually editing widgets.php (with a similarly hackish approach ^_^) to add my <a href="http://gonchuki.tumblr.com">tumblr garbage</a> to the sidebar.</p>
<h3 class="section">Final Words and Miscellanea</h3>
<p>All in all, WordPress 2.5 has been a great step forward. Other things I liked are the new option to have full text in the <acronym title="Really Simple Syndication">RSS</acronym> (I know I will have one more reader now, right? ;) ), the new compose screen is a lot cleaner, the permalink edit while creating the entry is a bless, and overall the admin interface just feels right. Let&#039;s hope however that next release comes with some more polishment as there are still lots of rough edges and they are not as complicated to solve. And let&#039;s not forget, <a href="http://blog.gonchuki.com/archives/the-perils-of-editing-a-wordpress-theme#undo">there&#039;s still no fricking undo</a>!</p>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/wordpress-25-good-idea-bad-idea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>moving to wordpress 2.3.3</title>
		<link>http://blog.gonchuki.com/archives/moving-to-wordpress-233/</link>
		<comments>http://blog.gonchuki.com/archives/moving-to-wordpress-233/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 20:28:25 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[misc]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/archives/moving-to-wordpress-233/</guid>
		<description><![CDATA[Easy and smooth, I moved today from Wordpress 2.2.1 to Wordpress 2.3.3. The &#039;bigger&#039; move to Mephisto or other blogging engine will still have to wait.
I have also taken the time to update plugins and enable caching, so everything should be going smoother from now on :)
Expect some new articles soon, I&#039;ve been very busy [...]]]></description>
			<content:encoded><![CDATA[<p>Easy and smooth, I moved today from Wordpress 2.2.1 to Wordpress 2.3.3. The &#039;bigger&#039; move to <a href="http://www.mephistoblog.com">Mephisto</a> or other blogging engine will still have to wait.</p>
<p>I have also taken the time to update plugins and enable caching, so everything should be going smoother from now on :)<br />
Expect some new articles soon, I&#039;ve been very busy lately but there are always stuff I would like to blog and share with the community.</p>
<p>/gonchuki</p>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/moving-to-wordpress-233/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>usability 101: adding a global "back to top" to your site</title>
		<link>http://blog.gonchuki.com/archives/usability-101-adding-a-global-back-to-top-to-your-site/</link>
		<comments>http://blog.gonchuki.com/archives/usability-101-adding-a-global-back-to-top-to-your-site/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 19:26:04 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[accessibility]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/archives/usability-101-adding-a-global-back-to-top-to-your-site/</guid>
		<description><![CDATA[If there has to be one single usability issue I dislike from most sites, it is the &#034;back to top&#034; feature. Ugly links spread all over the place clogging the visuals of your site. It is for this reason that some months ago we developed a global unobtrusive back to top for Operator11.

identifying the problem
As [...]]]></description>
			<content:encoded><![CDATA[<p>If there has to be one single usability issue I dislike from most sites, it is the &#034;back to top&#034; feature. Ugly links spread all over the place clogging the visuals of your site. It is for this reason that some months ago we developed a global unobtrusive back to top for <a href="http://operator11.com">Operator11</a>.<br />
<span id="more-18"></span></p>
<h3 class="section">identifying the problem</h3>
<p>As we have seen before, <a href="http://poorbuthappy.com/ease/archives/2007/08/30/3804/ia-for-beginners-long-pages-work">long pages work</a>. But we always have an issue in the process: if one wants to navigate to other section of the site you have to scroll all the way up or use your other hand to hit the [Home] key.<br />
Given that the average internet user (I would say more than 90%) use their mouse to browse the web, either having to use your other hand and hunt for a key, scrolling up repetitively or clicking on that very top portion of that 16px wide scrollbar adds complexity to the task we are doing and <a href="http://www.humanized.com/weblog/2006/07/22/know_when_to_stop_designing_quantitatively/">decreases our efficiency</a>.<br />
Users love to hunt for information from page to page, and our task as user experience designers is to give them the tools to ease their stay.</p>
<h3 class="section">the wrong approach</h3>
<p>The classic solution of spreading links all over the place has great design, usability and accessibility problems.<br />
From the design point of view you either come up with a clever way to disguise the links or just leave them out there clogging the visuals. Not good either way!<br />
Usability wise, do you really know when the user wants to go back to the top of the page? Is there a need to spam the user with back to top links?<br />
And that spamming also means for decreased accessibility, screen reader or keyboard users will be constantly spammed with those meaningless links. They <strong>already</strong> know how to get back to the top of the page without the need for your &#034;shortcuts&#034;.<br />
Shouldn&#039;t there be a wiser and cleaner solution?</p>
<h3 class="section">developing a solution</h3>
<p>Fortunately, <strong>there is</strong> a fairly good solution. And armed with a bit of javascript and standards compliant <acronym title="Cascading Style Sheets">CSS</acronym> we can pull the trick.<br />
Did I just say javascript? why, yes! The back to top link is a navigational aid for mouse users and not real content in your page, think of it as an escape pod for when you want to get away from the current page.<br />
When developing this together with <a href="http://nicolassanguinetti.info">Nicolas Sanguinetti</a> for <a href="http://operator11.com">Operator11</a> our main goals were:<br />
- keep it clean<br />
- be unobtrusive<br />
- keep it usable<br />
The final solution ended as a tiny piece of code written with the aid of <a href="http://prototypejs.org">Prototype</a>.<br />
However as you may know, my personal and professional focus is into the <a href="http://mootools.net">mootools</a> library and for this reason the solution presented today will be an adaptation from the original code.</p>
<h3 class="section">methodology and code</h3>
<p><strong>Q:</strong> So when should we show the back to top link?<br />
<strong>A:</strong> Once we think the user needs it.<br />
Getting this metric can be a bit tricky and it&#039;s mostly arbitrary, but we finally settled for <strong>80% of a full page scroll</strong>. It&#039;s around this point that we need at least two mouse wheel scrolls to reach the top and hitting the back to top link becomes more efficient.<br />
the javascript:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'load'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">new</span> Element<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'span'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">'id'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'back-to-top'</span><span style="color: #339933;">,</span> 
    <span style="color: #3366CC;">'styles'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0.6</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">'events'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">hash</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">hash</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;page&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> 
      <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span> window.<span style="color: #660066;">scrollTo</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'back to top'</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">injectInside</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  window.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'scroll'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> fn <span style="color: #339933;">=</span> window.<span style="color: #660066;">getScrollTop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.8</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;addClass&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;removeClass&quot;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'back-to-top'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>fn<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'visible'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>and this simple CSS:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#back-to-top</span><span style="color: #00AA00;">,</span>
<span style="color: #cc00cc;">#back-to-top</span><span style="color: #6666ff;">.visible</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
body<span style="color: #00AA00;">&gt;</span><span style="color: #cc00cc;">#back-to-top</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #933;">17px</span> <span style="color: #933;">3px</span> <span style="color: #933;">7px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span> <span style="color: #933;">14px</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#555</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">triangle-gray-up.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">right</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
body<span style="color: #00AA00;">&gt;</span><span style="color: #cc00cc;">#back-to-top</span><span style="color: #6666ff;">.visible</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p></p>
<h3 class="section">pitfalls and caveats</h3>
<p>Just a few notes on usage and explanation of the methodology are needed.<br />
The code as you see purposely ignores IE6 as it has inexistent support for <code>position: fixed</code>. By using a CSS2 selector we gracefully degrade and ignore that browser and only display the link on standards compliant browsers.<br />
There is also another issue with <acronym title="Internet Explorer">IE</acronym> (6 and 7) that throws the infamous <a href="http://clientside.cnet.com/code-snippets/manipulating-the-dom/ie-and-operation-aborted/">Operation aborted</a> error and it&#039;s the reason behind using the <code>onload</code> event instead of <code>ondomready</code>.<br />
Last, but not the least, removing the hash part in the <acronym title="Uniform Resource Locator">URL</acronym> reloads the page instead of just cleaning that part of the location. This happens *at least* in Firefox and it is enough to conclude that setting <code>window.location.hash = ""</code> is not an option. For this is that we check the existence of the hash in the current location, and if not present we scroll to the top with javascript or else we set the location to the topmost element in our page.<br />
Be warned then, that if you use internal anchors in your site, you must have an element with an ID at the top of your page, preferably the body tag.<br />
For the curious, we re-set the hash part just for bookmarking purposes. If you hit the back to top link, then you are supposedly at the top and not on #someplace in the page.</p>
<h3 class="section">compatibility, download and legal bits</h3>
<p>The code is tested and works under Firefox, Opera 9, Safari 3 (both Windows and Mac) and Internet Explorer 7.<br />
As for <a href="http://mootools.net/download">mootools</a>, you just need the &#034;Element.Event&#034; and &#034;Window.Size&#034; modules, pretty much standard stuff.</p>
<p>By the way, you should have already noticed the back to top link in action in this post, feel free to try it out before leaving your comments ;)</p>
<p><a href="http://sandbox.gonchuki.com/btt/back-to-top.zip" class="download">Download back-to-top.zip</a></p>
<p><strong>License:</strong> <a href="http://creativecommons.org/licenses/by-sa/3.0/" class="cc">Creative Commons Attribution-Share Alike 3.0</a></p>
<p><strong>2009/02/27 &#8211; Update:</strong> The original code above was originally intended for mootools 1.11 (bleeding edge at that time in 2007), but given that 1.2 has been out for a long time I guess it&#039;s time for a quick update for <strong>mootools 1.2.x</strong><br />
I also took a few minutes to clean-up the <acronym title="Cascading Style Sheets">CSS</acronym> (no more CSS2 descendant rule to hide from IE6) and moved the &#034;fixed&#034; styles to the Element creation in the <acronym title="JavaScript">JS</acronym>. Now all that remains in the <acronym title="Cascading Style Sheets">CSS</acronym> is the customization on font, color, padding and background. The effect now also uses a fade in tween if it&#039;s available in your custom Mootools build.<br />
<a href="http://sandbox.gonchuki.com/btt/back-to-top_1.2.zip" class="download">Download back-to-top for mootools 1.2.x</a> [zip]</p>
<h3 class="section">addendum: original Prototype code</h3>
<p>Being that I was struck by <del datetime="2007-11-15T17:41:52+00:00">a very strange bug in mootools 1.11</del> <ins datetime="2007-11-15T17:41:52+00:00"><a href="http://dev.wp-plugins.org/ticket/723">a lame overriding of the addEvent function</a> by the <a href="http://wordpress.org/extend/plugins/stats/" rel="nofollow">Wordpress.com Stats plugin</a></ins>, I&#039;m putting here also the original Prototype-based implementation either for comparison or just for those Prototype users out there:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">BackToTop <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    initialize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>
            BackToTop.<span style="color: #660066;">link</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Element<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'span'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'back-to-top'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">update</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;back to top&quot;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">setOpacity</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0.6</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        BackToTop.<span style="color: #660066;">link</span>.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> BackToTop.<span style="color: #660066;">onLinkClick</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>window<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;scroll&quot;</span><span style="color: #339933;">,</span> BackToTop.<span style="color: #660066;">onWindowScroll</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    onLinkClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">hash</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            window.<span style="color: #660066;">location</span>.<span style="color: #660066;">hash</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;page&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            window.<span style="color: #660066;">scrollTo</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    onWindowScroll<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">viewport</span>.<span style="color: #660066;">getScrollY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">viewport</span>.<span style="color: #660066;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.8</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            BackToTop.<span style="color: #660066;">link</span>.<span style="color: #660066;">addClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'visible'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            BackToTop.<span style="color: #660066;">link</span>.<span style="color: #660066;">removeClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'visible'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>window<span style="color: #339933;">,</span> <span style="color: #3366CC;">'load'</span><span style="color: #339933;">,</span> BackToTop.<span style="color: #660066;">initialize</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>notice that this was first written to be a <a href="http://www.danwebb.net/2006/9/3/low-pro-unobtrusive-scripting-for-prototype">LowPro</a> behaviour (and fitting more of Nicolas&#039; coding style) but given the Operation Aborted bug in <acronym title="Internet Explorer">IE</acronym> we reverted back to plain Event.observe from Prototype.<br />
<script type="text/javascript" src="http://sandbox.gonchuki.com/btt/mootools.js"></script><br />
<script type="text/javascript" src="http://sandbox.gonchuki.com/btt/back-to-top.js"></script></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/usability-101-adding-a-global-back-to-top-to-your-site/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>moopop: "unobtrusive" popups with mootools</title>
		<link>http://blog.gonchuki.com/archives/moopop-unobtrusive-popups-with-mootools/</link>
		<comments>http://blog.gonchuki.com/archives/moopop-unobtrusive-popups-with-mootools/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 01:14:23 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/archives/moopop-unobtrusive-popups-with-mootools/</guid>
		<description><![CDATA[I know, it&#039;s quite ironic to call unobtrusive a popup window. However there are times when clients, coworkers or maintainers demand for a &#034;simple&#034; popup window solution. It&#039;s for that cases that I built moopop some months ago and I&#039;m now sharing the code.


Important:
The code and samples in this page are aimed towards mootools 1.11. [...]]]></description>
			<content:encoded><![CDATA[<p>I know, it&#039;s quite ironic to call unobtrusive a popup window. However there are times when clients, coworkers or maintainers demand for a &#034;simple&#034; popup window solution. It&#039;s for that cases that I built <em>moopop</em> some months ago and I&#039;m now sharing the code.</p>
<p><span id="more-16"></span></p>
<div class="big_sign notice">
<h3>Important:</h3>
<p>The code and samples in this page are aimed towards mootools 1.11. <br />If you are using mootools 1.2 please use <a href="http://blog.gonchuki.com/archives/updating-moopop-for-mootools-12/">the new version</a></p>
</div>
<h3 class="section">the call for a simple solution</h3>
<p>What&#039;s more annoying than a popup window? Writing code to execute them.<br />
- &#034;<em>Was it with quotes or without them?</em>&#034;<br />
- &#034;<em>Should I write px to specify it&#039;s in pixels?</em>&#034;<br />
These questions and more always raise in the seldom event that we need to write some kind of code for a popup window. Even worse, we feel it&#039;s a waste of time to write spiffy code to manage the popups since we are coding an <strong>ugly</strong> feature.<br />
Fear not, as I created a simple yet elegant solution based on the <a href="http://mootools.net">mootools</a> framework (In fact, the solution is pretty much library-agnostic, changing 2-3 lines of code is all you need to adapt it.)</p>
<h3 class="section">how simple can it be?</h3>
<p>As simple as adding the <acronym title="JavaScript">JS</acronym> to your site and adding a <var>rel</var> attribute to your links.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.google.com&quot;</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;popup&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>popup google<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><a href="http://www.google.com" rel="popup">see it in action</a><br />
<var>rel=&#034;popup&#034;</var> will trigger the standard popup behavior that is to open the link in a new window, pretty much works as a <var>target=&#034;_blank&#034;</var> while keeping our code tidy, standards based and semantically meaningful.</p>
<h3 class="section">what about arbitrarily sized windows?</h3>
<p>Thanks for asking. That&#039;s where moopop shines as you can have a ton of different sized popups in your page while still having to write no javascript code. This is where site maintainers start to love you, as they can edit or add new content without having to learn the intricacies of javascript.<br />
Let&#039;s see the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.google.com&quot;</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;popup[600,400]&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>popup google at 600x400<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><a href="http://www.google.com" rel="popup[600,400]">see it in action</a><br />
as simple as that, we can personalize each popup window by adding the size between square brackets.</p>
<h3 class="section">documentation, requirements and download</h3>
<p>Documentation is built-in on the <acronym title="JavaScript">JS</acronym> file in case you want to take a peek in a mootools-esque style for easier understanding.<br />
There are more possible uses for this such as setting a default size for all the popups without a given size, but I will leave that to you as that&#039;s a silly feature I had to build for a lazy coworker.</p>
<p>If you are already using mootools it&#039;s pretty much sure that you have the required dependencies. If not, it requires Element.Selectors, Window.DomReady and the rest of the requirements are automatically selected by the <a href="http://mootools.net/download">mootools download builder</a></p>
<p>- Download <a href="http://sandbox.gonchuki.com/moopop/moopop.js" rel="download">moopop with documentation</a><br />
or<br />
- Download <a href="http://www.crockford.com/javascript/jsmin.html" rel="external">JSMin</a> <a href="http://sandbox.gonchuki.com/moopop/moopop_min.js" rel="download">stripped version</a></p>
<p><strong>License:</strong> <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a></p>
<p><script type="text/javascript" src="http://sandbox.gonchuki.com/moopop/mootools.js"></script><br />
<script type="text/javascript" src="http://sandbox.gonchuki.com/moopop/moopop_min.js"></script></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/moopop-unobtrusive-popups-with-mootools/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>the web is event-driven, and so is your code</title>
		<link>http://blog.gonchuki.com/archives/the-web-is-event-driven-and-so-is-your-code/</link>
		<comments>http://blog.gonchuki.com/archives/the-web-is-event-driven-and-so-is-your-code/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 05:08:52 +0000</pubDate>
		<dc:creator>gonchuki</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[patterns]]></category>

		<guid isPermaLink="false">http://blog.gonchuki.com/archives/the-web-is-event-driven-and-so-is-your-code/</guid>
		<description><![CDATA[You click on something and then something else happens, you scroll the window and something moves around.
Welcome to the event-driven web, a concept that still some developers fail to assimilate.

the event-driven web
Developers need to understand that events are (or should be) everywhere, whether on DOM elements, over the HTTP protocol on in plain old javascript [...]]]></description>
			<content:encoded><![CDATA[<p>You click on something and then something else happens, you scroll the window and something moves around.<br />
Welcome to the event-driven web, a concept that still some developers fail to assimilate.<br />
<span id="more-14"></span></p>
<h3 class="section">the event-driven web</h3>
<p>Developers need to understand that events are (or should be) everywhere, whether on <acronym title="Document Object Model">DOM</acronym> elements, <a href="http://alex.dojotoolkit.org/?p=545">over the <acronym title="HyperText Transfer Protocol">HTTP</acronym> protocol</a> on in plain old javascript objects.<br />
Now, the former two methods are well agreed and documented, yet the later is still an undiscovered world for many developers. </p>
<h3 class="section">event driven&#8230; objects?</h3>
<p>Think about it, you attach events to <acronym title="Document Object Model">DOM</acronym> elements, you respond to events pushed by the server yet you are still using a rigid callback based architecture in your objects and pseudo-Classes. <strong>That&#039;s plain wrong</strong>.<br />
let&#039;s take object foo as:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  bar<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>baz<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009966; font-style: italic;">/* do some stuff here */</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>what the average developer does when they need to do something <em>after</em> <var>bar</var> is finished is to add another parameter into the call of <var>bar</var>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  bar<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>baz<span style="color: #339933;">,</span> callback<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009966; font-style: italic;">/* do some stuff here */</span>
    callback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If you then need another callback to do something in the middle of <var>bar</var>, soon enough before you notice you will be growing a bloated piece of code. You will notice this approach is not extensible any more when you see you need *yet another* parameter passed into your object to add the new functionality.<br />
To keep things clear, what your object/widget/Class should do is to &#034;<em>raise it&#039;s hand</em>&#034; when it needs our attention, and allow us to externally do whatever we desire on the outside, we should not pass-in callbacks to the object, we should run our callbacks once the object told us it&#039;s proper time to do so.</p>
<h3 class="section">mootools to the rescue</h3>
<p>So yes, achieving this in plain javascript is not possible as events are only part of the <acronym title="Document Object Model">DOM</acronym> elements. However there&#039;s one nifty (yet barely known) feature in <a href="http://www.mootools.net">mootools</a> that lets us extend any object with whatever set of functions we desire. For the <a href="http://www.ruby-lang.org">Ruby</a> folks, that&#039;s <a href="http://www.juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/">mixins</a> for javascript.</p>
<p>If you are a mootools lover, you may already know that <a href="http://docs.mootools.net/Class/Class.js">Classes</a> natively implement the Events interface. What you might not know is that *any* object can be mixed-in with <a href="http://docs.mootools.net/Element/Element-Event.js">Events</a> to be that event-raiser we need.<br />
So when needing to set-up callbacks in our code we could better use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  bar<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>baz<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009966; font-style: italic;">/* do some stuff here */</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">fireEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'onComplete'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
$extend<span style="color: #009900;">&#40;</span>foo<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">new</span> Events<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The result of this is that our object <var>foo</var> can now raise events, ones that we can attach to at *any* point of our code by the simple means of:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">foo.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'onComplete'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hello from foo's onComplete&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>and any time you need a new callback you can just set up another event and respond to it accordingly. Setting up an event of course, is as simple as adding a new <var>fireEvent</var> call where necessary and no more fiddling around with you perfectly built object.</p>
<h3 class="section">conclusion</h3>
<p>Events are everywhere on web development, and it&#039;s our job to use them where applicable and <strong>know</strong> how to do it. Events for regular objects help you keep your code extensible and semantically consistent with the rest of your <acronym title="Document Object Model">DOM</acronym>-based code, and that is a Good Thing.</p>
<p><strong>PS:</strong> for those out there not using mootools or not needing it&#039;s whole range of functionalities, there&#039;s also the tiny <a href="http://livepipe.net/projects/object_event/">Object.Event</a> library that basically allows you to reach the same results, with a <a href="http://www.prototypejs.org/">prototype</a>-like syntax.</p>
<p><strong>2008-07-13 Update:</strong> Having re-read this article many times, I must warn you that I do not fully agree any more to many of the points exposed at that time, so take the lecture with a grain of salt and simply imagine that the article was correctly written and explained.<br />
Still, there&#039;s a lot of potential in using custom events inside your javascript code and I encourage you to investigate more into the topic.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.gonchuki.com/archives/the-web-is-event-driven-and-so-is-your-code/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
