<?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>Shawson&#039;s Code Blog &#187; Javascript</title>
	<atom:link href="http://codeblog.shawson.co.uk/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeblog.shawson.co.uk</link>
	<description>development notes for my failing memory</description>
	<lastBuildDate>Tue, 15 May 2012 15:22:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Highcharts- Highlight the last clicked bar</title>
		<link>http://codeblog.shawson.co.uk/highcharts-highlight-the-last-clicked-bar/</link>
		<comments>http://codeblog.shawson.co.uk/highcharts-highlight-the-last-clicked-bar/#comments</comments>
		<pubDate>Thu, 10 May 2012 09:40:21 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1351</guid>
		<description><![CDATA[This is handy, only really if you have charts which, on click, have drill down data which pops up, perhaps in a table underneath or something- I basically just wanted to highlight the last clicked column in a column chart; Check it out on jsFiddle : http://jsfiddle.net/shawson/CkkbF/8/ Related posts:Adding cross browser consistent keyboard short-cuts to [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/adding-cross-browser-consistent-keyboard-short-cuts-to-your-website/' rel='bookmark' title='Adding cross browser consistent keyboard short-cuts to your website'>Adding cross browser consistent keyboard short-cuts to your website</a></li>
<li><a href='http://codeblog.shawson.co.uk/phonegap-deselecting-items-from-the-tab-bar/' rel='bookmark' title='PhoneGap &#8211; Deselecting All Items from the tab bar!'>PhoneGap &#8211; Deselecting All Items from the tab bar!</a></li>
<li><a href='http://codeblog.shawson.co.uk/unit-testing-javascript-event-handlers-or-any-other-asynchronous-delegate-calls-using-jsunit/' rel='bookmark' title='Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit'>Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>This is handy, only really if you have charts which, on click, have drill down data which pops up, perhaps in a table underneath or something- I basically just wanted to highlight the last clicked column in a column chart;</p>
<p>Check it out on jsFiddle : <a href="http://jsfiddle.net/shawson/CkkbF/8/" target="_blank">http://jsfiddle.net/shawson/CkkbF/8/</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/adding-cross-browser-consistent-keyboard-short-cuts-to-your-website/' rel='bookmark' title='Adding cross browser consistent keyboard short-cuts to your website'>Adding cross browser consistent keyboard short-cuts to your website</a></li>
<li><a href='http://codeblog.shawson.co.uk/phonegap-deselecting-items-from-the-tab-bar/' rel='bookmark' title='PhoneGap &#8211; Deselecting All Items from the tab bar!'>PhoneGap &#8211; Deselecting All Items from the tab bar!</a></li>
<li><a href='http://codeblog.shawson.co.uk/unit-testing-javascript-event-handlers-or-any-other-asynchronous-delegate-calls-using-jsunit/' rel='bookmark' title='Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit'>Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/highcharts-highlight-the-last-clicked-bar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Recursive jQuery Drop Down Menu&#8217;s</title>
		<link>http://codeblog.shawson.co.uk/recursive-jquery-drop-down-menus/</link>
		<comments>http://codeblog.shawson.co.uk/recursive-jquery-drop-down-menus/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 12:40:24 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1332</guid>
		<description><![CDATA[Following on from my previous post about drop downs, I recently expanded the code to allow for sub menus- as many levels deep as you would like. The Code: $(document).ready(function () { // Shawsons&#039; Teeny-Tiny Recursive Drop Downs! $(&#039;.drop-down-menu&#62;li&#62;ul&#039;).hide().mouseleave(function () { $(&#039;.highlighted&#039;, this).removeClass(&#039;highlighted&#039;); $(this).hide(); }); $(&#039;.drop-down-menu li&#62;a&#039;).mouseenter(function () { var menu_root = $(this).parent().parent(); $(&#039;ul&#039;, menu_root).hide(); [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/' rel='bookmark' title='Quick &amp; Tiny jQuery Drop Down Menus'>Quick &#038; Tiny jQuery Drop Down Menus</a></li>
<li><a href='http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/' rel='bookmark' title='Using JQueryUI combobox() with KnockoutJS'>Using JQueryUI combobox() with KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Following on from my <a href="http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/" title="Quick &#038; Tiny jQuery Drop Down Menus">previous post about drop downs</a>, I recently expanded the code to allow for sub menus- as many levels deep as you would like.</p>
<p>The Code:</p>
<pre class="brush: javascript">
$(document).ready(function () { // Shawsons&#039; Teeny-Tiny Recursive Drop Downs!
    $(&#039;.drop-down-menu&gt;li&gt;ul&#039;).hide().mouseleave(function () {
        $(&#039;.highlighted&#039;, this).removeClass(&#039;highlighted&#039;);
        $(this).hide();
    });
    $(&#039;.drop-down-menu li&gt;a&#039;).mouseenter(function () {
        var menu_root = $(this).parent().parent();
        $(&#039;ul&#039;, menu_root).hide();
        $(&#039;.highlighted&#039;, menu_root).removeClass(&#039;highlighted&#039;);
        $(&#039;&gt;ul&#039;, $(this).addClass(&#039;highlighted&#039;).parent()).show();
    }).mouseleave(function (o) {
        if ($(this).parent().has($(o.relatedTarget)).length &lt; 1) {
            $(&#039;ul&#039;, $(this).parent()).hide();
        }
    });
});
</pre>
<p>The Markup:</p>
<pre class="brush: html">
&lt;ul class=&quot;drop-down-menu&quot;&gt;
        &lt;li&gt;Drop Down Menu - Demo Title : &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 1&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;a.htm&quot;&gt;a&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;b.htm&quot;&gt;b&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;c.htm&quot;&gt;c &amp;raquo;&lt;/a&gt;
                    &lt;ul&gt;
                        &lt;li&gt;&lt;a href=&quot;c-a.htm&quot;&gt;c-a&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href=&quot;c-b.htm&quot;&gt;c-b &amp;raquo;&lt;/a&gt;
                          &lt;ul&gt;
                              &lt;li&gt;&lt;a href=&quot;c-b-a.htm&quot;&gt;c-b-a&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=&quot;c-b-b.htm&quot;&gt;c-b-b &amp;raquo;&lt;/a&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;&lt;a href=&quot;c-b-b-a.htm&quot;&gt;c-b-b-a&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                        &lt;/li&gt;
                        &lt;li&gt;&lt;a href=&quot;c-c.htm&quot;&gt;c-c&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 2&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;d.htm&quot;&gt;d&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;e.htm&quot;&gt;e&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;f.htm&quot;&gt;f&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
</pre>
<p>Some CSS:</p>
<pre class="brush: css">

.drop-down-menu { display:block; }
.drop-down-menu li { float:left; padding: 8px; }
.drop-down-menu&gt;li&gt;a { padding:8px; }
.drop-down-menu li ul
{
    position:absolute;
    background-color:#fff;
    border: 1px solid #999;
    border-radius: 0px 7px 7px 7px; -moz-border-radius:0px 7px 7px 7px; -webkit-border-radius:0px 7px 7px 7px;
    padding:5px;
    width: 50px;
}
.drop-down-menu li ul a {
   display:block;
   width:50px;
}
.drop-down-menu li ul li ul
{
    margin-left:50px;
    margin-top: -20px;
}
.drop-down-menu li ul li { float:none; }
.drop-down-menu li ul li a { color:#000; }
.drop-down-menu li ul a.highlighted { background-color:#F68833; }
</pre>
<p>Demo : </p>
<style type="text/css">
ul.drop-down-menu, ul.drop-down-menu li { margin:0; padding:0; list-style:none; }
.drop-down-menu { display:block; }
.drop-down-menu li { float:left; padding: 8px; }
.drop-down-menu>li>a { padding:8px; }
.drop-down-menu li ul  
{
    position:absolute; 
    background-color:#fff; 
    border: 1px solid #999;
    border-radius: 0px 7px 7px 7px; -moz-border-radius:0px 7px 7px 7px; -webkit-border-radius:0px 7px 7px 7px;
    padding:5px; 
    width: 50px;
}
.drop-down-menu li ul a {
   display:block;
   width:50px;
}
.drop-down-menu li ul li ul 
{
    margin-left:50px;
    margin-top: -20px;
}
.drop-down-menu li ul li { float:none; }
.drop-down-menu li ul li a { color:#000; }
.drop-down-menu li ul a.highlighted { background-color:#F68833; }
</style>
<p><script type="text/javascript">
jQuery(document).ready(function () { // Shawsons' Teeny-Tiny Recursive Drop Downs!
    jQuery('.drop-down-menu>li>ul').hide().mouseleave(function () {
        jQuery('.highlighted', this).removeClass('highlighted');
        jQuery(this).hide();
    });
    jQuery('.drop-down-menu li>a').mouseenter(function () {
        var menu_root = jQuery(this).parent().parent();
        jQuery('ul', menu_root).hide();
        jQuery('.highlighted', menu_root).removeClass('highlighted');
        jQuery('>ul', jQuery(this).addClass('highlighted').parent()).show();
    }).mouseleave(function (o) {
        if (jQuery(this).parent().has(jQuery(o.relatedTarget)).length < 1) {
            jQuery('ul', jQuery(this).parent()).hide();
        }
    });
});
</script></p>
<div style="background-color:#ccc; border: solid 1px #000; height: 200px; padding:10px;">
<ul class="drop-down-menu">
<li>Drop Down Menu - Demo Title : </li>
<li><a href="">Menu 1</a>
<ul>
<li><a href="a.htm">a</a></li>
<li><a href="b.htm">b</a></li>
<li><a href="c.htm">c &raquo;</a>
<ul>
<li><a href="c-a.htm">c-a</a></li>
<li><a href="c-b.htm">c-b &raquo;</a>
<ul>
<li><a href="c-b-a.htm">c-b-a</a></li>
<li><a href="c-b-b.htm">c-b-b &raquo;</a>
<ul>
<li><a href="c-b-b-a.htm">c-b-b-a</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="c-c.htm">c-c</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="">Menu 2</a>
<ul>
<li><a href="d.htm">d</a></li>
<li><a href="e.htm">e</a></li>
<li><a href="f.htm">f</a></li>
</ul>
</li>
</ul>
<div style="clear:both">&nbsp;</div>
</div>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/' rel='bookmark' title='Quick &amp; Tiny jQuery Drop Down Menus'>Quick &#038; Tiny jQuery Drop Down Menus</a></li>
<li><a href='http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/' rel='bookmark' title='Using JQueryUI combobox() with KnockoutJS'>Using JQueryUI combobox() with KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/recursive-jquery-drop-down-menus/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding cross browser consistent keyboard short-cuts to your website</title>
		<link>http://codeblog.shawson.co.uk/adding-cross-browser-consistent-keyboard-short-cuts-to-your-website/</link>
		<comments>http://codeblog.shawson.co.uk/adding-cross-browser-consistent-keyboard-short-cuts-to-your-website/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 22:55:54 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1324</guid>
		<description><![CDATA[I wanted to employ keyboard short cuts to a frequently used internal web app used within the company- Pinch o&#8217; the proverbial piss I thought- I&#8217;ll just use access keys! I&#8217;ve used them before on front facing sites for accessibility- but when I actually came to document these keys for the users I realised that [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/' rel='bookmark' title='Using JQueryUI combobox() with KnockoutJS'>Using JQueryUI combobox() with KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/' rel='bookmark' title='Grouped pagination links function in JavaScript'>Grouped pagination links function in JavaScript</a></li>
<li><a href='http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/' rel='bookmark' title='Quick &amp; Tiny jQuery Drop Down Menus'>Quick &#038; Tiny jQuery Drop Down Menus</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I wanted to employ keyboard short cuts to a frequently used internal web app used within the company- Pinch o&#8217; the proverbial piss I thought- I&#8217;ll just use access keys!  I&#8217;ve used them before on front facing sites for accessibility- but when I actually came to document these keys for the users I realised that support across different browsers is a mess;</p>
<p><strong>IE</strong> Alt + {key}then hit return<br />
<strong>Firefox</strong> Alt + Shift + {key}<br />
<strong>Chrome</strong> Alt + {key} (the most sensible implementation, in my opinion)</p>
<p>IE also seems to refuse to aknowlege the links unless they are currently visible, and as the options I was short cutting existed in drop down menus this was no good, as they existing in bulleted lists which are &#8220;display:none&#8221; until the user mouses-over the menu bar (<a href="http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/" title="Quick &#038; Tiny jQuery Drop Down Menus">using my tiny drop down menu code</a>)!</p>
<p>So to get around this I wrote some jQuery which standardises the short cuts- <strong>note this is no good for normal accessibility uses</strong> as it&#8217;s a new key combo which none of the browsers use, so without documentation no one will know- but for my use on an internal system it&#8217;s perfect.  </p>
<p>I took the decision to make all the short cuts Ctrl+Alt+{key}, and wanted to keep using the accesskey attribute on my links rather than introduce another mechanism for dictating which keys triggered what- I also wanted to ensure if the link had a javascript onclick handler, instead of navigating away, we respect the handler and simply trigger that.  Here&#8217;s the code;</p>
<pre class="brush: javascript">
$(document).keydown(function(e) {
	if (e.ctrlKey &amp;&amp; e.altKey &amp;&amp; e.which &gt;= 65 &amp;&amp; e.which &lt;= 122) {
		e.preventDefault();

		var key = String.fromCharCode(e.which);
		var the_link = $(&quot;a[accesskey=&quot; + key.toLowerCase() + &quot;]&quot;);

		if (typeof(the_link) != &#039;undefined&#039;) {
			// does this link have a javascript assigned click handler, or do we simply send the user to the links href value?
			var events = $.data( $(the_link).get(0), &#039;events&#039; );
			if (typeof(events) != &#039;undefined&#039;) {
				if (typeof(events.click) != &#039;undefined&#039;) {
					$(the_link).click();
					return;
				}
			}
			window.location = $(the_link).attr(&#039;href&#039;);
		}
	}
});
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/' rel='bookmark' title='Using JQueryUI combobox() with KnockoutJS'>Using JQueryUI combobox() with KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/' rel='bookmark' title='Grouped pagination links function in JavaScript'>Grouped pagination links function in JavaScript</a></li>
<li><a href='http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/' rel='bookmark' title='Quick &amp; Tiny jQuery Drop Down Menus'>Quick &#038; Tiny jQuery Drop Down Menus</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/adding-cross-browser-consistent-keyboard-short-cuts-to-your-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quick &amp; Tiny jQuery Drop Down Menus</title>
		<link>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/</link>
		<comments>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 12:25:16 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1311</guid>
		<description><![CDATA[Note: this has been superseded by the recursive drop down menu script. The Code: $(document).ready(function () { // Shawsons&#039; Teeny-Tiny Drop Downs! $(&#039;.drop-down-menu li ul&#039;).hide().mouseleave(function () { $(this).hide(); }); $(&#039;.drop-down-menu&#62;li&#62;a&#039;).mouseenter(function () { $(&#039;ul&#039;, $(this).parent().parent()).hide(); $(&#039;ul&#039;, $(this).parent()).show(); }).mouseleave(function (o) { if ($(this).parent().has($(o.relatedTarget)).length &#60; 1) { $(&#039;ul&#039;, $(this).parent()).hide(); } }); }); The Markup: &#60;ul class=&#34;drop-down-menu&#34;&#62; &#60;li&#62;Available Actions [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/recursive-jquery-drop-down-menus/' rel='bookmark' title='Recursive jQuery Drop Down Menu&#8217;s'>Recursive jQuery Drop Down Menu&#8217;s</a></li>
<li><a href='http://codeblog.shawson.co.uk/oo-inheritance-with-javascript/' rel='bookmark' title='OO &amp; Inheritance with Javascript'>OO &#038; Inheritance with Javascript</a></li>
<li><a href='http://codeblog.shawson.co.uk/adding-cross-browser-consistent-keyboard-short-cuts-to-your-website/' rel='bookmark' title='Adding cross browser consistent keyboard short-cuts to your website'>Adding cross browser consistent keyboard short-cuts to your website</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Note: this has been superseded by <a href="http://codeblog.shawson.co.uk/recursive-jquery-drop-down-menus/" title="Recursive jQuery Drop Down Menu’s">the recursive drop down menu script.</a></p>
<p>The Code:</p>
<pre class="brush: javascript">
$(document).ready(function () { // Shawsons&#039; Teeny-Tiny Drop Downs!
    $(&#039;.drop-down-menu li ul&#039;).hide().mouseleave(function () {
        $(this).hide();
    });
    $(&#039;.drop-down-menu&gt;li&gt;a&#039;).mouseenter(function () {
        $(&#039;ul&#039;, $(this).parent().parent()).hide();
        $(&#039;ul&#039;, $(this).parent()).show();
    }).mouseleave(function (o) {
        if ($(this).parent().has($(o.relatedTarget)).length &lt; 1) {
            $(&#039;ul&#039;, $(this).parent()).hide();
        }
    });
});
</pre>
<p>The Markup:</p>
<pre class="brush: html">
&lt;ul class=&quot;drop-down-menu&quot;&gt;
        &lt;li&gt;Available Actions : &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 1&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;a.htm&quot;&gt;a&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;b.htm&quot;&gt;b&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;c.htm&quot;&gt;c&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 2&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;d.htm&quot;&gt;d&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;e.htm&quot;&gt;e&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;f.htm&quot;&gt;f&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
</pre>
<p>Some CSS:</p>
<pre class="brush: css">
.drop-down-menu { display:block; }
.drop-down-menu li { float:left; padding: 8px; }
.drop-down-menu li a { padding:8px; }
.drop-down-menu li ul
{
    position:absolute;
    background-color:#fff;
    border: 1px solid #999;
    border-radius: 0px 7px 7px 7px; -moz-border-radius:0px 7px 7px 7px; -webkit-border-radius:0px 7px 7px 7px;
    padding:5px;
}
.drop-down-menu li ul li { float:none; }
.drop-down-menu li ul li a { color:#000; }
.drop-down-menu li ul li:hover { background-color:#F68833; }
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/recursive-jquery-drop-down-menus/' rel='bookmark' title='Recursive jQuery Drop Down Menu&#8217;s'>Recursive jQuery Drop Down Menu&#8217;s</a></li>
<li><a href='http://codeblog.shawson.co.uk/oo-inheritance-with-javascript/' rel='bookmark' title='OO &amp; Inheritance with Javascript'>OO &#038; Inheritance with Javascript</a></li>
<li><a href='http://codeblog.shawson.co.uk/adding-cross-browser-consistent-keyboard-short-cuts-to-your-website/' rel='bookmark' title='Adding cross browser consistent keyboard short-cuts to your website'>Adding cross browser consistent keyboard short-cuts to your website</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Grouped pagination links function in JavaScript</title>
		<link>http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/</link>
		<comments>http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 09:28:17 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1276</guid>
		<description><![CDATA[I just created a JavaScript port of an awesome bit of pagination code I first used years and years ago while working in Classic ASP, originally written by Dave Child who I was working with at the time. The original can be found on this site here. It&#8217;s an awesome script when you have 100&#8242;s [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/javascript-profiling-in-ie7/' rel='bookmark' title='Javascript profiling in IE7&#8230;'>Javascript profiling in IE7&#8230;</a></li>
<li><a href='http://codeblog.shawson.co.uk/work-starts-on-my-webgl-game/' rel='bookmark' title='Work Starts on my WebGL Game!'>Work Starts on my WebGL Game!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I just created a  JavaScript port of an awesome bit of pagination code I first used years and years ago while working in Classic ASP, originally written by <a href="http://www.addedbytes.com/" target="_blank">Dave Child</a> who I was working with at the time.  The <a href="http://www.addedbytes.com/lab/vbscript-pagination/" title="VBScript Grouped Pagination Links on AddedBytes.com" target="_blank">original can be found on this site here</a>.</p>
<p>It&#8217;s an awesome script when you have 100&#8242;s of pages of data (which probably suggests you need to implement some good filtering and search features to save your poor users..) and presents the links like so..</p>
<p>    « Prev 1 2 3 &#8230; 7 [8] 9 &#8230; 208 209 210 Next »</p>
<pre class="brush: javascript">
function BuildGroupedPagination(current_page, total_pages, base_url, seperator)
{
	var url = base_url;
	var strPages = &quot;&quot;;
	var intMaxPages = 0;
	var intMinPages = 0;
	var intPaginI = 0;

    if (typeof(seperator) == &#039;undefined&#039;)
    {
        seperator = &quot; &quot;;
    }

	if (total_pages &gt; 10)
	{
		if (total_pages &gt; 3)
		{
			intMaxPages = 3;
		}
		else
		{
			intMaxPages = total_pages;
		} 

		for (intPaginI = 1; intPaginI &lt;= intMaxPages; intPaginI++)
		{

			if (intPaginI == current_page)
			{
				strPages += &quot;&lt;strong&gt;[&quot; + intPaginI + &quot;]&lt;/strong&gt;&quot;;
			}
			else
			{
				strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
			} 

			if (intPaginI &lt; intMaxPages)
			{
				strPages += seperator;
			}
		} 

		if (total_pages &gt; 3)
		{
			if ((current_page &gt; 1) &amp;&amp; (current_page &lt; total_pages))
			{
				if (current_page &gt; 5)
				{
					strPages += &quot; ... &quot;;
				}
				else
				{
					strPages += seperator;
				} 

				if (current_page &gt; 4)
				{
					intMinPages = current_page;
				}
				else
				{
					intMinPages = 5;
				} 

				if (current_page &lt; total_pages - 4)
				{
					intMaxPages = current_page;
				}
				else
				{
					intMaxPages = total_pages - 4;
				} 

				for (intPaginI = intMinPages - 1 ; intPaginI &lt;= intMaxPages + 1; intPaginI++)
				{
					if (intPaginI == current_page)
					{
						strPages += &quot;&lt;strong&gt;[&quot; + intPaginI + &quot;]&lt;/strong&gt;&quot;;
					}
					else
					{
						strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
					}

					if (intPaginI &lt; intMaxPages + 1)
					{
						strPages += seperator;
					}
				}

				if (current_page &lt; total_pages - 4)
				{
					strPages += &quot; ... &quot;;
				}
				else
				{
					strPages += seperator;
				}
			}
			else
			{
				strPages += &quot; ... &quot;;
			} 

			for (intPaginI = total_pages - 2; intPaginI &lt;= total_pages; intPaginI++) {
				if (intPaginI == current_page) {
					strPages += &quot;&lt;strong&gt;[&quot; + intPaginI + &quot;]&lt;/strong&gt;&quot;;
				}
				else {
					strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
				} 

				if (intPaginI &lt; total_pages) {
					strPages += seperator;
				}
			}
		}
	}
	else
	{
		for (intPaginI = 1; intPaginI &lt;= total_pages; intPaginI++)
		{
			if (intPaginI == current_page)
			{
				strPages += &quot;&lt;strong&gt;&quot; + intPaginI + &quot;&lt;/strong&gt;&quot;;
			}
			else
			{
				strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
			} 

			if (intPaginI &lt; total_pages)
			{
				strPages += seperator;
			}
		}
	}
	return strPages;
}
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/javascript-profiling-in-ie7/' rel='bookmark' title='Javascript profiling in IE7&#8230;'>Javascript profiling in IE7&#8230;</a></li>
<li><a href='http://codeblog.shawson.co.uk/work-starts-on-my-webgl-game/' rel='bookmark' title='Work Starts on my WebGL Game!'>Work Starts on my WebGL Game!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jqZoomage jQuery component</title>
		<link>http://codeblog.shawson.co.uk/jqzoomage-jquery-component/</link>
		<comments>http://codeblog.shawson.co.uk/jqzoomage-jquery-component/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 20:40:34 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1210</guid>
		<description><![CDATA[I&#8217;ve built a simple jQuery plugin for use on a website I&#8217;m building and am in the process of submitting it to the jQuery plugins website. It&#8217;s a simple zoom panel, allowing your users to mouse over portions of your small image, to see a close up view. Ideal for use on product details page [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/' rel='bookmark' title='Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor'>Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-accordion-control-links-not-working/' rel='bookmark' title='JQuery Accordion Control links not working'>JQuery Accordion Control links not working</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve built a simple jQuery plugin for use on a website I&#8217;m building and am in the process of submitting it to the jQuery plugins website.  It&#8217;s a simple zoom panel, allowing your users to mouse over portions of your small image, to see a close up view.  Ideal for use on product details page or similar.</p>
<h3>Screenshot</h3>
<p><a href="http://codeblog.shawson.co.uk/jqzoomage-jquery-component/jqzoomagedemo/" rel="attachment wp-att-1213"><img src="http://codeblog.shawson.co.uk/wp-content/uploads/2011/09/jqZoomageDemo.png" alt="" title="jqZoomageDemo" width="600" class="aligncenter size-full wp-image-1213" /></a></p>
<h3>Installation</h3>
<p>Just add a reference to the script at the bottom of your page (where all your js should be anyway!)- as shown in the demo, this is a basic example;</p>
<pre class="brush: javascript">
$(window).ready(function() {
	$(&quot;#dinky-img&quot;).zoomage({
		zoomedImageContainer: &quot;#big-img&quot;,
		zoomedImageUrl: &quot;big-image.gif&quot;,
		stayActiveOnMouseOut: false,
		zoomedImageStartsCentered: true
	});
});
</pre>
<p>There are a couple of styles which are required for the view finder, and the mask which goes over the image (allowing you to customise the look)- add these rules to your style sheet somewhere;</p>
<pre class="brush: css">
#zoomage-view-finder { border: 1px solid #fff; }
.zoomage-view-finder-surround { background-color:#fff; opacity:0.7; }
</pre>
<p>As a general point, it&#8217;s best to run the script in a $(window).load() rather than the standard $(document).load(), as this ensures that all the images are loaded before the script begins, otherwise the script runs and grabs the width() and height() of the image to work out ratios, but these get returned as 0&#8242;s!  More info on this can be found on the <a href="http://stackoverflow.com/questions/544993/official-way-to-ask-jquery-wait-for-all-images-to-load-before-executing-something" target="_blank">stack overflow issue about this</a></p>
<h3>Configuration</h3>
<p><strong>zoomedImageContainer</strong> * Required *<br />
Default Value : &#8220;#zoom-image-container&#8221;<br />
This is the jQuery selector for the div which will act as the close up view for your image.</p>
<p><strong>zoomedImageUrl</strong> * Required *<br />
Default Value : &#8220;&#8221;<br />
This is the URL of the zoomed image file.  I generally use images 3 times larger than the original, however there isn&#8217;t a limit.  The scale ratio is calculated on load.</p>
<p><strong>stayActiveOnMouseOut</strong><br />
Default Value : false<br />
If this is set to true, the view finder will continue to show in it&#8217;s last position even when the mouse pointer is moved off of the image.  If false, the view finder will disappear on mouse out.</p>
<p><strong>zoomedImageStartsCentered</strong><br />
Default Value : true<br />
Indicates that, on load, the zoomed image view shows the center of the image.</p>
<p><strong>centerOnMouseOut</strong><br />
Default Value : true<br />
If true, on mouse out, the zoomed view will return to the center of the zoomed image.</p>
<h3>Live Demo</h3>
<p><a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/demo.htm" title="jqZoomage demo page" target="_blank">You can check out a real life working version of it here!</a></p>
<p>Tested across all the major modern browsers (IE9/ FF4/ Chrome10)- give me a shout if you spot an issue.</p>
<h3>Download</h3>
<p>Current Version 1.2 &#8211; 2011-09-10<br />
<a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/jquery.zoomage-1.2.js" title="jqZoomage demo page" target="_blank">Unminified Development Version</a><br />
<a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/jquery.zoomage-1.2.min.js" title="jqZoomage demo page" target="_blank">Minified Production Version</a></p>
<h3>Licence</h3>
<p>This plugin is available for use under the MIT licence.  For more info see <a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/licence.txt">http://codeblog.shawson.co.uk/storage/jquery.zoomage/licence.txt</a></p>
<h3>jQuery Plugin Site Link</h3>
<p>The official jQuery Plugin catalogue link for this plugin is <a href="http://plugins.jquery.com/project/jqZoomage">http://plugins.jquery.com/project/jqZoomage</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/' rel='bookmark' title='Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor'>Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-accordion-control-links-not-working/' rel='bookmark' title='JQuery Accordion Control links not working'>JQuery Accordion Control links not working</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/jqzoomage-jquery-component/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>New Adobe HTML5 Animation tool &#8220;Edge&#8221;- free tech preview</title>
		<link>http://codeblog.shawson.co.uk/new-adobe-html5-animation-tool-free-tech-preview/</link>
		<comments>http://codeblog.shawson.co.uk/new-adobe-html5-animation-tool-free-tech-preview/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 11:48:52 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1121</guid>
		<description><![CDATA[A real nail in the coffin for Flash, as it&#8217;s own parents (Adobe) release a free tech demo version of Edge- A new editor that lets you make flash style animations&#8211; without Flash! Instead the animations are scripted using standards html5, JavaScript and CSS3. Having been hand coding stuff like this over the past year [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/html5-audio-and-video-media-tags-how-do-you-know-when-the-datas-loaded-and-how-to-play-multiple-instances-of-the-same-sample-at-the-same-time/' rel='bookmark' title='HTML5 Audio and Video (Media) Tags &#8211; How do you know when the data&#8217;s loaded? And how to play multiple instances of the same sample at the same time'>HTML5 Audio and Video (Media) Tags &#8211; How do you know when the data&#8217;s loaded? And how to play multiple instances of the same sample at the same time</a></li>
<li><a href='http://codeblog.shawson.co.uk/backwards-compatible-embedded-html-5-video/' rel='bookmark' title='Backwards compatible Embedded HTML 5 Video'>Backwards compatible Embedded HTML 5 Video</a></li>
<li><a href='http://codeblog.shawson.co.uk/couple-of-interesting-news-items-today/' rel='bookmark' title='Couple of interesting news items today'>Couple of interesting news items today</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>A real nail in the coffin for Flash, as it&#8217;s own parents (Adobe) release a free tech demo version of Edge- A new editor that lets you make flash style animations&#8211; without Flash!  Instead the animations are scripted using standards html5, JavaScript and CSS3.  Having been hand coding stuff like this over the past year (for 8week game and the like) I&#8217;m interested to see what kind of code this tool actually spits out!  Check it out herel; <a href="http://t.co/I46QFYm">http://t.co/I46QFYm</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/html5-audio-and-video-media-tags-how-do-you-know-when-the-datas-loaded-and-how-to-play-multiple-instances-of-the-same-sample-at-the-same-time/' rel='bookmark' title='HTML5 Audio and Video (Media) Tags &#8211; How do you know when the data&#8217;s loaded? And how to play multiple instances of the same sample at the same time'>HTML5 Audio and Video (Media) Tags &#8211; How do you know when the data&#8217;s loaded? And how to play multiple instances of the same sample at the same time</a></li>
<li><a href='http://codeblog.shawson.co.uk/backwards-compatible-embedded-html-5-video/' rel='bookmark' title='Backwards compatible Embedded HTML 5 Video'>Backwards compatible Embedded HTML 5 Video</a></li>
<li><a href='http://codeblog.shawson.co.uk/couple-of-interesting-news-items-today/' rel='bookmark' title='Couple of interesting news items today'>Couple of interesting news items today</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/new-adobe-html5-animation-tool-free-tech-preview/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor</title>
		<link>http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/</link>
		<comments>http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 08:00:29 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#.net]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1104</guid>
		<description><![CDATA[I&#8217;ve just finished integrating Yahoo&#8217;s YUI Compressor into the MSBuild process for a new web probject I&#8217;m working on, and I thought I would document the process as there doesn;t seem to be a start to finish guide about anywhere. To start with, let me just explain the structure I use for new Solutions; C:\_Dev\MyNewWebsite\ [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/entity-framework-the-data-reader-is-incompatible-with-the-specified-complex-type/' rel='bookmark' title='Entity Framework &#8220;The data reader is incompatible with the specified complex type.&#8221;'>Entity Framework &#8220;The data reader is incompatible with the specified complex type.&#8221;</a></li>
<li><a href='http://codeblog.shawson.co.uk/javascript-css-minification/' rel='bookmark' title='Javascript &amp; CSS Minification'>Javascript &#038; CSS Minification</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just finished integrating Yahoo&#8217;s YUI Compressor into the MSBuild process for a new web probject I&#8217;m working on, and I thought I would document the process as there doesn;t seem to be a start to finish guide about anywhere.</p>
<p>To start with, let me just explain the structure I use for new Solutions;</p>
<pre>
C:\_Dev\MyNewWebsite\
C:\_Dev\MyNewWebsite\Artwork\
C:\_Dev\MyNewWebsite\BuildTools\
C:\_Dev\MyNewWebsite\Docs\
C:\_Dev\MyNewWebsite\Source\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.sln
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Web\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Web\Controls\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Web\Images\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Web\Scripts\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Web\Services\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Web\Styles\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Web\MyNewWebsiteWeb.csproj
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Entities\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Entities\MyNewWebsiteEntities.csproj
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Interfaces\
C:\_Dev\MyNewWebsite\Source\MyNewWebsite.Interfaces\MyNewWebsiteInterfaces.csproj
C:\_Dev\MyNewWebsite\ThirdParty\
</pre>
<p>Firstly, download the <a href="http://yuicompressor.codeplex.com/">dot net port of the YUI compressor from codeplex</a>.  I then extracted this into a new folder in the BuildTools folder. (there should be 2 dll files and one txt licence file.)</p>
<p>I then created a new MSBuild file called build-minify.xml, in the MyNewWebsite.Web project folder.  That file looks like this;</p>
<pre class="brush: xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://yuicompressor.codeplex.com/wikipage?title=Sample%20MSBuild.xml%20File&amp;amp;amp;amp;amp;amp;ProjectName=yuicompressor --&gt;
&lt;Project DefaultTargets=&quot;Build&quot; xmlns=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;&gt;
  &lt;UsingTask
         TaskName=&quot;CompressorTask&quot;
         AssemblyFile=&quot;..\..\BuildTools\Yahoo.Yui.Compressor-v1.5.0.0\Yahoo.Yui.Compressor.dll&quot; /&gt;

  &lt;ItemGroup&gt;
    &lt;CssFiles Include=&quot;$(SourceLocation)Styles\Fonts.css&quot;/&gt;
    &lt;CssFiles Include=&quot;$(SourceLocation)Styles\Site.css&quot;/&gt;

    &lt;CssIE Include=&quot;$(SourceLocation)Styles\IE.css&quot;/&gt;
    &lt;CssIE6 Include=&quot;$(SourceLocation)Styles\IE6.css&quot;/&gt;

    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\jquery-1.6.1.min.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\jquery-ui-1.8.14.custom.min.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\json2.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\jqModal-r14.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\jquery.tipsy.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\jquery.scrollTo-1.4.2.min.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\jquery.localscroll-1.2.7.min.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-alert.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-validation.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-rollovers.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-custom-accordion.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-vehicle-lookup.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-sandbox.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-finance-calculator.js&quot; /&gt;
    &lt;JsAll Include=&quot;$(SourceLocation)Scripts\chinook-apply-now.js&quot; /&gt;

  &lt;/ItemGroup&gt;

  &lt;Target Name=&quot;Minimize&quot;&gt;
    &lt;CompressorTask
              CssFiles=&quot;@(CssFiles)&quot;
              DeleteCssFiles=&quot;false&quot;
              CssOutputFile=&quot;Styles/Site.rel.css&quot;
              CssCompressionType=&quot;YuiStockCompression&quot;
              DisableOptimizations=&quot;Nope&quot;
              EncodingType=&quot;Default&quot;
              LineBreakPosition=&quot;-1&quot;
              LoggingType=&quot;ALittleBit&quot;
              ThreadCulture=&quot;en-gb&quot;
              IsEvalIgnored=&quot;false&quot;
            /&gt;

    &lt;CompressorTask
              CssFiles=&quot;@(CssIE)&quot;
              DeleteCssFiles=&quot;false&quot;
              CssOutputFile=&quot;Styles/IE.rel.css&quot;
              CssCompressionType=&quot;YuiStockCompression&quot;
              DisableOptimizations=&quot;Nope&quot;
              EncodingType=&quot;Default&quot;
              LineBreakPosition=&quot;-1&quot;
              LoggingType=&quot;ALittleBit&quot;
              ThreadCulture=&quot;en-gb&quot;
              IsEvalIgnored=&quot;false&quot;
            /&gt;

    &lt;CompressorTask
              CssFiles=&quot;@(CssIE6)&quot;
              DeleteCssFiles=&quot;false&quot;
              CssOutputFile=&quot;Styles/IE6.rel.css&quot;
              CssCompressionType=&quot;YuiStockCompression&quot;
              DisableOptimizations=&quot;Nope&quot;
              EncodingType=&quot;Default&quot;
              LineBreakPosition=&quot;-1&quot;
              LoggingType=&quot;ALittleBit&quot;
              ThreadCulture=&quot;en-gb&quot;
              IsEvalIgnored=&quot;false&quot;
            /&gt;

    &lt;CompressorTask
      JavaScriptFiles=&quot;@(JsAll)&quot;
      ObfuscateJavaScript=&quot;true&quot;
      PreserveAllSemicolons=&quot;true&quot;
      DisableOptimizations=&quot;false&quot;
      EncodingType=&quot;Default&quot;
      DeleteJavaScriptFiles=&quot;false&quot;
      LineBreakPosition=&quot;-1&quot;
      JavaScriptOutputFile=&quot;Scripts/chinook.rel.js&quot;
      LoggingType=&quot;ALittleBit&quot;
      ThreadCulture=&quot;en-gb&quot;
      IsEvalIgnored=&quot;false&quot;
		/&gt;
  &lt;/Target&gt;
&lt;/Project&gt;
</pre>
<p>You can create whatever ItemGroups you&#8217;d like- then just create a compressor task for each.  For a rundown of the settings, check out the link in the comment at the top of the XML there.  In the above file I had decided to compress all of my Javascript into a single file called chinook.rel.js, and my fonts and site css file rolled into one file, keeping the ie6 css separate, but still minifying it down.</p>
<p>The next step is to add it to the normal build.  I opened the solution in Visual Studio, right clicked my web project and selected properties.  Go to &#8220;Build Events&#8221; and add the following post-build event;</p>
<pre>
$(MSBuildBinPath)\msbuild.exe  $(ProjectDir)build-minify.xml /target:Minimize
</pre>
<p>Now you can test it out by building your project.  The new minified files are dumped out, in my case to the Scripts folder.  Now that the files are there, I need a way of telling my release version of the website to use these instead of the raw, human-readable versions; but I still want to continue using the human-readable versions for development.</p>
<p>To achieve this I use pre-processor directives.  These are most commonly seen in the c# code behind files, but can also be used in the aspx files.  I added the following lines at the bottom of my master page;</p>
<pre class="brush: html">
    &lt;% #if (!DEBUG) %&gt;
    &lt;script src=&quot;Scripts/chinook.rel.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;% #else %&gt;
    &lt;script src=&quot;Scripts/jquery-1.6.1.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/jqModal-r14.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/chinook-alert.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/jquery-ui-1.8.14.custom.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/chinook-vehicle-lookup.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/chinook-sandbox.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/chinook-finance-calculator.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/jquery.scrollTo-1.4.2.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/jquery.localscroll-1.2.7.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/jquery.tipsy.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/json2.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/chinook-validation.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/chinook-apply-now.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;Scripts/chinook-rollovers.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;Scripts/chinook-custom-accordion.js&quot;&gt;&lt;/script&gt;
    &lt;% #endif %&gt;
</pre>
<p>So if the project is NOT running in debug mode, I import my full chinook.rel.js include which has everything already included, otherwise I manually include all the human readable, separate files.</p>
<p>And that&#8217;s pretty much it.  Make sure you thoroughly retest your site with your combined java script file, as sometimes minification can cause issues with some code.  </p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/entity-framework-the-data-reader-is-incompatible-with-the-specified-complex-type/' rel='bookmark' title='Entity Framework &#8220;The data reader is incompatible with the specified complex type.&#8221;'>Entity Framework &#8220;The data reader is incompatible with the specified complex type.&#8221;</a></li>
<li><a href='http://codeblog.shawson.co.uk/javascript-css-minification/' rel='bookmark' title='Javascript &amp; CSS Minification'>Javascript &#038; CSS Minification</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Front end web developer coding standards</title>
		<link>http://codeblog.shawson.co.uk/front-end-web-developer-coding-standards/</link>
		<comments>http://codeblog.shawson.co.uk/front-end-web-developer-coding-standards/#comments</comments>
		<pubDate>Fri, 06 May 2011 07:51:26 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1014</guid>
		<description><![CDATA[Well put together, and generally good advice about the finer details of javascript (closures, truthy values) for someone starting out. http://taitems.github.com/Front-End-Development-Guidelines/ Related posts:Work Starts on my WebGL Game! Javascript development on Cloud9&#8230; unless you&#8217;re on Windows :( PhoneGap &#8211; Deselecting All Items from the tab bar!


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/work-starts-on-my-webgl-game/' rel='bookmark' title='Work Starts on my WebGL Game!'>Work Starts on my WebGL Game!</a></li>
<li><a href='http://codeblog.shawson.co.uk/javascript-development-on-cloud9-unless-youre-on-windows/' rel='bookmark' title='Javascript development on Cloud9&#8230; unless you&#8217;re on Windows :('>Javascript development on Cloud9&#8230; unless you&#8217;re on Windows :(</a></li>
<li><a href='http://codeblog.shawson.co.uk/phonegap-deselecting-items-from-the-tab-bar/' rel='bookmark' title='PhoneGap &#8211; Deselecting All Items from the tab bar!'>PhoneGap &#8211; Deselecting All Items from the tab bar!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Well put together, and generally good advice about the finer details of javascript (closures, truthy values) for someone starting out.</p>
<p><a href="http://taitems.github.com/Front-End-Development-Guidelines/">http://taitems.github.com/Front-End-Development-Guidelines/</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/work-starts-on-my-webgl-game/' rel='bookmark' title='Work Starts on my WebGL Game!'>Work Starts on my WebGL Game!</a></li>
<li><a href='http://codeblog.shawson.co.uk/javascript-development-on-cloud9-unless-youre-on-windows/' rel='bookmark' title='Javascript development on Cloud9&#8230; unless you&#8217;re on Windows :('>Javascript development on Cloud9&#8230; unless you&#8217;re on Windows :(</a></li>
<li><a href='http://codeblog.shawson.co.uk/phonegap-deselecting-items-from-the-tab-bar/' rel='bookmark' title='PhoneGap &#8211; Deselecting All Items from the tab bar!'>PhoneGap &#8211; Deselecting All Items from the tab bar!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/front-end-web-developer-coding-standards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Javascript Unit Testing/ Compression to your MSBuild</title>
		<link>http://codeblog.shawson.co.uk/adding-javascript-unit-testing-compression-to-your-build/</link>
		<comments>http://codeblog.shawson.co.uk/adding-javascript-unit-testing-compression-to-your-build/#comments</comments>
		<pubDate>Wed, 04 May 2011 09:03:53 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Test Driven Development]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1007</guid>
		<description><![CDATA[A couple of resources- I shall add to this post as I look into this myself.  I basically want to add steps to my project file, so msbuild will run javascript tests (qUnit) and perform minification/ combines all the js source files. http://yuicompressor.codeplex.com/ http://blogs.msdn.com/b/francischeung/archive/2010/02/13/integrating-javascript-unit-tests-with-continuous-integration.aspx http://www.testinggeek.com/index.php/testing-tools/test-execution/189-qunit-selenium-continuous-integration http://dotnet.geir-sorensen.net/2010/04/10/msbuild-custom-targets/ http://www.simple-talk.com/dotnet/.net-tools/extending-msbuild/ Related posts:Unit testing Javascript event handlers or any [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/unit-testing-javascript-event-handlers-or-any-other-asynchronous-delegate-calls-using-jsunit/' rel='bookmark' title='Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit'>Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit</a></li>
<li><a href='http://codeblog.shawson.co.uk/watin-testing-tools/' rel='bookmark' title='WatiN Testing Tools'>WatiN Testing Tools</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/' rel='bookmark' title='Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor'>Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>A couple of resources- I shall add to this post as I look into this myself.  I basically want to add steps to my project file, so msbuild will run javascript tests (qUnit) and perform minification/ combines all the js source files.</p>
<ul>
<li><a href="http://yuicompressor.codeplex.com/">http://yuicompressor.codeplex.com/</a></li>
<li><a href="http://blogs.msdn.com/b/francischeung/archive/2010/02/13/integrating-javascript-unit-tests-with-continuous-integration.aspx" target="_blank">http://blogs.msdn.com/b/francischeung/archive/2010/02/13/integrating-javascript-unit-tests-with-continuous-integration.aspx</a></li>
<li><a href="http://www.testinggeek.com/index.php/testing-tools/test-execution/189-qunit-selenium-continuous-integration">http://www.testinggeek.com/index.php/testing-tools/test-execution/189-qunit-selenium-continuous-integration</a></li>
<li><a href="http://dotnet.geir-sorensen.net/"></a><a href="http://dotnet.geir-sorensen.net/2010/04/10/msbuild-custom-targets/">http://dotnet.geir-sorensen.net/2010/04/10/msbuild-custom-targets/</a></li>
<li><a href="http://www.simple-talk.com/dotnet/.net-tools/extending-msbuild/">http://www.simple-talk.com/dotnet/.net-tools/extending-msbuild/</a></li>
</ul>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/unit-testing-javascript-event-handlers-or-any-other-asynchronous-delegate-calls-using-jsunit/' rel='bookmark' title='Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit'>Unit testing Javascript event handlers or any other asynchronous delegate calls using jsUnit</a></li>
<li><a href='http://codeblog.shawson.co.uk/watin-testing-tools/' rel='bookmark' title='WatiN Testing Tools'>WatiN Testing Tools</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/' rel='bookmark' title='Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor'>Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/adding-javascript-unit-testing-compression-to-your-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

