<?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>TechKnack &#187; javascript</title>
	<atom:link href="http://techknack.net/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://techknack.net</link>
	<description>The rantings of a techie</description>
	<lastBuildDate>Thu, 24 Dec 2009 19:53:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Replace Form Dropdowns with Auto-suggest</title>
		<link>http://techknack.net/replace-form-dropdowns-with-auto-suggest/</link>
		<comments>http://techknack.net/replace-form-dropdowns-with-auto-suggest/#comments</comments>
		<pubDate>Sun, 27 Jul 2008 03:50:42 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[ideas]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://techknack.net/?p=160</guid>
		<description><![CDATA[ I&#8217;ve just finished a little project that I&#8217;ve been working a few days on: replacing a form&#8217;s dropdown field (such as a State or Country field) with a more usable text field with auto-suggest.  Jakob Nielson, a &#8220;usability expert&#8221;, has posted a couple of articles (Does User Annoyance Matter? and Drop-Down Menus: Use [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://techknack.net/wp-content/uploads/statedd_oldnew.png'><img src="http://techknack.net/wp-content/uploads/statedd_oldnew.png" alt="" title="statedd_oldnew" width="300" height="52" class="alignleft size-medium wp-image-163" /></a> I&#8217;ve just finished a little project that I&#8217;ve been working a few days on: replacing a form&#8217;s dropdown field (such as a State or Country field) with a more usable text field with auto-suggest.  Jakob Nielson, a &#8220;usability expert&#8221;, has posted a couple of articles (<a href=''http://www.useit.com/alertbox/annoyances.html>Does User Annoyance Matter?</a> and <a href="http://www.useit.com/alertbox/20001112.html">Drop-Down Menus: Use Sparingly</a>) on how un-usable dropdown fields are.  These articles and other tidbits I&#8217;d heard about dropdown usability gave me the idea to implement this auto-suggest feature.</p>
<p><a href='http://techknack.net/wp-content/uploads/statedd.png'><img src="http://techknack.net/wp-content/uploads/statedd.png" alt="" title="statedd" width="300" height="83" class="alignright size-medium wp-image-162" /></a> The script, which uses jQuery and is currently only usable for one field at a time, takes the select element (via its id) and loops through its option elements.  For each option, its backend (the value=&#8221;" part) and visible (between the option tags) values are read into an array, and the select element is replaced with a hidden field and a text field.  Entering text into the text field triggers the suggestion script, which matches the entry against the list of options (using both backend and visible options), and builds a list of the matches, with most likely matches at the top.  Once the suggestions list is built, the script displays the top options in a <a href="http://www.google.com/webhp?complete=1&#038;hl=en">google-suggest-style box</a> directly beneath the text input.  The number of suggestions shown is customizable, with values between one and unlimited (value of 0).  Once suggestions are shown, they can be navigated using the up and down arrow keys, and selected using the enter key.  Unfortunately, I haven&#8217;t been able to capture the enter key for this action, to prevent the form from submitting.  As such, using &#8220;enter&#8221; to select the highlighted option will submit the form.  Suggestions can also be selected using the mouse, complete with hover effects.</p>
<p>If the field is blurred (that is, the cursor leaves the field, such as with the tab key), then the script tries to choose the most likely option.  If the field is blank on blur, nothing is set.  If a suggestion was selected with the arrow keys or mouse before the blur, then that option is set as the value.  Otherwise, the top suggestion in the list is selected (in the case of tabbing through the form: tab in, type two-letter state abbreviation, tab out).</p>
<p>When an option is selected, the input field&#8217;s value is set to the option&#8217;s visible value, and the previously mentioned hidden field is set to the option&#8217;s backend value.  This method is used to retain the aspects of dropdowns: present the user with human-readable data, but use computer-readable data in back.  That, and it makes it so you can use the same server-side processing script (and/or client-side validation script) for both JS and non-JS users, since the hidden field inherits the select&#8217;s &#8220;name&#8221; field (the text input doesn&#8217;t have a &#8220;name&#8221; field).</p>
<p><a href='http://techknack.net/wp-content/uploads/countrydd.png'><img src="http://techknack.net/wp-content/uploads/countrydd.png" alt="" title="countrydd" width="300" height="114" class="alignleft size-medium wp-image-161" /></a> Like I mentioned before, this script is not limited to State dropdowns.  Any dropdown list will work, but I would suggest you only use it in cases where the field&#8217;s values are already known to the users (&#8221;Select package&#8221; is not a good place for this!).  Just provide the script with an ID, and off it goes.</p>
<p>Oh, and each line of suggestion is customizable via a simple template parsing bit <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p>Anyway, check the example out: <a href="http://techknack.net/examples/dropdownreplace/">replacing a State dropdown</a> and <a href="http://techknack.net/examples/dropdownreplace/?r=2">replacing a Country dropdown</a>.  All the code (other than the jQuery include) is on that page; the javascript at the top is pretty well documented.  Feedback and suggestions are most welcome.</p>
<img src="http://techknack.net/?ak_action=api_record_view&id=160&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/replace-form-dropdowns-with-auto-suggest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got Mad Coding Skills?</title>
		<link>http://techknack.net/got-mad-coding-skills/</link>
		<comments>http://techknack.net/got-mad-coding-skills/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 16:20:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/got-mad-coding-skills/</guid>
		<description><![CDATA[Think you got what it takes to slice up a PSD file into a valid and usable (X)HTML template?  Then check out CSS Off, a contest that gives you the opportunity to do just that.  At one minute past midnight CST on April 5, a PSD file will be uploaded for contestants to [...]]]></description>
			<content:encoded><![CDATA[<p>Think you got what it takes to slice up a PSD file into a valid and usable (X)HTML template?  Then check out <a href='http://cssoff.com/2008/03/20/next-contest-is-april-4-2008/'>CSS Off</a>, a contest that gives you the opportunity to do just that.  At one minute past midnight CST on April 5, a PSD file will be uploaded for contestants to download.  Contestants will have up to 24 hours to submit their completed entry.</p>
<p><a href='http://answers.yahoo.com/question/index?qid=20061003221806AAdLmsE'>Don&#8217;t have Photoshop?</a>  Check out the <a href='http://gimp.org/'>GIMP</a>!  I&#8217;m hoping that the PSD file is GIMP-compatible.  You could try to convert it one way (using an <a href='http://fivepointsome1.blogspot.com/2007/12/how-to-convert-your-files-online-into.html'>online service</a>) or another (<a href='http://www.gimptalk.com/forum/topic/Can-Gimp-Open-A-Psd-File-4722-1.html'>directly in the GIMP</a>),but there&#8217;s always the issue of unsupported layer effects getting messed up.</p>
<p>And, no, this is not an <acronym title='April Fool&#39;s Day'>AFD</acronym> trick.  At least, I hope it isn&#8217;t&#8230;</p>
<img src="http://techknack.net/?ak_action=api_record_view&id=114&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/got-mad-coding-skills/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Progressively Enhance copyable code blocks</title>
		<link>http://techknack.net/progressively-enhance-copyable-code-blocks/</link>
		<comments>http://techknack.net/progressively-enhance-copyable-code-blocks/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 17:17:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/progressively-enhance-copyable-code-blocks/</guid>
		<description><![CDATA[Update 8/17/09: I&#8217;ve installed the SyntaxHighlighter Evolved wordpress plugin, which not only highlights code, but also gives access to plaintext source and copy-to-clipboard functionality.
After the upgrade to WordPress, I haven&#8217;t updated the theme to include this feature.  I may just stick to code highlighting for now.
I&#8217;ve employed a bit of progressive JS here on [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 8/17/09:</strong> I&#8217;ve installed the <a href="http://wordpress.org/extend/plugins/syntaxhighlighter/">SyntaxHighlighter Evolved</a> wordpress plugin, which not only highlights code, but also gives access to plaintext source and copy-to-clipboard functionality.</p>
<p><em>After the upgrade to WordPress, I haven&#8217;t updated the theme to include this feature.  I may just stick to code highlighting for now.</em></p>
<p>I&#8217;ve employed a bit of progressive JS here on the blog to make it easier for readers to copy the blocks of code that I post.  Go ahead, try it: click within the code block, and the entire thing is selected.  Makes for pretty easy copying, rather than having to carefully select <i>just</i> the text inside the box&#8230;</p>
<pre class="brush: plain;">
// I'm code!!  Copy me!!
$ hello world
// w00t...
</pre>
</p>
<h3>The way it works</h3>
<p>Here&#8217;s how it works: I&#8217;ve defined a function which goes over every single &lt;code&gt; element on the page.  For each code element, a textarea element is created and inserted into the DOM tree directly before the corresponding code element.  Once a textarea is added to the DOM, it is hidden via CSS.  The textarea is given, as child nodes, recursive clones of code&#8217;s DOM child nodes.  Then, the onclick event of the code element and the onblur event of the textarea are set to different functions.  The code&#8217;s onclick function hides the code element, un-hides the textarea element gives the textarea the focus, and selects the textarea&#8217;s contents.  The textarea&#8217;s onblur function hides the textarea and un-hides the corresponding code element.</p>
<p>It&#8217;s possible to have the script do this for <i>all</i> code elements on the page, but I&#8217;ve implemented it to only target those code elements to which I&#8217;ve given a class name of &#8220;copyable&#8221;.</p>
<h3>The CSS</h3>
<p>The hiding-un-hiding tricks aren&#8217;t possible without CSS.  Well, they&#8217;re possible, but such an implementation would make the JS much messier.  Here I&#8217;ve used CSS to similarly style both code elements and elements with a class name of &#8220;codeenhance&#8221; (which is used to identify the inserted textareas).</p>
<pre class="brush: css;">
.codeenhance, code {
    width: 430px;
    color: #000;
    display: block;
    background: #eee;
    padding: 0 10px;
    padding-bottom: 1em;
    margin: 0;
    border-width: 3px 1px !important;
    border: #99f solid;
    overflow: auto;
    line-height: 1.4em;
    font-family: monospace;
    font-size: 1.1em;
}
.codeenhance, .copyable {
    height: 250px;
}
code {
    white-space: pre;
}
.codeenhance {
    padding: 0;
}
.codeenhance-off {
    display: none;
}
</pre>
<p>The first declaration is the main styling for the code elements.  The height specification for .codeenhance and .copyable fix the height of copyable code blocks, so your 159 lines of copyable JS don&#8217;t take up too much space.  I&#8217;ve left the height out of the main declaration, to allow the other code blocks to expand/retract to their contents&#8217; size.  The white-space declaration for code elements maintains the whitespace as you typed it.  The padding declaration for .codeenhance fixes an interesting jumping issue with the textareas.  And the display declaration for .codeenhance-off is what hides the appropriate items.</p>
<h3>The Javascript</h3>
<p>Here&#8217;s the JS.  The explanations are in the code comments <img src='http://techknack.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<pre class="brush: jscript;">
// Enable click-select on code elements
function enhanceCode() {
    // Get all code tags
    var codes = document.getElementsByTagName(&quot;code&quot;);
    // loop over code tags
    for (i=0; i&amp;lt;codes.length; i++) {
        // working only on tags of class &quot;copyable&quot;
        if (codes[i].className.match('copyable')) {
            // for each tag, create a new textarea
            var text = document.createElement(&quot;textarea&quot;);
            // copy the code's children over
            for (j=0; j&amp;lt;codes[i].childNodes.length; j++) {
                // special code for Blogger, to take care of extra br elements
                if (codes[i].childNodes[j].nodeName == &quot;BR&quot;)
                    text.appendChild(document.createTextNode('\r\n'));
                else
                    text.appendChild(codes[i].childNodes[j].cloneNode(true));
            }
            // set the initial classname
            //    (use .className rather than .setAttribute('clas', 'blah')
            //    because IE6 doesn't like the latter
            text.className = &quot;codeenhance codeenhance-off&quot;;
            // setup the onblur event
            text.onblur = decodex;
            // insert the textarea before the code
            codes[i].parentNode.insertBefore(text, codes[i]);
            // setup the onclick event
            codes[i].onclick = codex;
        }
    }
}

// this = code element; this.previousSibling = textarea element
function codex() {
    // show the textarea
    this.previousSibling.className =
        this.previousSibling.className.replace(/ ?codeenhance\-off/, &quot;&quot;);
    // hide the code
    this.className = this.className+&quot; codeenhance-off&quot;;
    // focus and select the textarea
    this.previousSibling.focus();
    this.previousSibling.select();
}

// this = textarea; this.nextSibling = code
function decodex() {
    // show the code
    this.nextSibling.className =
        this.nextSibling.className.replace(/ ?codeenhance\-off/, &quot;&quot;);
    // hide the textarea
    this.className = this.className+&quot; codeenhance-off&quot;;
}

window.onload = function() {
    // run the enhancement /after/ the window has loaded
    enhanceCode();
}
</pre></p>
<img src="http://techknack.net/?ak_action=api_record_view&id=100&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/progressively-enhance-copyable-code-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A well-designed website: many things to many people</title>
		<link>http://techknack.net/a-well-designed-website-many-things-to-many-people/</link>
		<comments>http://techknack.net/a-well-designed-website-many-things-to-many-people/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 22:44:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/a-well-designed-website-many-things-to-many-people/</guid>
		<description><![CDATA[In my Advanced Web Design class at school, my professor asked us to post what we thought defined a well-designed website.  I thought I&#8217;d share my answer here.  I&#8217;m sure he wasn&#8217;t expecting anything so involved as this  
&#8220;What makes a well-designed website?&#8221;  That&#8217;s quite a question.
As a dabbler in web [...]]]></description>
			<content:encoded><![CDATA[<p>In my Advanced Web Design class at school, my professor asked us to post what we thought defined a well-designed website.  I thought I&#8217;d share my answer here.  I&#8217;m sure he wasn&#8217;t expecting anything so involved as this <img src='http://techknack.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>&#8220;What makes a well-designed website?&#8221;  That&#8217;s quite a question.</p>
<p>As a dabbler in web design, I would say a well-designed website is &#8220;good-looking&#8221;.  It should look somewhat elegant.  The &#8220;Web 2.0 style&#8221; &#8212; glossy buttons, spacious openness, minimalistic simplicity, and copious use of gradients &#8212; comes to mind.  I can&#8217;t think of any sites that strictly adhere to all these points, but <a href="http://dynamicdrive.com/">DynamicDrive</a> is a good-looking site.</p>
<p>As an <acronym title="Human-Computer Interaction">HCI</acronym>-minded individual, a well-designed website is made by more than its layout. A well-designed website makes it obvious what the site&#8217;s purpose is, what can be done on the site, how to go about doing it, etc.  Again, simplicity is king, and clutter is sin.  Content is easy to skim and understand.  The layout does not make it difficult to navigate.  If a feature breaks, the site will either <em>gently</em> tell the user so, and make it easy for the user to report the breakage; or the site will function in such a way that the user doesn&#8217;t notice the difference, and the developer will be alerted.  I think <a href="http://digg.com/">Digg</a> is a fairly usable, well-designed site.</p>
<p>As a web developer at heart, a well-designed website is all in the code.  Separation of structure, content, presentation, and functionality is something to be strived for.  It should be built as follows:</p>
<ol>
<li>First build a mock page (with the final site&#8217;s design in mind) which contains either mock or real content, and only structure-oriented HTML markup.  Presentational markup is sin <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   This page is not design-oriented; its only purpose is to structure the page&#8217;s content in a semantically meaningful way.  Any tags that do not directly relate to the structure and/or content of the page should be struck down with a flaming sword of death.  Organize things in such a ay that they flow logically along the page.</li>
<li>Develop the CSS in an externally linked file.  Introduce any design-specific images through the CSS, if possible (and it should be possible).  Strive for cross-browser compatibility within the CSS, making the site look as similar as possible from one browser to the next.  If any additional markup is required for the design of the site, the CSS should be developed to make the site look good without it; if still necessary, the necessary markup can be added through the next step.  Use what you have to get what you want.</li>
<li>Develop the functionality (using JavaScript) in another externally linked file.  Nonintrusive javascript should be used, progressively enhancing the site after it has loaded.  Nonintrusive javascript should also be used to add any necessary additional markup to be used by the CSS.  Again, use what you have to get what you want.</li>
<li>If possible, convert the finished page layout into a template, and use a server-side language to fill it with dynamic content.</li>
<li>Finally, when all is said and done, pull up the page in a browser, and make sure everything works.  Turn off javascript, refresh, and make sure everything works.  Turn off css, refresh, and make sure everything works.  Then browse the web for a while&#8230;.and see if it works <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
<p>According to these steps, a well-designed website will work across browsers, degrade gracefully in older browsers, respect the wishes of those with Javascript turned off.<br />
There are lots of websites that use this methodology (using only semantically-meaningful html, etc).  One well-designed website in this case is <a href="http://www.dynamixlabs.com/">Dynamix Labs</a>.  It doesn&#8217;t seem that they use any javascript, and if you turn off CSS, the site is still very readable.</p>
<p>As a user, I want information, and I want simplicity in doing what I want to do.  A lot of the time, I want information that I can talk about in my blog.  I use google as my main go-to source for finding things.  If I find a site that gives me good information on a regular basis, I want to be able to subscribe to its RSS feed, or something similar.  If I find a site that I come back to on a regular basis (whether I be forced to, or do so of my own free will), I want to be able to customize my experience on that site.  I want to be able to change the colors, the landing page content; anything and (usually) everything, I want to customize it to better serve my way of doing things.<br />
One service that I use on a daily basis is <a href="https://www.google.com/reader/view/#">Google Reader</a> (you&#8217;ll have to sign in to your google account), a web-based RSS aggregator.  It features &#8220;folders&#8221; that you can use to organize your feeds, drag-and-drop re-ordering of feeds, and very easy-to-use methods of subscribing and unsubscribing from feeds.<br />
Another service that I use regularly is <a href="http://netvouz.com/">Netvouz</a>, a social bookmarking site.  I chose Netvouz over other bookmarking sites because of its folder organization feature.  You can organize your bookmarks according to category (and sub-category) and make certain bookmarks private.  It&#8217;s also easy to delete or edit my existing bookmarks, and really easy to add new bookmarks using the Netvouz firefox extension.</p>
<p>I must say, though, that my most frequently used and favorite thing is <a href="http://getfirefox.com/">FireFox</a>.  It is customizable in (almost) every way possible; its functionality is infinitely extendable through extensions, which anyone familiar with XML and Javascript can write.  It has excellent support for standards; the upcoming FireFox 3 is said to have passed <a href="http://webstandards.org/acid2">the Acid2 test</a>, which is huge for web developers.</p>
<p>As you can see, from my point(s) of view, a well designed website can and should be many things to many different people.</p>
<p>So, what do you think?  What makes a website &#8220;well-designed&#8221;?  What are some examples of well-designed websites?</p>
<p><b>Note:</b> References to certain things &#8220;being sin&#8221; should not be taken literally.  Putting presentational markup on your page will not send you to hell.  Nor will avoiding clutter send you to heaven.  These are just my personal pet peeves <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://techknack.net/?ak_action=api_record_view&id=96&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/a-well-designed-website-many-things-to-many-people/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The JS behind &quot;Most Popular Posts&quot;</title>
		<link>http://techknack.net/the-js-behind-most-popular-posts/</link>
		<comments>http://techknack.net/the-js-behind-most-popular-posts/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 18:16:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[blogs]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/the-js-behind-most-popular-posts/</guid>
		<description><![CDATA[Original article: Most Popular Posts list for blogger
In my last article &#8220;Most Popular Posts list for blogger,&#8221; I presented my version of Chris Riley&#8217;s Analytics API workaround.  I also promised to go through the JavaScript for those who were interested  
The JS
Without further ado, the code:

&#60;div id=&#34;popularposts&#34;&#62;&#60;noscript&#62;Please enable javascript to view the most [...]]]></description>
			<content:encoded><![CDATA[<p>Original article: <a href="http://techknack.blogspot.com/2008/01/most-popular-posts-list-for-blogger.html">Most Popular Posts list for blogger</a></p>
<p>In my last article &#8220;Most Popular Posts list for blogger,&#8221; I presented my version of <a href="http://cgriley.com/">Chris Riley&#8217;s</a> <a href="http://blogoscoped.com/forum/120951.html">Analytics API workaround</a>.  I also promised to go through the JavaScript for those who were interested <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>The JS</h3>
<p>Without further ado, the code:</p>
<pre class="brush: jscript;">
&lt;div id=&quot;popularposts&quot;&gt;&lt;noscript&gt;Please enable javascript to view the most popular posts list.&gt;/noscript&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
function topcontentCallback(obj) {
    try {
        var url,title,output;
        output='&lt;ul&gt;';
        for (i=0; i &lt; obj.count; i++) {
            url = obj.value.items[i].url;
            try {
                title = obj.value.items[i].name[0].content;
                title = title.replace('&lt;title&gt;', '');
                title = title.replace('&lt;/title&gt;', '');
                title = title.replace('Tech Knack: ', '');
            }
            // if we didn't get the title (bad Pipe!), give a pseudo-
            //   title from the URL
            catch (e) {
                title = url.substring(
                             url.lastIndexOf(&quot;/&quot;)+1,
                             url.lastIndexOf(&quot;.html&quot;)
                         ).replace(/\-/g, &quot; &quot;);
            }
            //remove the &lt;title&gt; tags the pipe leaves in.
            output+= '&lt;li&gt;&lt;a href=&quot;'+url+
                     '&quot; title=&quot;'+title+'&quot;&gt;'+title+'&lt;/a&gt;&lt;/li&gt;';
        }
        output += '&lt;/ul&gt;';
        document.getElementById(&quot;popularposts&quot;).innerHTML = output;
    }
    catch (e) {
        var error = &quot;Error fetching data: &quot;+e;
        if (e.toString().indexOf('i')!=-1) error += &quot;&lt;br /&gt;i: &quot;+i;
        document.getElementById(&quot;popularposts&quot;).innerHTML=error;
    }
}
//--&gt;
&lt;/script&gt;
&lt;script src=&quot;http://pipes.yahoo.com/pipes/pipe.run?_id=bi6F5qPK3BGfvuxf1vC6Jw&amp;_render=json&amp;_callback=topcontentCallback&quot; type=&quot;text/javascript&quot;&gt; &lt;/script&gt;
</pre>
</p>
<h3>The Div</h3>
<p>
<pre class="brush: xml;">&lt;div id=&quot;popularposts&quot;&gt;&lt;noscript&gt;Please enable javascript to view the most popular posts list.&lt;/noscript&gt;&lt;/div&gt;</pre>
<p>
The div with id &#8220;popularposts&#8221; is the div whose content will be replaced with our list.  It initially contains some noscript text for those without JS.</p>
<h3>The Function</h3>
<p>
<pre class="brush: jscript;">function topcontentCallback(obj) {</pre>
<p>
The topcontentCallback function is the function used to handle the JSON output by the Yahoo! Pipe.  &#8220;obj&#8221; is the JSON string passed in by the Pipe.</p>
<p>
<pre class="brush: jscript;">
    try {
        ......
    }
    catch (e) {
        var error = &quot;Error fetching data: &quot;+e;
        if (e.toString().indexOf('i')!=-1) error += &quot;&lt;br /&gt;i: &quot;+i;
        document.getElementById(&quot;popularposts&quot;).innerHTML=error;
    }
</pre>
<p>
We enclose the main processing code in a try block.  Firefox2 and IE6 (and presumably 7 and 8 ) support try blocks in JS.  This way, if there is a problem processing the data (a referrenced node is missing, etc) the user gets a nice little error message rather than a JS error thrown by the browser.  In te case of an error, the previously mentioned div&#8217;s content is set to &#8220;Error: &lt;error message&gt;&#8221;.  Not useful to visitors, per se, but good for debugging your script.  The &#8220;if (e.toString().indexOf(&#8217;i')!=-1)&#8221; part simply appends i&#8217;s value (from within the try block) to the error message.  Again, good for debugging.</p>
<p>
<pre class="brush: jscript;">
        var url,title,output;
        output='&lt;ul&gt;';
</pre>
<p>Declare some variables, initialize the output variable (we use an unordered list for display).</p>
<p>
<pre class="brush: jscript;">
        for (i=0; i &lt; obj.count; i++) {
            url = obj.value.items[i].url;
</pre>
<p>We loop over the items given by the Pipe.  First we pull the url of the popular page.</p>
<p>
<pre class="brush: jscript;">
            try {
                title = obj.value.items[i].name[0].content;
                title = title.replace('&lt;title&gt;', '');
                title = title.replace('&lt;/title&gt;', '');
                title = title.replace('Tech Knack: ', '');
            }
            // if we didn't get the title (bad Pipe!), give a pseudo-
            //   title from the URL
            // if we didn't get the title (bad Pipe!), give a pseudo-
            //   title from the URL
            catch (e) {
                title = url.substring(
                             url.lastIndexOf(&quot;/&quot;)+1,
                             url.lastIndexOf(&quot;.html&quot;)
                         ).replace(/\-/g, &quot; &quot;);
            }
            //remove the &lt;title&gt; tags the pipe leaves in.
</pre>
<p>Here we try to pull the page&#8217;s title, as pulled by the Pipe.  I&#8217;ve noticed that, occasionally, the Pipe will have trouble getting the page&#8217;s title, and so leaves the title blank, which doesn&#8217;t play well with our script.  Within the try block, I get the content of the title; I then try to replace (remove) the title tags and the site&#8217;s title.  If there is no title text from the Pipe, this will throw an error.  In the catch block, we use the page&#8217;s url to &#8220;guess&#8221; the title, removing the &#8220;.html&#8221; at the end using url.substring(), and replacing the intermittent dashes which replace punctuation and spaces with .replace().  These two commands are strung together to be url.substring().replace().  The result: if the article titled &#8220;CSS trick &#8211; two background images&#8221; doesn&#8217;t have a title attribute in our JSON, the title is given as &#8220;css trick two background images&#8221;.  For this reason, you should enable &#8220;post pages&#8221; in your template&#8217;s preferences.</p>
<p>
<pre class="brush: jscript;">
            output+= '&lt;li&gt;&lt;a href=&quot;'+url+
             '&quot; title=&quot;'+title+'&quot;&gt;'+title+'&lt;/a&gt;&lt;/li&gt;';
</pre>
<p>Here we append to our ul an li containing a link to the popular page.</p>
<p>
<pre class="brush: jscript;">
        }
        output += '&lt;/ul&gt;';
        document.getElementById(&quot;popularposts&quot;).innerHTML = output;
</pre>
<p>After the for loop, we add the final &lt;/ul&gt; and replace the div&#8217;s contents.</p>
<p>All this is just a function; without calling it, it is no good.</p>
<p>
<pre class="brush: xml;">
&lt;script src=&quot;http://pipes.yahoo.com/pipes/pipe.run?_id=bi6F5qPK3BGfvuxf1vC6Jw&amp;_render=json&amp;_callback=topcontentCallback&quot; type=&quot;text/javascript&quot;&gt; &lt;/script&gt;
</pre>
<p>This imports the JSON created by the Pipe, telling it to render in JSON format (&#038;_render=json) and to call our function to handle the JSON (&#038;_callback=topcontentCallback).  If you copy and paste the src to a browser window, you&#8217;ll see that the content is simply a function call with the JSON as the parameter:</p>
<pre class="brush: jscript;">
topcontentCallback({&quot;count&quot;:7,&quot;value&quot;:{&quot;title&quot;:&quot;TechKnack&quot;.......}});
</pre></p>
<img src="http://techknack.net/?ak_action=api_record_view&id=95&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/the-js-behind-most-popular-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Most Popular Posts list for blogger</title>
		<link>http://techknack.net/most-popular-posts-list-for-blogger/</link>
		<comments>http://techknack.net/most-popular-posts-list-for-blogger/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 18:35:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[blogs]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/most-popular-posts-list-for-blogger/</guid>
		<description><![CDATA[Last week I was looking for a way to have a &#8220;Most Popular Posts&#8221; widget here on blogger.  The first and only true &#8220;widget&#8221; I found was Affiliate Brand&#8217;s Most Popular Posts Widget.  The only problems: it has a default color scheme that doesn&#8217;t really go with that of my blog, and the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I was looking for a way to have a &#8220;Most Popular Posts&#8221; widget here on blogger.  The first and only true &#8220;widget&#8221; I found was <a href="http://affiliatebrand.com/">Affiliate Brand&#8217;s</a> <a href="http://www.bloggerbuster.com/2007/08/popular-posts-widget-for-blogger.html">Most Popular Posts Widget</a>.  The only problems: it has a default color scheme that doesn&#8217;t really go with that of my blog, and the height is pretty much fixed.  It seems that you can change the look-n-feel with an external CSS sheet&#8230;but, unless you have another file host, that&#8217;s a luxury we cheap Blogger bloggers don&#8217;t have <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Not satisfied with AffiliateBrand&#8217;s widget, I kept searching.  To no avail; that was simply the only pre-packaged blogger widget out there.  Then the thought occurred to me to use my Google Analytics data to roll my own pseudo-widget.  Genius, no?  Well, it would be, if Analytics had an API <img src='http://techknack.net/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Fortunately, there are geniuses out there who have done genius things.  In this case, <a href="http://cgriley.com/">Chris Riley</a> of <a href="http://blogoscoped.com/">Blogoscoped</a> has <a href="http://blogoscoped.com/archive/2008-01-17-n73.html">mashed up a combination of Google and Yahoo! offerings</a> in such a way that we poor Blogger users can have a Popular Posts widget!</p>
<h3>The basics</h3>
<p>The basics are these:<br />
1) Have analytics setup on your blog<br />
2) Setup a Google Group<br />
3) Setup a GMail account<br />
2) Setup email notifications from Analytics&#8217; top pages to a GMail account<br />
3) Setup GMail forwarding to your Google Group<br />
5) Setup a Yahoo! pipe to fetch and process your top content report<br />
6) Setup a pseudo-widget script on your blog to display the pipe&#8217;s results</p>
<h3>The pipe</h3>
<p>While Chris provides his Yahoo! Pipe for others to clone, I had issues getting it to work with fetching the page&#8217;s title contents.  Here&#8217;s <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=bi6F5qPK3BGfvuxf1vC6Jw">the pipe that I&#8217;m using</a>.  Of course, a different pipe means different code for parsing the results.</p>
<h3>The javascript</h3>
<p>Here&#8217;s the javascript that I use to display my pseudo-widget:</p>
<pre class="brush: jscript;">
&lt;div id=&quot;popularposts&quot;&gt;&lt;noscript&gt;Please enable javascript to view the most popular posts list.&gt;/noscript&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
function topcontentCallback(obj) {
    try {
        var url,title,output;
        output='&lt;ul&gt;';
        for (i=0; i &lt; obj.count; i++) {
            url = obj.value.items[i].url;
            try {
                title = obj.value.items[i].name[0].content;
                title = title.replace('&lt;title&gt;', '');
                title = title.replace('&lt;/title&gt;', '');
                title = title.replace('Tech Knack: ', '');
            }
            // if we didn't get the title (bad Pipe!), give a pseudo-
            //   title from the URL
            catch (e) {
                title = url.substring(
                             url.lastIndexOf(&quot;/&quot;)+1,
                             url.lastIndexOf(&quot;.html&quot;)
                         ).replace(/\-/g, &quot; &quot;);
            }
            //remove the &lt;title&gt; tags the pipe leaves in.
            output+= '&lt;li&gt;&lt;a href=&quot;'+url+
                     '&quot; title=&quot;'+title+'&quot;&gt;'+title+'&lt;/a&gt;&lt;/li&gt;';
        }
        output += '&lt;/ul&gt;';
        document.getElementById(&quot;popularposts&quot;).innerHTML = output;
    }
    catch (e) {
        var error = &quot;Error fetching data: &quot;+e;
        if (e.toString().indexOf('i')!=-1) error += &quot;&lt;br /&gt;i: &quot;+i;
        document.getElementById(&quot;popularposts&quot;).innerHTML=error;
    }
}
//--&gt;
&lt;/script&gt;
&lt;script src=&quot;http://pipes.yahoo.com/pipes/pipe.run?_id=bi6F5qPK3BGfvuxf1vC6Jw&amp;_render=json&amp;_callback=topcontentCallback&quot; type=&quot;text/javascript&quot;&gt; &lt;/script&gt;
</pre>
</p>
<p>Yes, my JS is admittedly a bit more robust than Chris&#8217;s.  This is mostly because of various issues I either ran into or thought of while trying to implement the widget.  For those who are interested, I&#8217;ll post an explanation of the code in another post.</p>
<p>For this to work, you must enable &#8220;post pages&#8221; in your template&#8217;s preferences.  There might be a way to get this to work without post pages, but I wouldn&#8217;t recommend it <img src='http://techknack.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If you are going to copy and paste this code (probably after cloning my pipe), be sure to change things appropriately:</p>
<p>Change the pipe ID in the last script element to the ID of your new pipe</p>
<p>In the &#8220;title fixup&#8221; section:</p>
<pre class="brush: jscript;">[/js]
            try {
                title = obj.value.items[i].name[0].content;
                title = title.replace('&lt;title&gt;', '');
                title = title.replace('&lt;/title&gt;', '');
                title = title.replace('Tech Knack: ', '');
            }
[js]</pre>
<p>The last &#8220;title.replace&#8221; line removes the site-wide title that is used on every page.  Change it according to your Blogger setup (if you leave it as-is, though, it shouldn&#8217;t hurt anything).</p>
<p>Additional links:<br />
<a href="http://blogoscoped.com/archive/2008-01-17-n73.html">No Google Analytics API?  No Problem!</a><br />
<a href="http://pipes.yahoo.com/">Yahoo! Pipes</a></p>
<img src="http://techknack.net/?ak_action=api_record_view&id=94&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/most-popular-posts-list-for-blogger/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Time for a redesign!</title>
		<link>http://techknack.net/time-for-a-redesign/</link>
		<comments>http://techknack.net/time-for-a-redesign/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 19:22:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[blogs]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/time-for-a-redesign/</guid>
		<description><![CDATA[I chose the dark design for this blog from the default blogger themes&#8230;a looong time ago (or so it seems)!  Since then, I&#8217;ve taken a usability course in school, read many things on the web concerning usability, and been active at Deviant Art.
I believe it is time for a fresh look  
The testing [...]]]></description>
			<content:encoded><![CDATA[<p>I chose the dark design for this blog from the default blogger themes&#8230;a looong time ago (or so it seems)!  Since then, I&#8217;ve taken a usability course in school, read many things on the web concerning usability, and been active at <a href="http://eternicode.deviantart.com/">Deviant Art</a>.</p>
<p>I believe it is time for a fresh look <img src='http://techknack.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> <br />
The testing grounds: <a href="http://techknack2.blogspot.com">techknack2.blogspot.com</a> <img src='http://techknack.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>One of the things I&#8217;ve heard recently is that white text on dark backgrounds is not all that usable.  Cool, but not usable.  As I&#8217;ve gone back and read a couple of my posts, I&#8217;ve realized that it&#8217;s true, especially for long blocks of text; the text just seems to fade into the background after a rather short amount of time.</p>
<p>Another issue I&#8217;ve had is clutter; the more I look at my blog, the more clutter I see.  Whitespace is good; simpler is better.  Keep it simple, stupid.</p>
<p>In my search for templates for the new Blogger, I&#8217;ve found but one that I really like: <a href="http://skins4blogger.blogspot.com/2007/10/azul.html">Azul</a> by karan at <a href="http://skins4blogger.blogspot.com/">Skins4Bogger</a>.  Unfortunately, the XML download is for a completely different theme&#8230;</p>
<p>As per usual, I appreciate any and all feedback.  What do you expect to see in a blog&#8217;s layout?  <i>Where</i> do you expect to see these things?  Should the comment count be before the post, or after?  Etc <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://techknack.net/?ak_action=api_record_view&id=92&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/time-for-a-redesign/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS trick &#8211; two background images</title>
		<link>http://techknack.net/css-trick-two-background-images/</link>
		<comments>http://techknack.net/css-trick-two-background-images/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 20:51:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[blogs]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/css-trick-two-background-images/</guid>
		<description><![CDATA[While using what I&#8217;m sure is my own idea of progressive enhancement on a web page, I came across an interesting situation: I wanted two background images, rather than one.  My first background would be a general tiled image, to give the site&#8217;s background a nice texture; the second a vertically-repeated image on the [...]]]></description>
			<content:encoded><![CDATA[<p>While using what I&#8217;m sure is my own idea of <a href="http://css-discuss.incutio.com/?page=ProgressiveEnhancement">progressive enhancement</a> on a web page, I came across an interesting situation: I wanted <em>two</em> background images, rather than one.  My first background would be a general tiled image, to give the site&#8217;s background a nice texture; the second a vertically-repeated image on the left-hand side, to be used in conjunction with a floating nav menu.</p>
<p>Now, while CSS3 is purported to support up to 8 background images &#8212; no doubt to make <a href="http://blog.yosle.com/2007/09/20/css-round-corners">rounded corners</a> and other fancy borders easier for coders &#8212; the problem is that, to the best of my knowledge, IE and FF don&#8217;t yet support this feature.  Besides that, IE6 and lower never will.  And I&#8217;m not even sure this feature will be usable for what I want, anyway.</p>
<p>So, I had to have (ok, really, <em>really</em> wanted) the left-hand background, and, IMO, the page looked too bland without some texture on the general background.  As I already had the structure of the page decided upon (and, as such, couldn&#8217;t modify it for presentational purposes), I started looking at what I had to work with.  There was obviously the body tag, but there was nothing much else to work with&#8230;besides the html tag itself.</p>
<p>I already had the vertical background applied to the body tag, so I started by removing the background color from body (so the html background could show through).  I then applied the same background color and the new background image to the html tag:</p>
<pre class="brush: css;">
html {
    background: #000 url(&quot;tiled.png&quot;);
}

body {
    background: url(&quot;vertical.gif&quot;) repeat-y;
    background-position: 75px top;
}
</pre>
<p>And, whaddaya know, it worked!  Unfortunately, it seems that declaring the html element&#8217;s style in my CSS changes the basic behavior of the body element, making it more like a containing div.  The result: there&#8217;s a margin around the content, and the vertical background only goes to the end of the content.  Yuck.</p>
<p>So, the first thing to do is fix the ugly margin.  Easy enough: set body&#8217;s margin to 0 , as well as body&#8217;s padding for good measure.  Next, fix body&#8217;s background.  Currently, the background stops at the end of the content area.  Not a problem if the content causes the window to scroll, but not pretty if there&#8217;s not enough content.  I figure this should be easy enough to fix, just set body&#8217;s height to 100%.  This works well enough&#8230;in IE6.  Strangely, FireFox 2 doesn&#8217;t take so kindly to it.  Changing the body&#8217;s height to &#8220;auto&#8221; works alright, for both browsers, for  overflowing content, but not for short content.  A height of &#8220;auto&#8221; and a min-height of 100% works excellently in FireFox 2&#8230;but, again, IE6 doesn&#8217;t know how to treat min-height.  Good grief.</p>
<p>So, I enter the realm of CSS hacks.  Using a <a href="http://www.dustindiaz.com/min-height-fast-hack/">min-height hack</a> combined with advanced CSS selectors that aren&#8217;t understood by IE6 and less, I combine the methods that worked for each browser into a series of rules that are &#8220;browser-filtered&#8221; &#8211; one browser uses one method, while another browser uses the next.</p>
<pre class="brush: css;">
html {
    background: #000 url(&quot;tiled.png&quot;);
    /* Height is 100%, so the body can be 100% */
    height: 100%;
}

body {
    background: url(&quot;vertical.gif&quot;) repeat-y;
    background-position: 75px top;
    margin: 0;
    padding: 0;
    /* Height is 100%, so the tiled BG will tile all the way down
       the page, not just as far down as the page's content
       (when the content's height is less than the window's height) */
    height: 100%;
}
/*
Hackety-hack-hack...
FF2, with the above code, will only display the repeat-y image for as
    high as the window's viewport is; higher content (upon
    scrolling) will not have the bg.
This &quot;hack&quot; makes the tiled background work properly in FF2.
This type of &quot;advanced selector&quot; is not understood by IE6...dunno
 'bout IE7.
*/
html&gt;body {
    min-height: 100%;
    height: auto;
}
</pre>
<p>The common html code works fine on both browsers.  It&#8217;s only the body&#8217;s height issue that needs resolved.  The IE6 code is given in the body code; both browsers will see this and understand it.  However, when they get to the html&gt;body statement, IE6 says &#8220;wha??&#8221; and drops the rule, whereas FF2 says &#8220;ok&#8230;&#8221; and applies the appropriate styles to the body tag, overriding the earlier-mentioned height.</p>
<p><a href="http://techknack.net/examples/css2bg/twobgs.html">View the live example</a> or <a href="http://techknack.net/examples/css2bg/">browse the files</a></p>
<p><em>This post is rather consistently my most-read post on this blog.  If you found the information in this article useful, you may want to check out some of these related articles here on TechKnack:</em></p>
<ul>
<li><a href="http://techknack.net/pretty-up-your-forms-with-css/">Pretty Up Your Forms with CSS</a></li>
<li><a href="http://techknack.net/alternative-link-underlining/">Alternative Link Underlining</a></li>
<li><a href="http://techknack.net/sticky-page-footers/">Sticky Page Footers</a></li>
</ul>
<img src="http://techknack.net/?ak_action=api_record_view&id=90&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/css-trick-two-background-images/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>Slimming down OpenOffice.org Portable</title>
		<link>http://techknack.net/slimming-down-openofficeorg-portable/</link>
		<comments>http://techknack.net/slimming-down-openofficeorg-portable/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 18:47:00 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[desktop]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.techknack.net/slimming-down-openofficeorg-portable/</guid>
		<description><![CDATA[Disclaimer: Please keep in mind that deleting any file from the OpenOffice.org Portable installation is not recommended by the portableapps.com website, as evidenced by their OOoP FAQ and support forum.  By following the steps outlined in this article, in part or in whole, you agree that I am in no way responsible for messing [...]]]></description>
			<content:encoded><![CDATA[<p><i>Disclaimer: Please keep in mind that deleting any file from the OpenOffice.org Portable installation is not recommended by the <a href="http://www.portableapps.com">portableapps.com</a> website, as evidenced by their <a href="http://portableapps.com/node/1468">OOoP FAQ</a> and <a href="http://portableapps.com/forums/support/openoffice_portable">support forum</a>.  By following the steps outlined in this article, in part or in whole, you agree that I am in no way responsible for messing anything up.  But, as one Linux motto says, &#8220;Go for it.  You can always reinstall.&#8221;</i></p>
<p><a href="http://portableapps.com/apps/office/openoffice_portable">OpenOffice.org Portable</a> is a great little office suite, ideal for working with documents on the go.  Unfortunately, while the download is only around 70MB, the full install is 181MB, which may be more than you want to give up &#8212; or even more than you have available, after installing <a href="http://www.portableapps.com">your other portable apps</a>.  Fortunately, the full install comes with some fairly large nonessential files that can be gotten rid of <img src='http://techknack.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>This guide assumes you&#8217;ve installed OOoP to the directory &#8220;\OOP&#8221;.</p>
<p><i>Dictionary files</i><br />
These files are used for spellchecking.  Languages that come in the default installation (to the best of my knowledge), are: three variations of German (de_*), two variations of English (en_*), Hungarian (hu_*), Italian (it_*), Dutch (nl_*), Swahili (sw_*), and Thai (th_*). (<a href="http://www.loc.gov/standards/iso639-2/php/code_list.php">language codes</a> , two-letter codes are under the ISO639-1 list).<br />
While all these languages are nice, I know that, unless I get a German penpal or something, I won&#8217;t be needing anything other than English, and it&#8217;s reasonably safe to delete the other dictionary files to save space.<br />
The dictionary files can be found in the \OOP\App\openoffice\share\dict\ooo directory.  Files you want to delete are in the following formats (the asterisk [*] is a wildcard, in most of the following cases indicating one of the two-letter language codes):</p>
<ul>
<li>*_*.aff</li>
<li>*_*.dic</li>
<li>hyph_*_*.dic</li>
<li>README_*_*.txt</li>
<li>th_*_*.dat</li>
<li>th_*_*.idx</li>
</ul>
<p>For my intallation (keeping only the US English dictionary), I kept only the files DictOOo.sxw, dictionary.lst, en_US.aff, en_US.dic, FontOOo.sxw, hyph_en_US.dic, and WordNet_license.txt.  This cleared up about 52MB.  You may also want to keep the files th_en_US_v2.dat and th_en_US_v2.idx, which seem to be either word definition or thesaurus files, but they will add an extra 20MB to your setup.</p>
<p><i>Templates</i><br />
I know that some people out there use templates when creating new documents, but I&#8217;m not one of those people.  I just create a new document, maybe set up its margins and stuff, and start typing.  If you don&#8217;t use templates, either, you can delete the entire \OOP\App\openoffice\share\template directory, to save almost 8MB.</p>
<p><i>Gallery</i><br />
I really don&#8217;t know what this directory would be used for in the OOoP program, but a quick look at the files inside indicates that it&#8217;s not important for daily document-editing rituals.  Delete \OOP\App\openoffice\share\gallery to save almost 5MB</p>
<p><i>READMEs</i><br />
If you have no use for the README files, delete \OOP\App\openoffice\share\readme to save a whopping 76KB</p>
<p><i>Help Files</i><br />
You may actually want to keep the help files, located in \OOP\App\openoffice\help , in case you ever need a quick how-to or what-is on something in the program.  If not, delete the directory to save 22MB</p>
<p><i>Java &#8220;class&#8221; files</i><br />
OOoP comes with the option to <a href="http://portableapps.com/support/openoffice_portable#java">add java support</a>, but I haven&#8217;t yet seen the need to have this support.  If you don&#8217;t care for Java support, either, delete \OOP\App\openoffice\program\classes to save 8.5MB</p>
<p><i>Extraneous Icon Sets</i><br />
OOoP comes with a few nice icon sets that you can customize your toolbars with, but the cost is 18MB in icon set files.  Open Writer, Calc, or another OOoP program, look through the icon sets (Tools->Options&#8230;, then OpenOffice.org->view in the left pane, in Writer).  Once you&#8217;ve found an icon set you like, go to \OOP\App\openoffice\share\config and delete the three images_*.zip files that you DON&#8217;T want.  I chose to keep the Crystal icon set, images_crystal.zip.  This saves around 13MB</p>
<p>And that&#8217;s it!  You should now have slimmed your OpenOffice.org Portable installation from 181MB to 70-75MB.  Congratulations <img src='http://techknack.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://techknack.net/?ak_action=api_record_view&id=79&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/slimming-down-openofficeorg-portable/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
