<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tips for Twits &#187; js</title>
	<atom:link href="http://t.wits.sg/tag/js/feed/" rel="self" type="application/rss+xml" />
	<link>http://t.wits.sg</link>
	<description>WARNING: excessive use of this site will increase MP at the expense of HP</description>
	<lastBuildDate>Mon, 16 Aug 2010 04:09:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>JQuery Progress Bar 2.0</title>
		<link>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/</link>
		<comments>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 02:39:49 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=320</guid>
		<description><![CDATA[Hi all its us again, In the past few months we&#8217;ve been asked many a times to help improve the progressbar code. We&#8217;ve also been referenced by several websites as THE progressbar to use. In all, we felt we owed it to you guys to make it better. So here we are, after all those [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>Hi all its us again, In the past few months we&#8217;ve been asked many a times to help improve the progressbar code. We&#8217;ve also been referenced by several websites as THE progressbar to use. In all, we felt we owed it to you guys to make it better.</p>
<p>So here we are, after all those emails and bug reports, we finally got down to it. Always good to take a couple of months to have a fresh prespective of things. We ripped out the old code and made it much better and more extensible than its predecessors. So much that we decided it was enough to qualify as a major revision.</p>
<div style="clear: both">&nbsp;</div>
<p>Let see whats been done&#8230;</p>
<ul>
<li>Cleaned up the code, yes its lighter, cleaner faster. (Still lacks documentation though) <img src='http://t.wits.sg/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> </li>
<li>Callbacks! Everyone&#8217;s favourite</li>
<li>Max values, you can now set it to be 150/2000 instead of just a percentage</li>
<li>Text formats. Show 75/100 or 75% by toggling the <code>textFormat</code> accordingly</li>
<li>Steps, how many steps to get to your target value</li>
<li>Step Duration, how long each step lasts</li>
<li>Webkit (Chrome/Safari) compatibility. More like, Webkit Hacks</li>
</ul>
<p>Once again, many a thanks for all those who have so generously provided the feature requests as well as bug fixes every now and then. And thanks for all your patience in waiting for this new release. <img src='http://t.wits.sg/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
If its working for you, drop us a comment and tell us where we can see your stuff!</p>
<p><strong>Download the new jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a>or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Google Maps Helper</title>
		<link>http://t.wits.sg/2009/06/14/google-maps-helper/</link>
		<comments>http://t.wits.sg/2009/06/14/google-maps-helper/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 13:51:15 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[maps]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=281</guid>
		<description><![CDATA[In our work we like to create Google Maps links for our client&#8217;s (offices, stores, etc). However, the larger our clients presence, the more random links there are bound to be. When it comes to using Google Map&#8217;s javascript API to control the map, thats still perfectly fine. But how do I create a google [...]]]></description>
			<content:encoded><![CDATA[<p>In our work we like to create Google Maps links for our client&#8217;s (offices, stores, etc). However, the larger our clients presence, the more random links there are bound to be. When it comes to using Google Map&#8217;s javascript API to control the map, thats still perfectly fine. But how do I create a google maps link that only shows 1 entry? Turns out, there are several ways to do this:</p>
<ol>
<li><strong>Manipulate the request such that it only shows your entry</strong>How? For example, searching for &#8220;Holland, Singapore&#8221; will lead us to about 1,356 results. See <a href="http://www.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=holland,+Singapore&amp;mrt=yp&amp;sll=1.305855,103.786876&amp;sspn=0.008055,0.016522&amp;ie=UTF8&amp;z=14">here</a>. So lets tweak it a little:
<ul>
<li>Append <code>&amp;mrt=yp</code> to the url &#8211; That returns us all the business listings. (852 results)</li>
<li>Append <code>&amp;start=16</code> to the url &#8211; That skips the first 16 results (Shows results 17-26 of 852)</li>
<li>Append <code>&amp;num=2</code> to the url &#8211; That returns us only 2 results (Only shows 2 results)</li>
</ul>
<p>For a more complete listing of Google Maps Parameters, consult <a href="http://mapki.com/wiki/Google_Map_Parameters">mapki.com</a>. Kudos to those guys for compiling that list. Really useful stuff<br />
So there you have it, a simple way to link your business such that its the only entry there. However this method is relatively dangerous. Why? Cause you&#8217;ve got no idea of the exact ordering that Google maps may return. Today you could be entry 17, surely not in a year (hopefully for the better). As such, this is not the recommended solution.</li>
<li><strong>Use the address with your long/lat coordinates to generate your entry.</strong>
<ul>
<li> First get your GPS coordinates, there are a number of ways to do this. Check our this <a href="http://en.wikipedia.org/wiki/Geographic_coordinates_(obtaining)">link</a></li>
<li>Then create your link via the following structure: <code>http://www.google.com/maps?&amp;ie=UTF8&amp;hl=en&amp;q=[urlescaped address]&amp;ll=[GPS lat,long]&amp;z=[Zoom]&amp;iwloc=A</code></li>
<li>Still too troublesome? We&#8217;ve created a simple tool for our clients to use. Save yourself some time.  <a href="http://t.wits.sg/misc/googleMapsHelper/demo.php">Try it!</a>
</li>
<p>Done! Whats the downside to this? <strong>You can only show the address for the business</strong>. Because searching by business names returns us way too many results. So instead, we have to search for an address, Google interprets this as an address and only returns 1 result (which is the whole point of geocoding). At this point its easy to the map to what we need. We&#8217;d use this typically for this nifty little &#8220;Find us on a map&#8221; links (instead of embedding the actual map on your site).</ul>
</li>
</ol>
<p>Once again, if you&#8217;d rather embed Google maps directly into your site via the JS, then your options are much more open.<br />
Good luck! Let us know if it works for you, of if you find a better way of doing things!<br />
<a href="http://t.wits.sg/misc/googleMapsHelper/demo.php"><img src="http://t.wits.sg/wp-content/uploads/2009/06/googleMapsHelper-300x291.png" alt="googleMapsHelper" title="googleMapsHelper" width="300" height="291" class="alignnone size-medium wp-image-314" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/06/14/google-maps-helper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar 1.2</title>
		<link>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/</link>
		<comments>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 09:58:01 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=27</guid>
		<description><![CDATA[Thanks for all the comments and feedback! By popular request i&#8217;ve added the multi-colored progress bar and fixed some bugs. The new multi-colored bar changes from red to orange and then to green at configurable intervals. Check out the demo! Since the last update this endeavour has seen comments claiming that it works and sometimes [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>Thanks for all the comments and feedback! By popular request i&#8217;ve added the multi-colored progress bar and fixed some bugs. The new multi-colored bar changes from red to orange and then to green at configurable intervals. Check out the demo!</p>
<p>Since the last update this endeavour has seen comments claiming that it works and sometimes that it doesnt. I&#8217;ve tested the demo across Safari, Opera, IE6/7, Firefox and Chrome. Havent found any problem. For those of you who have problems, please do email me the problem.</p>
<p><strong>Download the new jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a>or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>EXTJS themed file input field</title>
		<link>http://t.wits.sg/2008/09/01/extjs-themed-file-input-field/</link>
		<comments>http://t.wits.sg/2008/09/01/extjs-themed-file-input-field/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 16:38:14 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ext]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=18</guid>
		<description><![CDATA[Theming a file input field has always been notoriously hard. Thanks to the guys who wrote the Ext UploadDialog script, theres now a better and more aesthetically pleasing way to create a file upload. I tried using their script wholesale but ran into some problems with the layout. So i kinda hacked and extracted their [...]]]></description>
			<content:encoded><![CDATA[<p>Theming a file input field has always been notoriously hard. Thanks to the <a href="http://www.max-bazhenov.com/dev/upload-dialog-2.0/index.php" target="_blank">guys who wrote the Ext UploadDialog script</a>, theres now a better and more aesthetically pleasing way to create a file upload. I tried using their script wholesale but ran into some problems with the layout. So i kinda hacked and extracted their Ext.ux.BrowseButton code.</p>
<p>So now you can use it simply with:</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">	new Ext.ux.BrowseButton({
		input_name: &quot;uploadfile1&quot;,
		text: &quot;Select a file&quot;
		onInputFileChange: function() {
			alert(&quot;you chose &quot; + this.getInputFile().dom.value);
		}
	})
&nbsp;
	new Ext.ux.TBBrowseButton({
		input_name: &quot;uploadfile2&quot;,
		text: &quot;Select another file&quot;
	})</pre></div></div>

<p>The first chunk of code creates a Browse Button (File Input) control as with the name uploadfile1. and the second chunk of codes creates a <strong>ToolBar</strong> Browse Button with the name uploadfile2.</p>
<p>Hypothetically you should be able to add a ToolBar button but i havent quite gotten a ToolBar Browse Button to fit aesthetically well inside a form. Let me know if you all come up with any examples that do!</p>
<p>Meanwhile, 3 cheers for the <a href="http://www.max-bazhenov.com/dev/upload-dialog-2.0/index.php" target="_blank">guys who wrote the Ext UploadDialog script</a>!!!</p>
<p><strong>Download the jQuery progressbar here: <a href="http://t.wits.sg/downloads/ ext.browsebutton.1.0.zip" target="_blank">EXT Browse Button</a><br />
or view the demo <a href="http://t.wits.sg/misc/EXTBrowseButton/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/09/01/extjs-themed-file-input-field/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar 1.1</title>
		<link>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/</link>
		<comments>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 11:42:04 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=14</guid>
		<description><![CDATA[This code has been downloaded quite abit so i thought i&#8217;d put in some effort to improve it. I found some free time this evening to clean up the code. The original code is a couple of months old and its my first jquery plugin. I didnt quite understand what i was doing then.I made [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>This code has been downloaded quite abit so i thought i&#8217;d put in some effort to improve it. I found some free time this evening to clean up the code. The original code is a couple of months old and its my first jquery plugin. I didnt quite understand what i was doing then.I made the code less resource intensive and more configurable.</p>
<p>The progress bar can now be controlled externally. click on the demo link below to see what i&#8217;m talking about. I&#8217;ll know of at least 1 bug in the script if its fully tested, will try to fix this within the week. Meanwhile if you have any ideas for improvements, please leave a comment!</p>
<p><strong><br />
Download the jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar</a><br />
or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar v1.0</title>
		<link>http://t.wits.sg/2008/06/17/jquery-progress-bar/</link>
		<comments>http://t.wits.sg/2008/06/17/jquery-progress-bar/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 07:09:42 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=9</guid>
		<description><![CDATA[I really liked the mootools progressbar at http://www.webappers.com/progressBar/ but i&#8217;m so against the idea of having 2-3 libraries in a single system. Since i always use jQuery, i tried to port the progressBar over. The problem is, jQuery unlike most of the other libraries doesnt quite work with objects. So its not that easy to [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>I really liked the mootools progressbar at <a href="http://www.webappers.com/progressBar/" target="_blank">http://www.webappers.com/progressBar/</a> but i&#8217;m so against the idea of having 2-3 libraries in a single system. Since i always use jQuery, i tried to port the progressBar over. The problem is, jQuery unlike most of the other libraries doesnt quite work with objects. So its not that easy to return and manage an object to perform actions like &#8220;add 5%&#8221;, &#8220;fill to 95%&#8221;, etc. Honestly i&#8217;m not sure where else to use such a comprehensive progress bar other than a file upload utility.</p>
<p>So for what its worth, i made a simple progress bar in jQuery that parses a percentage string and animates the loading. <strong></strong></p>
<p><strong>Download the jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a></strong><strong>Or view the demo: <a href="http://t.wits.sg/misc/jQueryProgressBar/1.0/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/17/jquery-progress-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO: Fix EXTJS Textarea for IE6</title>
		<link>http://t.wits.sg/2008/06/17/howto-fix-extjs-textarea-for-ie6/</link>
		<comments>http://t.wits.sg/2008/06/17/howto-fix-extjs-textarea-for-ie6/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 06:34:23 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[bugfix]]></category>
		<category><![CDATA[ext]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=8</guid>
		<description><![CDATA[I encountered a interesting display bug when working with EXTJS recently. The following code renders well in FF 2 and above but not in IE6. var form = new Ext.form.FormPanel({ baseCls: 'x-plain', labelWidth: 140, url: 'abc/def.php', defaultType: 'textfield', items: [{ fieldLabel: 'Name', name: 'name', anchor:'100%' // anchor width by percentage }, { xtype: 'textarea', fieldLabel: [...]]]></description>
			<content:encoded><![CDATA[<p>I encountered a interesting display bug when working with EXTJS recently. The following code renders well in FF 2 and above but not in IE6.</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">var form = new Ext.form.FormPanel({
	baseCls: 'x-plain',
	labelWidth: 140,
	url: 'abc/def.php',
	defaultType: 'textfield',
	items: [{
		fieldLabel: 'Name',
		name: 'name',
		anchor:'100%'  // anchor width by percentage
	}, {
		xtype: 'textarea',
		fieldLabel: 'Description',
		name: 'description',
		anchor: '100% -30'  // bug in IE6
	}]
});
&nbsp;
var window = new Ext.Window({
	title: 'Some Window',
	width: 500, height: 300, 
	layout: 'fit',
	plain: true,
	buttonAlign: 'center',
	items: form
});
&nbsp;
window.show();</pre></div></div>

<p> brian.moeskau  from the EXTJS forums was kind enough to answer this problem. The fix is a piece of code that primes the width of the controls to prevent it from overflowing out of the window/panels. The code is as follows</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">Ext.override(Ext.form.Field, {
    adjustWidth : function(tag, w){
        tag = tag.toLowerCase();
        if(typeof w == 'number' &amp;&amp; !Ext.isSafari){
            if(Ext.isIE &amp;&amp; (tag == 'input' || tag == 'textarea')){
                if(!Ext.isStrict){
                    return this.inEditor ? w : w - 3;
                }
                if(tag == 'input' &amp;&amp; Ext.isStrict){
                    return w - (Ext.isIE6 ? 4 : 1);
                }
                if(tag == 'textarea' &amp;&amp; Ext.isStrict){
                    return w-4;
                }
            }else if(Ext.isOpera &amp;&amp; Ext.isStrict){
                if(tag == 'input'){
                    return w + 2;
                }
                if(tag == 'textarea'){
                    return w-2;
                }
            }
        }
        return w;
    }
});</pre></div></div>

<p>I hope this will solve other people&#8217;s problems too!</p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/17/howto-fix-extjs-textarea-for-ie6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
