<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>Yelotofu</title>
	
	<link>http://yelotofu.com</link>
	<description>"In building standards compliant sites we are creating a better Web for the future."</description>
	<lastBuildDate>Mon, 07 Jun 2010 04:15:49 +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/Yelotofu" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="yelotofu" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-sa/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><item>
		<title>How to get Fancybox 1.3.1 to stay put!</title>
		<link>http://yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/</link>
		<comments>http://yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 04:11:41 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=655</guid>
		<description><![CDATA[I recently had a need to use a Fixed position overlay and found that Fancybox breaks if I set #fancybox-wrap to position:fixed. I believe the centerOnScroll option was supposed to solve this problem by recalculating the absolute position of #fancybox-wrap upon scrolling. The problem with this approach is that the overlay 'shudders' or 'feels jumpy' [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a need to use a Fixed position overlay and found that Fancybox breaks if I set <code>#fancybox-wrap</code> to <code>position:fixed</code>. I believe the <code>centerOnScroll</code> option was supposed to solve this problem by recalculating the absolute position of <code>#fancybox-wrap</code> upon scrolling. The problem with this approach is that the overlay 'shudders' or 'feels jumpy' when you scroll in Firefox, Opera and IE7+.</p>
<p>Luckily the fix is actually pretty simple with the following steps:</p>
<p><strong>1. Get a copy of the source code</strong> - <a href="http://fancybox.googlecode.com/files/jquery.fancybox-1.3.1.zip">jquery.fancybox-1.3.1.zip</a></p>
<p><strong>2. Do a in-code-search</strong> </p>
<p>Open jquery.fancybox-1.3.1.js and look for the <code>fancybox_get_viewport</code> function (should be around line 56), the function should look like this:</p>
<pre class="javascript">&nbsp;
fancybox_get_viewport = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #66cc66;">&#40;</span>window<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">width</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, $<span style="color: #66cc66;">&#40;</span>window<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, $<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">scrollLeft</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, $<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">scrollTop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span>;
<span style="color: #66cc66;">&#125;</span>,
&nbsp;</pre>
<p><strong>3. Change it to look like this:</strong></p>
<pre class="javascript">&nbsp;
fancybox_get_viewport = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> isFixed = wrap.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'position'</span><span style="color: #66cc66;">&#41;</span> === <span style="color: #3366CC;">'fixed'</span>; <span style="color: #009900; font-style: italic;">// add support for fixed positioning</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #66cc66;">&#40;</span>window<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">width</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, $<span style="color: #66cc66;">&#40;</span>window<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, isFixed ? <span style="color: #CC0000;">0</span> : $<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">scrollLeft</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, isFixed ? <span style="color: #CC0000;">0</span> : $<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">scrollTop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span>;
<span style="color: #66cc66;">&#125;</span>,
&nbsp;</pre>
<p><strong>4. Add some CSS</strong></p>
<p>Add the following clauses to your CSS files (ensure these clauses load <em>after</em> the jquery.fancybox-1.3.1.css file):</p>
<pre class="css">&nbsp;
<span style="color: #cc00cc;">#fancybox-wrap</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">fixed</span>;
<span style="color: #66cc66;">&#125;</span>
* html <span style="color: #cc00cc;">#fancybox-wrap</span> <span style="color: #66cc66;">&#123;</span>	<span style="color: #808080; font-style: italic;">/* IE6 */</span>
  <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">absolute</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>That's it!</p>
<p>Basically what the fix does is detect whether the wrapper is a fixed position element, if so it would return 0 for the scrollLeft and scrollTop values of the viewport. So even if you're not using a fixed position element you can add this fix in as it's non-destructive.</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML5 Placeholders</title>
		<link>http://yelotofu.com/2010/06/tip-the-html5-placeholder/</link>
		<comments>http://yelotofu.com/2010/06/tip-the-html5-placeholder/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 18:47:46 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[placeholder]]></category>
		<category><![CDATA[placeholders]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=633</guid>
		<description><![CDATA[HTML5 adds a new attribute to most form elements called a placeholder. Its purpose is to add a short hint inside data entry points that disappear on focus. This type of interaction isn't new but is new to HTML as of version 5. For this reason not all browsers have implemented this feature. Try it [...]]]></description>
			<content:encoded><![CDATA[<p>HTML5 adds a new attribute to most form elements called a <a href="http://dev.w3.org/html5/spec/Overview.html#the-placeholder-attribute">placeholder</a>. Its purpose is to add a short hint inside data entry points that disappear on focus. This type of interaction isn't new but is new to HTML as of version 5. For this reason not all browsers have implemented this feature. Try it to see which of your browsers support the following bit of code!</p>
<p><strong>HTML</strong></p>
<pre>&nbsp;
&lt;input type=&quot;text&quot; placeholder=&quot;click me!&quot;&gt;
&nbsp;</pre>
<p>So now we have a problem. Some browsers support it and others don't!? Foresee client issues? Not to worry, here's a workaround using the latest jQuery 1.4 features!</p>
<p><strong>JavaScript</strong></p>
<pre class="javascript">&nbsp;
jQuery<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
  <span style="color: #009900; font-style: italic;">// first check if placeholder attribute is supported</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'
&lt;input/&gt;'</span><span style="color: #66cc66;">&#41;</span>
        .<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'placeholder'</span>,<span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#93;</span>
        .<span style="color: #006600;">placeholder</span> === undefined<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #009900; font-style: italic;">// text input placeholder</span>
    $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'input[placeholder]'</span><span style="color: #66cc66;">&#41;</span>
      .<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">value</span> === <span style="color: #3366CC;">''</span>
          ? <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">value</span> = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'placeholder'</span><span style="color: #66cc66;">&#41;</span>
          : <span style="color: #003366; font-weight: bold;">false</span>;
      <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
      .<span style="color: #006600;">live</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'focusin focusout'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        event.<span style="color: #006600;">type</span> == <span style="color: #3366CC;">'focusout'</span> &amp;&amp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">value</span> === <span style="color: #3366CC;">''</span>
          ? <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">value</span> = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'placeholder'</span><span style="color: #66cc66;">&#41;</span>
          : <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">value</span> === $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'placeholder'</span><span style="color: #66cc66;">&#41;</span>
            ? <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">value</span> = <span style="color: #3366CC;">''</span>
            : <span style="color: #003366; font-weight: bold;">false</span>;
      <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>This is not a complete solution as there are other things to consider such as visual style and what happens when you submit the form. But I'll let you mull over those. <img src='http://yelotofu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Demo and code sample: <a href="http://jsbin.com/ujosa/edit">http://jsbin.com/ujosa/edit</a></p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2010/06/tip-the-html5-placeholder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Textarea maxlength</title>
		<link>http://yelotofu.com/2009/12/jquery-textarea-max-length/</link>
		<comments>http://yelotofu.com/2009/12/jquery-textarea-max-length/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 10:00:38 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[maxlength]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=597</guid>
		<description><![CDATA[Being able to restrict the maximum length of user input from the interface directly is very convenient and practical in use. We do this a lot with input elements. Unfortunately textarea elements do not natively support the maxlength attribute. This attribute was finally added in HTML5 but at the time of writing Chrome is the [...]]]></description>
			<content:encoded><![CDATA[<p>Being able to restrict the maximum length of user input from the interface directly is very convenient and practical in use. We do this a lot with <code>input</code> elements. Unfortunately <code>textarea</code> elements do not natively support the <code>maxlength</code> attribute. This attribute was finally added in HTML5 but at the time of writing Chrome is the only browser supporting it.</p>
<p>Naturally many have used JavaScript to rectify this problem and I'd be doing the same here. The difference is we won't be putting anything special in the markup but will simply use the <code>maxlength</code> attribute within our <code>textarea</code> as if it's native &mdash;  like so:</p>
<p><strong>HTML</strong>
<pre>&nbsp;
&lt;textarea cols=&quot;30&quot; rows=&quot;5&quot; maxlength=&quot;10&quot;&gt;&lt;/textarea&gt;
&nbsp;</pre>
<p>This is looking good for HTML5 compatibility. And here's the magic:</p>
<p><strong>jQuery</strong> </p>
<pre class="javascript">jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
  <span style="color: #009900; font-style: italic;">// ignore these keys</span>
  <span style="color: #003366; font-weight: bold;">var</span> ignore = <span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">8</span>,<span style="color: #CC0000;">9</span>,<span style="color: #CC0000;">13</span>,<span style="color: #CC0000;">33</span>,<span style="color: #CC0000;">34</span>,<span style="color: #CC0000;">35</span>,<span style="color: #CC0000;">36</span>,<span style="color: #CC0000;">37</span>,<span style="color: #CC0000;">38</span>,<span style="color: #CC0000;">39</span>,<span style="color: #CC0000;">40</span>,<span style="color: #CC0000;">46</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
  <span style="color: #009900; font-style: italic;">// use keypress instead of keydown as that's the only</span>
  <span style="color: #009900; font-style: italic;">// place keystrokes could be canceled in Opera</span>
  <span style="color: #003366; font-weight: bold;">var</span> eventName = <span style="color: #3366CC;">'keypress'</span>;
&nbsp;
  <span style="color: #009900; font-style: italic;">// handle textareas with maxlength attribute</span>
  $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'textarea[maxlength]'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #009900; font-style: italic;">// this is where the magic happens</span>
    .<span style="color: #006600;">live</span><span style="color: #66cc66;">&#40;</span>eventName, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> self = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>,
          maxlength = self.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'maxlength'</span><span style="color: #66cc66;">&#41;</span>,
          code = $.<span style="color: #006600;">data</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>, <span style="color: #3366CC;">'keycode'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
      <span style="color: #009900; font-style: italic;">// check if maxlength has a value.</span>
      <span style="color: #009900; font-style: italic;">// The value must be greater than 0</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>maxlength &amp;&amp; maxlength &gt; <span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #009900; font-style: italic;">// continue with this keystroke if maxlength</span>
        <span style="color: #009900; font-style: italic;">// not reached or one of the ignored keys were pressed.</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #66cc66;">&#40;</span> self.<span style="color: #006600;">val</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">length</span> &lt; maxlength
                 || $.<span style="color: #006600;">inArray</span><span style="color: #66cc66;">&#40;</span>code, ignore<span style="color: #66cc66;">&#41;</span> !== <span style="color: #CC0000;">-1</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #009900; font-style: italic;">// store keyCode from keydown event for later use</span>
    .<span style="color: #006600;">live</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'keydown'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      $.<span style="color: #006600;">data</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>, <span style="color: #3366CC;">'keycode'</span>, event.<span style="color: #006600;">keyCode</span> || event.<span style="color: #006600;">which</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>See <a href="http://yelotofu.com/labs/jquery/snippets/textarea/">live example.</a></p>
<p>This code could probably be enhanced further by triggering custom events when the maximum length is reached or include a character counter of some sort within the keypress handler. Your imagination is the limit!</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/12/jquery-textarea-max-length/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tip: getting values from an options list</title>
		<link>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/</link>
		<comments>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 19:16:56 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquerymap]]></category>
		<category><![CDATA[optionslist]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=579</guid>
		<description><![CDATA[So, if you've ever converted an options list into a single array of values you might have intuitively done this:
var select = $&#40;'#mySelectElement'&#41;&#91;0&#93;;
var values = new Array&#40;&#41;;
for &#40;var i=0; i &#60; select.length; i++&#41; &#123;
  values.push&#40;select.options&#91;i&#93;.value&#41;;
&#125;
Pretty boring aye? 
There is a snazzier (is that a word?) alternative, which is to use jQuery.map:
var select = $&#40;'#mySelectElement'&#41;&#91;0&#93;;
var [...]]]></description>
			<content:encoded><![CDATA[<p>So, if you've ever converted an options list into a single array of values you might have intuitively done this:</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> select = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#mySelectElement'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #003366; font-weight: bold;">var</span> values = <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i=<span style="color: #CC0000;">0</span>; i &lt; select.<span style="color: #006600;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  values.<span style="color: #006600;">push</span><span style="color: #66cc66;">&#40;</span>select.<span style="color: #006600;">options</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">value</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>Pretty boring aye? </p>
<p>There is a snazzier (is that a word?) alternative, which is to use jQuery.map:</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> select = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#mySelectElement'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #003366; font-weight: bold;">var</span> values = $.<span style="color: #006600;">map</span><span style="color: #66cc66;">&#40;</span>select.<span style="color: #006600;">options</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>n<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> n.<span style="color: #006600;">value</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>OK, only one line saving but doesn't that feel good?!?</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Happy Birthday Google Chrome!</title>
		<link>http://yelotofu.com/2009/09/happy-birthday-google-chrome/</link>
		<comments>http://yelotofu.com/2009/09/happy-birthday-google-chrome/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 11:50:35 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Browser Testing]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[googlechrome]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=565</guid>
		<description><![CDATA[Wow, it's been a year already? Time certainly flies when you're having fun! It seems the Google Chrome team have been hard at work! They've finally made a version of Google Chrome for Mac and Linux which you could download from the Dev channel.
Had a quick test and found Print and Application shortcuts haven't been [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, it's been <a href="http://chrome.blogspot.com/2009/09/google-chrome-turns-1.html">a year already</a>? Time certainly flies when you're having fun! It seems the Google Chrome team have been hard at work! They've finally made a version of <a href="http://dev.chromium.org/getting-involved/dev-channel">Google Chrome for Mac and Linux</a> which you could download from the Dev channel.</p>
<p>Had a quick test and found Print and Application shortcuts haven't been implemented yet. Chrome also died on me a few times unexpectedly (doesn't seem to cope too well with our QUnit test pages). Overall I like the minimal interface and speedier JavaScript response times. It could only get better!</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/09/happy-birthday-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Server CE and Snow Leopard Problem</title>
		<link>http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/</link>
		<comments>http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 16:32:30 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[snowleopard]]></category>
		<category><![CDATA[zendserver]]></category>
		<category><![CDATA[zendserverce]]></category>

		<guid isPermaLink="false">http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/</guid>
		<description><![CDATA[There's a compatibility issue with the Java Bridge in Zend Server CE which results in failure of the ZendServer admin interface. A temporary fix could be found at http://forums.zend.com/viewtopic.php?f=44&#038;t=1115
I found this out the hard way - reinstalled and digged the internals before realizing it was a compatibility issue. I hope the Zend guys fix this [...]]]></description>
			<content:encoded><![CDATA[<p>There's a compatibility issue with the Java Bridge in Zend Server CE which results in failure of the ZendServer admin interface. A temporary fix could be found at <a href="http://forums.zend.com/viewtopic.php?f=44&t=1115">http://forums.zend.com/viewtopic.php?f=44&t=1115</a></p>
<p>I found this out the hard way - reinstalled and digged the internals before realizing it was a compatibility issue. I hope the Zend guys fix this soon!</p>
<p>Oh, I'm on Zend Server CE 4.0.5</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Labs: UI inlineEdit</title>
		<link>http://yelotofu.com/2009/09/ui-inlineedit/</link>
		<comments>http://yelotofu.com/2009/09/ui-inlineedit/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 17:32:50 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JQuery UI]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[in-place-edit]]></category>
		<category><![CDATA[inline-edit]]></category>
		<category><![CDATA[inlineedit]]></category>
		<category><![CDATA[inplaceedit]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jqueryui]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=547</guid>
		<description><![CDATA[After my last tutorial on building a simple inlineEdit plugin I converted the concepts into a UI widget. It's now sitting in labs for you to use, pick apart and devour:
http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/demo.html

If you inspect the source code you will notice the structure is quite different. It's actually pretty much the same functionality wise but I have [...]]]></description>
			<content:encoded><![CDATA[<p>After my last tutorial on building a simple <a href="http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/">inlineEdit plugin</a> I converted the concepts into a UI widget. It's now sitting in labs for you to use, pick apart and devour:</p>
<p><a href="http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/demo.html">http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/demo.html<br />
</a></p>
<p>If you inspect the <a href="http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/ui.inlineEdit.js" target="_blank">source code</a> you will notice the structure is quite different. It's actually pretty much the same functionality wise but I have separated each piece into smaller chunks. This makes it easier to extend in future (I plan to write more on ways to extend UI widgets in another post).</p>
<p>Here's a quick peek at the features:</p>
<ul>
<li>Basic inline editing - click, edit, save</li>
<li>Ability to save on pressing ENTER key</li>
<li>Cancel by un-focussing the input or clicking cancel</li>
<li>ThemeRoller ready</li>
<li>Customisable empty placeholder</li>
<li>Save and Cancel callbacks</li>
<li>Cancelable Save callback (so you could script a cancel action)</li>
</ul>
<p>As usual please feedback and help improve this widget either by commenting here or on the <a href="http://wiki.jqueryui.com/InlineEdit">InlineEdit design & planning page</a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/09/ui-inlineedit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tip: Obtaining Request Parameters in Zend_View</title>
		<link>http://yelotofu.com/2009/08/tip-request-params-in-zend_view/</link>
		<comments>http://yelotofu.com/2009/08/tip-request-params-in-zend_view/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 15:11:43 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=521</guid>
		<description><![CDATA[I found it virtually impossible to obtain GET or POST request parameters in Zend_View without resorting to accessing the $_GET or $_POST variables. Directly accessing these variables within Zend_View is bad practice so it's been suppressed on purpose to keep processing where it should be - within the Controller. However it is possible to get [...]]]></description>
			<content:encoded><![CDATA[<p>I found it virtually impossible to obtain GET or POST request parameters in Zend_View without resorting to accessing the $_GET or $_POST variables. Directly accessing these variables within Zend_View is bad practice so it's been suppressed on purpose to keep processing where it should be - within the Controller. However it is possible to get hold of these variables properly and that is to pass them from the Controller.</p>
<p>Example. You have a query string that looks like this <code>?keyword=test</code> and want to show it in your view, here's what to do:</p>
<p>MyController.php</p>
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> indexAction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">view</span>-&gt;<span style="color: #006600;">request</span> = <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">getRequest</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>my-controller/index.phtml</p>
<pre>&nbsp;
The keyword is &lt;?= $this-&gt;request-&gt;keyword ?&gt;
&nbsp;</pre>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/08/tip-request-params-in-zend_view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Inline Edit tutorial</title>
		<link>http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/</link>
		<comments>http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 22:04:41 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[editinplace]]></category>
		<category><![CDATA[inlineedit]]></category>
		<category><![CDATA[inplaceedit]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=469</guid>
		<description><![CDATA[A friend recently asked me to review his edit-in-place code which turned out to be a modification of the one found at http://docs.jquery.com/Tutorials:Edit_in_Place_with_Ajax. Reading the tutorial on that page I asked myself how I would do this differently? Defining a global setClickable() function and then calling $('#editInPlace").click() is totally uncool, essentially limiting yourself to one [...]]]></description>
			<content:encoded><![CDATA[<p>A friend recently asked me to review his edit-in-place code which turned out to be a modification of the one found at <a href="http://docs.jquery.com/Tutorials:Edit_in_Place_with_Ajax" target="_blank">http://docs.jquery.com/Tutorials:Edit_in_Place_with_Ajax</a>. Reading the tutorial on that page I asked myself how I would do this differently? Defining a global <code>setClickable()</code> function and then calling <code>$('#editInPlace").click()</code> is totally uncool, essentially limiting yourself to one edit-in-place area per page.</p>
<p>Since the concept of edit-in-place is so simple and the implementation should be likewise I want to try and tackle this as a tutorial by going through concepts and teaching to build from scratch.</p>
<h2>The concept</h2>
<p>There's a piece of text on a page, e.g. a heading or paragraph, looking plain and un-interesting. When you hover over it however a visual highlight, usually pale yellow, indicates that it's something special - an editable region. You then click on the text and it magically transforms into an editable box with save and cancel buttons tagged at the end. On clicking either save or cancel the editable box transforms back into its original form with text updated if saved.</p>
<h2>The build</h2>
<p>What we want to do is put these concepts into code whilst building something that's re-usable. A plugin will do the trick! Let's call our plugin inlineEdit.</p>
<p>We are only 3 steps away from achieving our goal! Follow along...</p>
<h3>Step 1: Getting the basics right</h3>
<p>The basic functionality consists of a static text element (<code>span</code>, <code>div</code> etc...) that can transforms into an <code>input</code> element on click. And on hover the text element will highlight to indicate special interactions.</p>
<p>Here's our first pass: <a href="http://yelotofu.com/labs/jquery/snippets/inlineEdit/demo_basics.html">Basic Interaction</a> </p>
<p><strong>Code explanation:</strong> Our plugin accepts a CSS class name defined in a stylesheet which is used to toggle the text element's classname - a class defining a background-color typically #ffC is sufficient for this. On clicking we replace the entire contents of the original text element with an <code>input</code> element and pass the original content into the <code>input</code> as its value. For now changes are saved when the <code>input</code> loses focus.</p>
<h3>Step 2: Save, Cancel &amp; Callbacks</h3>
<p>As you may notice above we saved on blur and there is no way of canceling changes. Let's improve the interaction by adding a save button. This is important as you'd want to do something with the changes or allow a user to manually cancel. Every application does something different at the saving stage so we'll simply define a save callback and let the implementer decide what to do on save, be it Ajax post or what not. The save action is also cancelable by returning false inside the callback.</p>
<p>Here is our second pass: <a href="http://yelotofu.com/labs/jquery/snippets/inlineEdit/demo_callbacks.html">Save, cancel and callbacks</a> </p>
<h3>Step 3: Finishing Off</h3>
<p>Our plugin is nearly there. Just a few nice finishing touches remaining. We want to give the user ability to change the button label and pass an initial value. Also to make the plugin more re-usable we want to move the core plugin code out to a separate file and reference it instead. To set the stage for further improvements in the future we also split the code into two distinct clauses.</p>
<p>Final result:  <a href="http://yelotofu.com/labs/jquery/snippets/inlineEdit/demo_final.html">Live Demo</a> and <a href="http://yelotofu.com/labs/jquery/snippets/inlineEdit/jquery.inlineEdit.js" target="_blank">source code is here</a></p>
<h2>Usage</h2>
<p>Now to use this brand spanking new plugin we simply apply it to any DOM element like so:</p>
<p>HTML</p>
<pre>&lt;span class=&quot;editable&quot;&gt;Hello World!&lt;/span&gt;</pre>
<p>JavaScript - Basic</p>
<pre class="javascript">$<span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.editable'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">inlineEdit</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>JavaScript - Customised button label with save callback</p>
<pre class="javascript">$<span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.editable'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">inlineEdit</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
    buttonText: <span style="color: #3366CC;">'Add'</span>,
    save: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>e, data<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066;">confirm</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'Change name to '</span>+ data.<span style="color: #006600;">value</span> +<span style="color: #3366CC;">'?'</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p><strong>Feedback welcome</strong> - if you happen to improve upon this code base please share-a-like! </p>
<p>Enjoy!</p>
<p><strong>Update 26-Aug-09:</strong> Added placeholder for cases when text is empty; changed label option to buttonText to minimise confusion.</p>
<p><strong>Update 18-Oct-09</strong> Fixed bug in setting initial value via script.</p>
<p><strong>Update 17-Jan-10</strong> Moved code to <a href="http://github.com/caphun/jquery.inlineedit">http://github.com/caphun/jquery.inlineedit</a>. I will continue to improve this plugin from there. Feel free to fork it!</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>jQuery UI Spinner update</title>
		<link>http://yelotofu.com/2009/05/jquery-spinner-update/</link>
		<comments>http://yelotofu.com/2009/05/jquery-spinner-update/#comments</comments>
		<pubDate>Sun, 24 May 2009 19:03:39 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JQuery UI]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jqueryui]]></category>
		<category><![CDATA[spinner]]></category>
		<category><![CDATA[uispinner]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=455</guid>
		<description><![CDATA[Sorry for no news these past few months. It's been very hectic since the new family addition back in Dec which I managed to keep low key.   I feel so guilty now for neglecting this blog and my readers (don't think I have any regulars anyway so I guess nothing missed!), but hey [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry for no news these past few months. It's been very hectic since the new family addition back in Dec which I managed to keep low key. <img src='http://yelotofu.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I feel so guilty now for neglecting this blog and my readers (don't think I have any regulars anyway so I guess nothing missed!), but hey priorities are priorities!</p>
<p>Right, the reason for this post is that there has been some recent exciting updates to the spinner which I would love to get feedback on from the public. Thanks to <a href="http://btburnett.com/" target="_blank">Brant Burnett</a>, the Spinner has been re-invigorated and looks set to become a kick ass component in the making!</p>
<p>We've added a bunch of new features and updates including:</p>
<ul>
<li>support for jquery 1.3.2</li>
<li>support for ThemeRoller</li>
<li>spinning hexidecimals and other numbering systems</li>
<li>ability to auto-hide buttons and show on hover with customizable speeds</li>
<li>better keyboard interaction - you could now use PgUp/PgDn to setup up/down in a large increment set by options</li>
</ul>
<p>We also have a lot more in the works, such as:</p>
<ul>
<li>ability to spin time and date</li>
<li>segment spinning based on formatter</li>
<li>HTML5 support</li>
<li>and more...</li>
</ul>
<p>If interested, check out the <a href="http://jquery-ui.googlecode.com/svn/branches/dev/spinner/demos/index.html#spinner|default" target="_blank">latest demo</a></p>
<p>We're still in the planning / development stage so any features you see now or currently being planned may not necessarily land in the final release. It all depends on what <strong>you</strong> want - collectively that is! So if there is something you really think should be added please shout in the <a href="http://groups.google.com/group/jquery-ui-dev/" target="_blank">dev mailing list</a> or on the <a href="http://wiki.jqueryui.com/Spinner" target="_blank">UI planning wiki</a>.</p>
<p>Looking forward to some feedback.</p>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/05/jquery-spinner-update/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
	</channel>
</rss>
