<?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>Joe Song &#187; Development</title> <atom:link href="http://joesong.com/category/development/feed/" rel="self" type="application/rss+xml" /><link>http://joesong.com</link> <description>Development, music.</description> <lastBuildDate>Tue, 22 Jun 2010 04:37:09 +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>Overriding Drupal Login Form Messages via Localization</title><link>http://joesong.com/2010/03/overriding-drupal-login-form-messages-via-localization/</link> <comments>http://joesong.com/2010/03/overriding-drupal-login-form-messages-via-localization/#comments</comments> <pubDate>Fri, 19 Mar 2010 16:22:32 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[drupal]]></category> <category><![CDATA[drupal 6]]></category> <category><![CDATA[forms]]></category> <category><![CDATA[localization]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://joesong.com/?p=991</guid> <description><![CDATA[Altering form messages in Drupal via i10n.]]></description> <content:encoded><![CDATA[<h3>Sx</h3><p>We want something besides the default messaging for user forms in Drupal. They are still in English, but just custom to our application. Also, we don&#8217;t need to override all of them, just a few. And, we are using Drupal 6.</p><h3>Dx</h3><p>Drupal is set up to automatically translate form messaging. Using this mechanism, we can cleanly alter the messages to appear just as we would like them to appear. We create a custom language and set it as the default. We only make the few translations that we need and Drupal falls back on the default English for stuff we don&#8217;t translate.</p><p>To setup the custom language:</p><ol
class="default_list"><li>Make sure the Locale module is enabled and that you have permissions to use it (both to Administer Languages and for the Translate Interface)</li><li>Go to Site Configuration -&gt; Languages -&gt; Add Language</li><li>Open the Custom Language form</li><li>Fill in the form with something like:<br
/> Language code: en-MySite<br
/> Language name in English: MySite<br
/> Native language name: MySite<br
/> Path prefix: mysite (this is only a placeholder and won&#8217;t be needed later)<br
/> Language domain: [blank]<br
/> Direction: Left to right</li><li>Click the Add custom language</li><li>Go to Site Configuration -&gt; Languages and choose en-MySite as the default language, click Save Configuration</li></ol><p>To make the faux translations:</p><ol
class="default_list"><li>Go to Site Building -&gt; Translate Interface -&gt; Search</li><li>Search for a particular string by something it contains, say, &#8220;username&#8221;.</li><li>Find your string in the search results and click edit. Enter your translation and submit it.</li><li>Repeat for other strings as necessary.</li></ol><h3>Tx</h3><p>So, we end up with a clean faux translation of the default strings into your application-specific copy.</p> ]]></content:encoded> <wfw:commentRss>http://joesong.com/2010/03/overriding-drupal-login-form-messages-via-localization/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Changing The WAMP Icons</title><link>http://joesong.com/2010/02/changing-the-wamp-icons/</link> <comments>http://joesong.com/2010/02/changing-the-wamp-icons/#comments</comments> <pubDate>Fri, 26 Feb 2010 15:54:02 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category><guid
isPermaLink="false">http://joesong.com/?p=982</guid> <description><![CDATA[How to give WAMP different, alternative, better tray icons.]]></description> <content:encoded><![CDATA[<p>It has kind of bugged me that the <a
href="http://www.wampserver.com/" target="_blank">WAMP</a> status tray icons are all pretty similar to each other. It gets annoying especially because the &#8216;some services running&#8217; and the &#8216;all services running&#8217; are yellow and white, respectively. When you are trying to make and test changes to one of the services those colors look really similar.</p><p>So, I changed which icons it shows and used the better, alternative ones. They are already there in the icon bar in c:\wamp\images_on.bmp and c:\wamp\images_off.bmp. We just have to change the mapping.</p><p>In c:\wamp\wampmanager.tpl change lines 10 &#8211; 12 from</p><pre class="brush: plain;">
TrayIconAllRunning=16
TrayIconSomeRunning=17
TrayIconNoneRunning=18
</pre><p>to</p><pre class="brush: plain;">
TrayIconAllRunning=9
TrayIconSomeRunning=10
TrayIconNoneRunning=11
</pre><p>The downsides: there is no difference between the icons for offline and online modes, the new icons seem meant to be used elsewhere (but I never see them, or at least not nearly as much as I see the tray icons).</p> ]]></content:encoded> <wfw:commentRss>http://joesong.com/2010/02/changing-the-wamp-icons/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Showing in-page and inline content in Lightbox2</title><link>http://joesong.com/2010/02/showing-in-page-and-inline-content-in-lightbox2/</link> <comments>http://joesong.com/2010/02/showing-in-page-and-inline-content-in-lightbox2/#comments</comments> <pubDate>Thu, 25 Feb 2010 18:02:28 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[JavaScript]]></category><guid
isPermaLink="false">http://joesong.com/?p=954</guid> <description><![CDATA[Lightbox2 allows you to load in same-domain content without an iframe using rel="lightmodal". What it doesn't allow you do is use that same mechanism for content already in the page.]]></description> <content:encoded><![CDATA[<p>Lightbox2 allows you to load in same-domain content without an iframe using rel=&#8221;lightmodal&#8221;. What it doesn&#8217;t allow you do is use that same mechanism for content already in the page.</p><p>I&#8217;m working on a project that loads (and hides) content meant for lightbox in the markup of the main page. We are doing this in order to have quick reactions to the users&#8217; clicks and optimize the content for SEO. With the existing mechanism, Lightbox2 will reload the page content if the trigger points to an in-page anchor.  For instance,</p><pre class="brush: xml;">&lt;a href=&quot;#anchors-aweigh&quot;&gt;Load existing content&lt;/a&gt;</pre><p>will cause Lightbox2 to reload the current page even thought the content is already available in-page. This kills the quick reaction time and adds ticks on the tracking calls and increases server load.</p><p>Taking a note from <a
href="http://www.erikhedin.com/web-design/drupal-tips/Easy-Ajax-Nodes-Lightbox-Content" target="_blank">Erik Hedin</a> on how to focus Lightbox on an anchor after (re)loading the page, I rewrote the the modalContainer&#8217;s load instructions to check against the current url and see if the target content is already existing on the page. So, the line</p><pre class="brush: jscript;">$(&quot;#modalContainer&quot;).load(src);</pre><p>in lightbox.js becomes</p><pre class="brush: jscript;">
/* HERE'S THE RUB */

/*
	if already in the page, load in the content
	test by comparing src and window.location without hashes (anchors)
	and then finding the src's hash in the DOM

	if either are false, fall back and load the old way
*/
var srcHash = src.replace(/.*(#.*)/, '$1');
if ((window.location.toString().replace(/#.*/, '') == src.replace(/#.*/, '') ||
			// src.replace(/#.*/, '') will be blank for some IE versions if the href is just a hash
			src.replace(/#.*/, '') == '') &amp;&amp;
			srcHash &amp;&amp; $(srcHash)) {

	// clone the referenced node and alter the clone's ID, then insert it into lightbox
	$(&quot;#modalContainer&quot;).html($(srcHash).clone().attr('id', srcHash.replace('#', '') + '-clone'));

} else {

	$(&quot;#modalContainer&quot;).load(src);

}

/* THE RUB STOPS HERE */
</pre><p>But but but but but but, we&#8217;re not done.</p><p>In Erik&#8217;s post he advises changing the lightbox.js script in the Drupal module. I don&#8217;t like changing other people&#8217;s code; I&#8217;d rather overwrite it for my application. Instead of digging inside the module, I have included another script that overwrites the offending Lightbox.showData method. This way, if the modules is updated by its devs, I don&#8217;t have to go digging again. Plus, our Drupal project is instanced over several machines and a dev and a staging and a production site, so changing the module is hard to maintain.</p><p>So, in the end, my application-specific script looks like,</p><pre class="brush: jscript;">
Lightbox.showData = function(){
    $('#loading').hide();

    if (Lightbox.isLightframe || Lightbox.isVideo || Lightbox.isModal) {
        Lightbox.updateDetails();
        if (Lightbox.isLightframe) {
            $('#frameContainer').show();
            if ($.browser.safari) {
                $('#lightboxFrame').css({
                    'zIndex': '10500'
                }).show();
            } else {
                $('#lightboxFrame').css({
                    'zIndex': '10500'
                }).fadeIn(Lightbox.fadeInSpeed);
            }
        } else {
            if (Lightbox.isVideo) {
                $(&quot;#modalContainer&quot;).html(Lightbox.modalHTML);
                $(&quot;#modalContainer&quot;).click(function(){
                    return false;
                });
            } else {
                var src = unescape(Lightbox.imageArray[Lightbox.activeImage][0]);
                if (Lightbox.imageArray[Lightbox.activeImage][4]) {
                    $(src).appendTo(&quot;#modalContainer&quot;);
                } else {

					/* HERE'S THE RUB */

					/*
						if already in the page, load in the content
						test by comparing src and window.location without hashes (anchors)
						and then finding the src's hash in the DOM

						if either are false, fall back and load the old way
					*/
					var srcHash = src.replace(/.*(#.*)/, '$1');
					if ((window.location.toString().replace(/#.*/, '') == src.replace(/#.*/, '') ||
								// src.replace(/#.*/, '') will be blank for some IE versions if the href is just a hash
								src.replace(/#.*/, '') == '') &amp;&amp;
							srcHash &amp;&amp; $(srcHash)) {

						// clone the referenced node and alter the clone's ID, then insert it into lightbox
						$(&quot;#modalContainer&quot;).html($(srcHash).clone().attr('id', srcHash.replace('#', '') + '-clone'));

					} else {

						$(&quot;#modalContainer&quot;).load(src);

					}

					/* THE RUB STOPS HERE */
                }
                $('#modalContainer').unbind('click');
            }
            $('#modalContainer').css({
                'zIndex': '10500'
            }).show();
        }
    }    // Handle display of image content.
    else {
        $('#imageContainer').show();
        if ($.browser.safari) {
            $('#lightboxImage').css({
                'zIndex': '10500'
            }).show();
        } else {
            $('#lightboxImage').css({
                'zIndex': '10500'
            }).fadeIn(Lightbox.fadeInSpeed);
        }
        Lightbox.updateDetails();
        this.preloadNeighborImages();
    }
    Lightbox.inprogress = false;

    // Slideshow specific stuff.
    if (Lightbox.isSlideshow) {
        if (!Lightbox.loopSlides &amp;&amp; Lightbox.activeImage == (Lightbox.total - 1)) {
            if (Lightbox.autoExit) {
                Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function(){
                    Lightbox.end('slideshow');
                }, Lightbox.slideInterval);
            }
        } else {
            if (!Lightbox.isPaused &amp;&amp; Lightbox.total &gt; 1) {
                Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function(){
                    Lightbox.changeData(Lightbox.activeImage + 1);
                }, Lightbox.slideInterval);
            }
        }
        if (Lightbox.showPlayPause &amp;&amp; Lightbox.total &gt; 1 &amp;&amp; !Lightbox.isPaused) {
            $('#lightshowPause').show();
            $('#lightshowPlay').hide();
        } else
            if (Lightbox.showPlayPause &amp;&amp; Lightbox.total &gt; 1) {
                $('#lightshowPause').hide();
                $('#lightshowPlay').show();
            }
    }

    // Adjust the page overlay size.
    var arrayPageSize = Lightbox.getPageSize();
    var arrayPageScroll = Lightbox.getPageScroll();
    var pageHeight = arrayPageSize[1];
    if (Lightbox.isZoomedIn &amp;&amp; arrayPageSize[1] &gt; arrayPageSize[3]) {
        var lightboxTop = (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1;
        pageHeight = pageHeight + arrayPageScroll[1] + lightboxTop;
    }
    $('#overlay').css({
        'height': pageHeight + 'px',
        'width': arrayPageSize[0] + 'px'
    });

    // Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as
    // expected.
    if ($.browser.mozilla) {
        if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(&quot;.pdf&quot;) != -1) {
            setTimeout(function(){
                document.getElementById(&quot;lightboxFrame&quot;).src = Lightbox.imageArray[Lightbox.activeImage][0];
            }, 1000);
        }
    }
};
</pre>]]></content:encoded> <wfw:commentRss>http://joesong.com/2010/02/showing-in-page-and-inline-content-in-lightbox2/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>HTML and CSS Development Guidelines</title><link>http://joesong.com/2010/02/html-and-css-development-guidelines/</link> <comments>http://joesong.com/2010/02/html-and-css-development-guidelines/#comments</comments> <pubDate>Thu, 18 Feb 2010 17:23:29 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[html]]></category> <category><![CDATA[optimization]]></category> <category><![CDATA[performance]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[progressive enhancement]]></category><guid
isPermaLink="false">http://joesong.com/?p=925</guid> <description><![CDATA[Some rules for HTML and CSS development based on success in the field.]]></description> <content:encoded><![CDATA[<p>*NOTE &#8211; Feb 18, 2010: this is a work in progress. Very likely, there are points not yet included.</p><h2>Philosophical Approach</h2><p>The approach can be summed up in two points:</p><ol
class="default_list"><li>Write enough markup and style definitions to make it clear to other developers what is happening.</li><li>Write as little markup and style definitions as possible.</li></ol><p>Let’s talk about what these mean.</p><h5>Write enough markup and style definitions to make it clear to other developers what is happening.</h5><p>We follow the principles of semantic web development which involves using markup to describe the data or content of a web page. In practice, this means things like using <code>ol</code> and <code>ul</code> tags to make lists of items instead of text delineated with <code>br</code> tags, and giving page elements class names that describe their function (eg “<code>article-wrapper</code>”) instead of class names that describe their appearance (eg “<code>blue-background</code>”).</p><h5>Write as little markup and as few style definitions as possible.</h5><p>Small file size and shallow markup heirarchy make the site faster to load and easier to maintain. To that end, we write as little markup and as few style as possible to make the page appear and function as necessary. In practice, this means things like using <code>padding</code> and <code>margin</code> to create space between elements instead of using <code>br</code> or empty <code>p</code> tags, and writing reusable CSS classes that add common traits (eg <code>background-color</code>) and can be used in conjunction with other reusable CSS classes that provide other common traits (eg <code>font-size</code>).</p><h2>Rules</h2><p>We have a few easy-to-follow rules for HTML and CSS development that have evolved from years of experience.</p><h5>Rules for writing HTML</h5><ul
class="default_list"><li>Block-level elements      are  never be self-closing, even      when empty.<br
/> <code>&lt;div /&gt;</code> should always be written as <code>&lt;div&gt;&lt;/div&gt;</code>, but but <code>&lt;img /&gt;</code> or <code>&lt;span /&gt;</code> is proper.</li><li>Markup always validates      unless there is a very good reason (eg for cross-browser support or CMS      limitations).<br
/> There are many validators but W3C’s is preferred: <a
href="http://validator.w3.org/">http://validator.w3.org/</a></li><li>Documents are written for      HTML 5.<br
/> Documents should use the the <code>&lt;!DOCTYPE html&gt;</code> declaration.</li><li>Tables are used only for      tabular data, not for layout.</li><li>Stylesheets are included      in the <code>&lt;head&gt;</code> of the page.</li><li>Stylesheets are included      using <code>&lt;link /&gt;</code> tags, not <code>@import</code> statements.<br
/> It is permissable, however, to use <code>@import</code> statements within an external stylesheet.</li><li>Markup should be indented      using tabs, not spaces, so that the indentation matches the markup      heirarchy.</li><li>CSS and JavaScript are      included in external files, not written inline in the page.</li><li>External JavaScript files      are included at the bottom of the page just before the <code>&lt;/body&gt;</code>.</li></ul><h5>Rules for writing CSS</h5><ul
class="default_list"><li>CSS is written a compact      format characterized by the selector and all definitions on one line.<br
/> Use <a
href="http://www.codebeautifier.com/">http://www.codebeautifier.com/</a> to switch between formats; the format described here is called ‘High’ compression.<br
/> <strong><em>Improper:<br
/> </em></strong></p><pre class="brush: css;">.my-class {
	width: 300px;
	height: 300px;
}</pre><p><strong><em>Proper:</em></strong></p><pre class="brush: css;">.my-class { width: 300px; height: 300px; }</pre></li><li>Selectors use hyphens to      delineate words, not camel case or underscores.<br
/> Improper: <code>.myClass</code> or <code>#my_element</code>.      Proper: <code>.better-class</code></li><li>Hacks to make pages work      correctly in Internet Explorer are included in a separate IE-specific      stylesheet and included on the page using conditional comments.</li><li>During development, sites      use a global stylesheet for universal definitions and separate sheets for      independent areas or features of the site.</li><li>Use of style attributes in markup is avoided.</li><li>When possible (that is,      when specific instances are known), <code>.png</code> transparency should be fixed for      specific elements using the IE-6 specific stylesheet instead of using an <code>.htc</code> file as a behavior.<br
/> <strong><em>Improper:</em></strong></p><pre class="brush: css;">a { behavior: url(iepngfix.htc); }</pre><p><strong><em>Proper:<br
/> </em></strong></p><pre class="brush: css;">a#button { background: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,      sizingMethod=crop, src='../images/button.png'); }</pre></li><li>The default font size is      declared in pixels for the <code>&lt;body&gt;</code> and      the declared for other elements as percentages.<pre class="brush: css;">body { font-size: 13px; }
h1 { font-size: 125%; }</pre></li></ul> ]]></content:encoded> <wfw:commentRss>http://joesong.com/2010/02/html-and-css-development-guidelines/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Fixing Disqus&#8217; thread.js error in IE</title><link>http://joesong.com/2010/01/fixing-disqus-thread-js-error-in-ie/</link> <comments>http://joesong.com/2010/01/fixing-disqus-thread-js-error-in-ie/#comments</comments> <pubDate>Fri, 22 Jan 2010 21:23:14 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[JavaScript]]></category><guid
isPermaLink="false">http://joesong.com/?p=650</guid> <description><![CDATA[Turns out that the default universal code for Disqus won&#8217;t work in IE (8 or below at time of writing). The cause is a line (#1189 to be exact) in their thread.js that calls the indexOf method on an array. As we all know, IE doesn&#8217;t support the indexOf method for the Array prototype. The [...]]]></description> <content:encoded><![CDATA[<p>Turns out that the default universal code for <a
href="http://disqus.com" target="_blank">Disqus </a>won&#8217;t work in IE (8 or below at time of writing). The cause is a line (#1189 to be exact) in their thread.js that calls the indexOf method on an array.</p><p>As we all know, IE doesn&#8217;t support the indexOf method for the Array prototype. The simple solution is add indexOf support in IE. Here&#8217;s the code:</p><pre class="brush: jscript;">
// add indexOf to arrays in IE
if (!Array.prototype.indexOf){
	Array.prototype.indexOf = function(elt /*, from*/)  {
		var len = this.length;
		var from = Number(arguments[1]) || 0;
		from = (from &lt; 0)
			? Math.ceil(from)
			: Math.floor(from);
		if (from &lt; 0)
			from += len;
		for (; from &lt; len; from++)
		{
			if (from in this &amp;&amp;
					this[from] === elt)
				return from;
		}
		return -1;
	};
}
</pre>]]></content:encoded> <wfw:commentRss>http://joesong.com/2010/01/fixing-disqus-thread-js-error-in-ie/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Avoiding flickering in jQuery when animating elements which contain Flash</title><link>http://joesong.com/2010/01/avoiding-flickering-in-jquery-when-animating-elements-which-contain-flash/</link> <comments>http://joesong.com/2010/01/avoiding-flickering-in-jquery-when-animating-elements-which-contain-flash/#comments</comments> <pubDate>Mon, 18 Jan 2010 21:28:55 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[jQuery]]></category><guid
isPermaLink="false">http://joesong.com/?p=648</guid> <description><![CDATA[jQuery slideToggle or slideDown will cause a Flash movie to flicker if the movie is inside the animated element. A short note on how to fix it.]]></description> <content:encoded><![CDATA[<p>So, we had this issue when were were using slideToggle (and it would apply to slideDown) where the Flash movie contained inside the element we were animating would flicker once the animation is complete.</p><p>What&#8217;s happening: While animating, jQuery needs to add a few style definitions if they are not already declared. Among these is the &#8216;overflow&#8217; property. jQuery sets this to &#8216;hidden&#8217; in order to show the animation and then removes this declaration upon completion of the animation. When the declaration is removed, Flash gets the signal to re-render the movie (because, possibly, the layout of the page has changed).</p><p>How to fix it: declare &#8216;overflow:hidden&#8217; in the CSS for the element. Voilá, the flickering is gone.</p> ]]></content:encoded> <wfw:commentRss>http://joesong.com/2010/01/avoiding-flickering-in-jquery-when-animating-elements-which-contain-flash/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>External Links in New Window. Passive and with MooTools.</title><link>http://joesong.com/2009/11/external-links-in-new-window-passive-and-with-mootools/</link> <comments>http://joesong.com/2009/11/external-links-in-new-window-passive-and-with-mootools/#comments</comments> <pubDate>Wed, 04 Nov 2009 15:50:55 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[mootools]]></category> <category><![CDATA[passive]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://joesong.com/?p=571</guid> <description><![CDATA[Sx All external links from the site should open in a new window. Do not want to write this on a link-by-link basis. Should be light and unobtrusive. Using MooTools. Dx We can easily know what domain the script lives on. Other domains are easily distinguished. Links come and go and are loaded in, sometimes, by [...]]]></description> <content:encoded><![CDATA[<h3>Sx</h3><p>All external links from the site should open in a new window. Do not want to write this on a link-by-link basis. Should be light and unobtrusive. Using MooTools.</p><h3>Dx</h3><p>We can easily know what domain the script lives on. Other domains are easily distinguished. Links come and go and are loaded in, sometimes, by other links. We will use one of my favorite patterns, which I am calling the Passive Click Pattern (got a better or more widely-used name?) to listen to all clicks anywhere on the document.body. In this case, if the click is on a link and the link is external, then we will set the target of the link to &#8216;_blank&#8217;.  Paramount to using the PCP (OMG, I did not realize that was the acronym) is the pattern of not <em>stopping </em>clicks in other patterns but just using <em>preventDefault</em>. That way, the click can flow through the DOM and be heard by multiple listeners.</p><p>This solution requires only the most core of MooTools and is built against version 1.2.3.</p><h3>Tx</h3><pre class="brush: jscript;">
window.addEvent('domready', function(){
	var currentDomain = window.location.host;
	$(document.body).addEvent('click', function(evt) {
		$trgt = $(evt.target);
		if ($trgt.get('tag') !== 'a') {
			$trgt = $trgt.getParent();
		}
		// if the target is a link AND the link is absolute AND the link goes to a different domain,
		// then set the target to _blank to open in new page
		if ($trgt &amp;&amp;
				$trgt.get('tag') === 'a' &amp;&amp;
				$trgt.get('href').test('http') &amp;&amp;
				!$trgt.get('href').test(currentDomain)) {
			$trgt.set('target', '_blank');
		}
	});
});
</pre><h3>EDIT:</h3><p>A more fitting name for this pattern is &#8220;Passive EVENT Pattern&#8221; since it can be applied to more than just clicks. Form submissions, for instance, or key entry.</p><p>Plus, then you can say your application is PEPpy. #amirightfolks</p> ]]></content:encoded> <wfw:commentRss>http://joesong.com/2009/11/external-links-in-new-window-passive-and-with-mootools/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Mootools 1.2 Horizontal Accordion &#8211; the secret revealed</title><link>http://joesong.com/2009/04/mootools-12-horizontal-accordion-the-secret-revealed/</link> <comments>http://joesong.com/2009/04/mootools-12-horizontal-accordion-the-secret-revealed/#comments</comments> <pubDate>Wed, 15 Apr 2009 18:44:42 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[mootools]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://joesong.com/?p=445</guid> <description><![CDATA[Sometimes the API docs are wrong. Since I couldn&#8217;t find out how to do it, I&#8217;ll post the secret here. To make the horizontal accordion work in Mootools 1.2 you have to specify a fixed width. The API docs say it is a Boolean, but it ain&#8217;t. It is what the plugin uses to determine [...]]]></description> <content:encoded><![CDATA[<p>Sometimes the API docs are wrong.</p><p>Since I couldn&#8217;t find out how to do it, I&#8217;ll post the secret here. To make the horizontal accordion work in Mootools 1.2 you have to specify a fixed width. The API docs say it is a Boolean, but it ain&#8217;t. It is what the plugin uses to determine the size of open panels.</p><p>Markup:</p><pre class="brush: xml;">
&lt;ul id=&quot;get-started-steps&quot;&gt;
	&lt;li class=&quot;get-started-step&quot;&gt; &lt;a class=&quot;trigger left&quot; href=&quot;#&quot;&gt;Step 1&lt;/a&gt;
		&lt;div class=&quot;get-started-content left&quot;&gt;step 1 content&lt;/div&gt;
	&lt;/li&gt;
	&lt;li class=&quot;get-started-step&quot;&gt; &lt;a class=&quot;trigger left&quot; href=&quot;#&quot;&gt;Step 2&lt;/a&gt;
		&lt;div class=&quot;get-started-content left&quot;&gt;step 2 content&lt;/div&gt;
	&lt;/li&gt;
	&lt;li class=&quot;get-started-step&quot;&gt; &lt;a class=&quot;trigger left&quot; href=&quot;#&quot;&gt;Step 3&lt;/a&gt;
		&lt;div class=&quot;get-started-content left&quot;&gt;step 3 content&lt;/div&gt;
	&lt;/li&gt;
&lt;/ul&gt;
</pre><p>JS:</p><pre class="brush: jscript;">&lt;br /&gt;
new Accordion(&lt;br /&gt;
$$(’.get-started-step .trigger’),&lt;br /&gt;
$$(’.get-started-content’),&lt;br /&gt;
{&lt;br /&gt;
height: false,&lt;br /&gt;
width: true,&lt;br /&gt;
fixedWidth: 200&lt;br /&gt;
});&lt;br /&gt;
</pre><p>CSS:</p><pre class="brush: css;">&lt;br /&gt;
#get-started-steps { width: 100%; }&lt;br /&gt;
#get-started-steps li { float: left; }&lt;br /&gt;
.get-started-content { width: 200px; height: 200px; }&lt;br /&gt;
.left { float: left; }&lt;br /&gt;
</pre>]]></content:encoded> <wfw:commentRss>http://joesong.com/2009/04/mootools-12-horizontal-accordion-the-secret-revealed/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>New Site for Eclectic Edge Ensemble</title><link>http://joesong.com/2009/03/new-site-for-eclectic-edge-ensemble/</link> <comments>http://joesong.com/2009/03/new-site-for-eclectic-edge-ensemble/#comments</comments> <pubDate>Thu, 05 Mar 2009 14:50:55 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Reviews]]></category><guid
isPermaLink="false">http://joesong.com/?p=434</guid> <description><![CDATA[Eclectic Edge got a gorgeous new website (http://www.eclecticedgeensemble.com/). Bully for them. I had built the version 1 a while ago and am glad to see they&#8217;re moving beyond my pretty limited design. Also, that Amanda Hankerson (http://www.amandahankerson.com)is a wonderful photographer. (She took the photos for the EEE site and has a great photo blog.)]]></description> <content:encoded><![CDATA[<p>Eclectic Edge got a gorgeous new website (<a
href="http://www.eclecticedgeensemble.com/">http://www.eclecticedgeensemble.com/</a>). Bully for them. I had built the version 1 a while ago and am glad to see they&#8217;re moving beyond my pretty limited design.</p><p><img
class="alignright size-medium wp-image-437" title="eee_newsite" src="http://joesong.com/wp-content/uploads/2009/03/eee_newsite-300x163.jpg" alt="eee_newsite" width="300" height="163" />Also, that Amanda Hankerson (<a
href="http://www.amandahankerson.com">http://www.amandahankerson.com</a>)is a wonderful photographer. (She took the photos for the EEE site and has a great photo blog.)</p> ]]></content:encoded> <wfw:commentRss>http://joesong.com/2009/03/new-site-for-eclectic-edge-ensemble/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>On abandoning the Zend Framework (for now)</title><link>http://joesong.com/2009/02/on-abandoning-the-zend-framework-for-now/</link> <comments>http://joesong.com/2009/02/on-abandoning-the-zend-framework-for-now/#comments</comments> <pubDate>Fri, 27 Feb 2009 20:20:18 +0000</pubDate> <dc:creator>josephsong</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://joesong.com/?p=431</guid> <description><![CDATA[So, I thought I&#8217;d give the Zend Framework a try. Please, keep in mind that this was a short trial and the real reason for leaving the framework was a specific unmet need for intermediate LDAP support. I plan on coming back to it and giving it a fuller run but I have to go [...]]]></description> <content:encoded><![CDATA[<p>So, I thought I&#8217;d give the <a
href="http://framework.zend.com/" target="_blank">Zend Framework</a> a try. Please, keep in mind that this was a short trial and the real reason for leaving the framework was a specific unmet need for intermediate LDAP support. I plan on coming back to it and giving it a fuller run but I have to go elsewhere for the moment.</p><p>SO, THIS IS A QUICK IMPRESSION.</p><p>What I liked:</p><ul><li>lots of flexibility in names and paths</li><li>seemed like reliably tested code</li><li>default directory structure leaves public in top level of project</li><li>LOVED, absolutely LOVED that the project manager replied to my twitter instantly</li></ul><p>What I disliked:</p><ul><li>does not ship with a full default directory structure (Rend fixes this, but still). Give me a suggestion and I can change it if the default doesn&#8217;t work for me</li><li>minimal LDAP support (auth only). More is coming I know (its in the incubator), and I have a very specific need for it. I&#8217;m not going to hold it against ZF. But a guy&#8217;s gotta search when he wants to find people at work.</li><li>documentation. A long list of anchors in a longer page? Really? Plus, where, exactly, are the 500 examples in 6 languages?</li><li>there is a lot of typing. Maybe I was following the wrong tutorial but I have to tell the model that the $_POST['title'] should go into the title column when I insert the row? I feel like it could match those for me.</li><li>mixed Camel_And_Deliminated variable names. This is a nitpicky thing, but typing an underscore followed by a capital letter is hard for my hands for some reason.</li><li>error messaging. If I had used the framework before I would probably find the error messaging tight and focused. But, since I had not, it took a bit to figure out what was causing my errors. Probably a shortcoming in my brain architecture, but the errors didn&#8217;t seem obvious.</li><li>Google support. This is out of Zend&#8217;s control I know, but I was searching and searching for zend tutorial, zend framework tutorial, zend connect to database, etc. and only found a couple of tutorials that were up-to-date and well written. One was Zend&#8217;s quickstart (which only has sqlite) and the other was <a
href="http://akrabat.com/zend-framework-tutorial/" target="_blank">here</a> (which is the one I followed for db stuff).</li></ul><p>So, there it is.</p> ]]></content:encoded> <wfw:commentRss>http://joesong.com/2009/02/on-abandoning-the-zend-framework-for-now/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)

Served from: joesong.com @ 2010-07-31 09:40:01 -->