<?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>code and effect &#187; js</title>
	<atom:link href="http://codeandeffect.co.uk/blog/category/programming/js/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeandeffect.co.uk/blog</link>
	<description>@AM_Doherty</description>
	<lastBuildDate>Mon, 12 Mar 2012 08:06:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Course Finder, an eventual reality</title>
		<link>http://codeandeffect.co.uk/blog/2011/programming/js/course-finder-an-eventual-reality/</link>
		<comments>http://codeandeffect.co.uk/blog/2011/programming/js/course-finder-an-eventual-reality/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 23:38:55 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[Course Finder 2011]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://codeandeffect.co.uk/blog/?p=719</guid>
		<description><![CDATA[A long time ago&#8230; Back in 2009, I examined the way in which courses could be listed and searched for at my University and developed a prototype user-interface to increase the visibility of each course we offer. Things began as &#8230; <a href="http://codeandeffect.co.uk/blog/2011/programming/js/course-finder-an-eventual-reality/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>A long time ago&#8230;</h2>
<p><img class="alignright" src="/blog/wp-content/uploads/2009/09/gg_courses_3.png" alt="" width="194" height="164" />Back in 2009, I examined the way in which courses could be listed and searched for at my University and<a title="How it all began" href="/blog/2009/programming/guerrilla-gardening-web/guerilla-gardening-day-one/"> developed a prototype user-interface</a> to increase the visibility of each course we offer.</p>
<p>Things began as a personal project carried out in spare time &#8211; an<em> &#8216;unofficial, unbidden and unapproved endeavour&#8217;</em> I described it back then &#8211; with the aim of creating something demonstrably useful that could be further developed.</p>
<h2>Revisiting the basics</h2>
<p>The design and prototyping was extensively blogged at the time, and the first prototype demo&#8217;d (<em>to a packed tent <img src='http://codeandeffect.co.uk/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </em>) at <em>BathCamp </em>BarCamp 2009. You can read more about the UX design in the following posts tagged <a title="Posts tagged 'Guerrilla Gardening'" href="/blog/tag/guerrilla-gardening/">guerrilla-gardening</a>. In 2011, development of the interface has finally begun in earnest.</p>
<h3>Available Data</h3>
<p>The greatest limitation at inception was available  data. Course information was coming from a content-managed <a title="Javascript Object Notation" href="http://www.json.org/" target="_blank">JSON</a> source  and provided only course title and web-page URL. It must also be  understood that while there is knowledge of formal course  data formats,  we have none in use that combine course and marketing information.  Thankfully, a separate project to manage course web-page delivery through Microsoft Sharepoint has  allowed full database access to extensive course information.</p>
<h3>New design and UX considerations</h3>
<p>Here&#8217;s how things looked in 2009:</p>
<div id="attachment_606" class="wp-caption alignright" style="width: 325px"><a href="http://codeandeffect.co.uk/blog/wp-content/uploads/2009/10/2_filter_by_letter.png"><img class="size-full wp-image-606 " title="2_filter_by_letter" src="http://codeandeffect.co.uk/blog/wp-content/uploads/2009/10/2_filter_by_letter.png" alt="" width="315" height="162" /></a><p class="wp-caption-text">Scrolling the Course Listings by starting letter</p></div>
<p>The first change is that we&#8217;ll be concentrating on undergraduate courses, so no tab structure.</p>
<p>Secondly, we had a rather ugly switch from course title lists to a title + summary listing from the Ultraseek search API, but the more reliable data source has changed that.<br />
The latest incarnation treats course listings as definitive course records, so when an <em>as-you-type</em> filter phrase is searched for withÂ  a click of the search button, the results aren&#8217;t re-presented but they&#8217;re used to augment the existing course listing with a summary of text from the live page.</p>
<p>Thirdly, stakeholders in the project agreed that being able to update the list the moment you type a letter means we can do away with the row of alphetic teeth that previously mirrored the Content Managed A-Z list pages (they&#8217;re days are numbered too).</p>
<p>One new feature on-the-cards is sorting/grouping by faculty, again afforded to us by better data. This should allow for a lightweight, low overhead means of seeing related courses, grouped by faculty and highlighted by the corporate faculty colour.</p>
<p><em>As-you-type</em> filtering narrows the list as before, but also updates a match count and six other course counters for each displayed faculty.</p>
<p>Type &#8216;engineer&#8217; for example and you see the bulk of courses under the <em>Faculty of Technology</em>, where you may find other courses related to your area of interest. Type &#8216;forensics&#8217;, and you see courses across <em>Business</em>, <em>Technology </em>and <em>Science</em>, inviting you to examine their differences.</p>
<h3>Under the hood</h3>
<p>The bulk of the code is still classic ASP (I know, I know). <em>jQuery</em> has replaced <em>Scriptaculous/Prototype</em> for the client-side interaction, a design choice primarily, but also a matter of support knowledge.</p>
<p>Basic course listings are served in an unordered list for static-page accessibility, and they&#8217;re then enhanced with JSON-based detailed course information. We&#8217;ll be popping the scrolling list to full height for compatibility with mobile devices in the short term.</p>
<p>Of course, the JSON formatting of detailed course information by faculty is an opportunity in itself.</p>
<p>We&#8217;ll be using Google Analytics, our tracker of choice for some time now to see if this makes a difference, which given the tens of page loads we&#8217;re saving ought be significant. Track Events will also be used to assess every client-side interaction with the Course Finder to inform its future development.</p>
<h3>New advantages</h3>
<p>It is hoped that as-and-when it goes live, faculties should be able to link directly to their own listings in the main marketing courses area, so eliminating the need for duplicated content in the CMS. An upgrade to IISÂ affords the opportunity finally get course titles in the URLs using something akin to <em>Apache <a title="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" href="http://" target="_blank">mod_rewrite</a></em>.</p>
<p>Deployment is imminent.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeandeffect.co.uk/blog/2011/programming/js/course-finder-an-eventual-reality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Background Animations in Script.Aculo.Us</title>
		<link>http://codeandeffect.co.uk/blog/2008/programming/js/background-animations-in-scriptaculous/</link>
		<comments>http://codeandeffect.co.uk/blog/2008/programming/js/background-animations-in-scriptaculous/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 20:14:24 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[js]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Scriptaculous]]></category>
		<category><![CDATA[snook]]></category>

		<guid isPermaLink="false">http://www.codeandeffect.co.uk/blog/?p=302</guid>
		<description><![CDATA[Inspired by Jonathan Snook&#8217;s article on animating backgrounds using Jquery, I had a snoop around in Script.aculo.us for the equivalent methods to create moving background images. It wasn&#8217;t long before I hit a wall with the Effect.Morph method and its &#8230; <a href="http://codeandeffect.co.uk/blog/2008/programming/js/background-animations-in-scriptaculous/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Inspired by Jonathan Snook&#8217;s article on <a title="Using jQuery for Background Image Animations" href="http://snook.ca/archives/javascript/jquery-bg-image-animations/">animating backgrounds using Jquery</a>, I had a snoop around in Script.aculo.us for the equivalent methods to create moving background images. It wasn&#8217;t long before I hit a wall with the Effect.Morph method and its <a title="Effect.Morph will not change vertical background position" href="http://groups.google.com/group/prototype-scriptaculous/msg/595e2867c1c80812">inability to parse the CSS values for background-position</a>.</p>
<p><center><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="320" height="100" ID="Captivate1"><param name="movie" value="/demos/morphbgpos/bgpos.swf"><param name="quality" value="high"><param name="menu" value="false"><param name="loop" value="1"><embed src="/demos/morphbgpos/bgpos.swf" width="320" height="100" loop="1" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object><br />
</center></p>
<p><a title="Effect.Morph" href="http://github.com/madrobby/scriptaculous/wikis/effect-morph">Effect.Morph</a> simply examines current CSS values and calculates new ones, iterating through a number of <em>transforms</em> according to the duration of the morph. Colour values are handled appropriately, but for positioning only a single value is anticipated. As the second value of <em>background-position</em> is never parsed, you&#8217;re limited to horizontal animation.</p>
<p>see a <a href="/demos/morphbgpos/example1.html" target="_blank">demo of the problem</a>.</p>
<p>So I&#8217;ve created an extension, similar to Alexander Farkas&#8217; for JQuery, to manipulate <em>background-position</em> both vertically and horizontally using the same syntax as Effect.Morph.</p>
<p>See it in action on <a title="Horizontal and Vertical example" href="http://codeandeffect.co.uk/demos/morphbgpos/example2.html" target="_blank">Horizontal and Vertical background animations</a> and <a href="http://codeandeffect.co.uk/demos/morphbgpos/example3.html" target="_blank">Vertical only</a>.</p>
<p><strong>Using the Effect.Morphbgpos extension</strong></p>
<p>Include in the <em>&lt;head&gt;</em> the Prototype and Script.aculo.us libraries as usual. Download the extension and include it <em>after </em>the main libraries:</p>
<pre>&lt;script src="bgposeffect.js" type="text/javascript"&gt;&lt;/script&gt;</pre>
<p>Jonathan did a great job describing his HTML and CSS markup (including how to show the final states of the animation using CSS just in case Javascript is not present) so I won&#8217;t repeat it all here. Suffice to say this is very similar: an unordered list with an id, containing three items, containing only links.</p>
<pre>&lt;body&gt;
...
&lt;ul id="a"&gt;
	&lt;li&gt;&lt;a href="#"&gt;Rivera&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#"&gt;Miro&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#"&gt;Varo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
...</pre>
<p>Then (somewhere after the list) include the code observers that restyle your links on <em>mouseover </em>and <em>mouseout</em>:</p>
<pre>&lt;script type="text/javascript"&gt;
$$('#tabs a').each(
	function(s) {
		s.observe('mouseover', function(s){
			this.setStyle( {backgroundPosition: "0px 5px"});
			new Effect.Morphbgpos(this, {
			  style: 'background-position:0px -40px;color:#cc0000',
			  duration: 4.3
			});
		});
	 	s.observe('mouseout', function(s) {
			this.setStyle( {backgroundPosition: "0px -40px"});
			new Effect.Morphbgpos(this, {
			style: 'background-position:0px 5px;color:#c0c0c0',
			duration: 4.3
			});
		});
	});
&lt;/script&gt;</pre>
<p>Note that in the example each of the observer methods sets the state directly before animating it. <em>Mouseover</em> begins from the original state set in the CSS while <em>Mouseout </em>sets the finished state (as in the CSS link hover state ) before animating back to the original state.</p>
<p><strong>How it works</strong></p>
<p>Very simple. Effect.Morphbgpos is a modified version of Effect.Morph that anticipates having to handle two sets of pixel values. It reads the current states into x and y variables, manipulates them and writes out the appropriate CSS, repeating until the final state is reached.</p>
<p><strong>Handling Other <em>Effect.Morph</em> CSS properties<br />
</strong></p>
<p>The extension will pass any CSS that isn&#8217;t a background-position property to a new instance of Effect.Morph.</p>
<p>You should be able to replace all <em>Effect.Morph</em> calls with <em>Effect.Morphbgpos</em>, and then simply find+replace them when this functionality becomes available in a future version of the framework.</p>
<p><strong>Limitations<br />
</strong></p>
<p>This first version only handles explicit background-position statements, using pixel values, and <em>duration </em>is the only supported option.</p>
<p>As it&#8217;s only extending Script.aculo.us by a fraction it seems to be robust across the browsers I&#8217;ve tested.</p>
<p><strong>Download &amp; usage<br />
</strong></p>
<p>Download the <a title="download the Effect.Morphbgpos extension" href="http://codeandeffect.co.uk/demos/morphbgpos/bgposeffect.js" target="_blank">js file</a> here (or <a title="download the Effect.Morphbgpos extension (.txt)" href="http://codeandeffect.co.uk/demos/morphbgpos/bgposeffect.js.txt" target="_blank">here as text</a>). Use just as you would Effect.Morph by settings CSS property-value pairs, and a duration.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeandeffect.co.uk/blog/2008/programming/js/background-animations-in-scriptaculous/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Safari Beta for Windows</title>
		<link>http://codeandeffect.co.uk/blog/2007/programming/js/safari-beta-for-windows/</link>
		<comments>http://codeandeffect.co.uk/blog/2007/programming/js/safari-beta-for-windows/#comments</comments>
		<pubDate>Tue, 12 Jun 2007 09:26:59 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.codeandeffect.co.uk/blog/2007/programming/js/safari-beta-for-windows/</guid>
		<description><![CDATA[Safari (beta, and for Windows), a bit of a damp squib this, I have a site in development for a client (and friend of old) with a strong Macintosh background. The site makes good use of the script.aculo.us library to &#8230; <a href="http://codeandeffect.co.uk/blog/2007/programming/js/safari-beta-for-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.apple.com/safari/">Safari</a> (beta, and for Windows), a bit of a damp squib this, I have a site in development for a client (and friend of old) with a strong Macintosh background.  The site makes good use of the <a href="http://script.aculo.us">script.aculo.us</a> library to animate items to the screen. I&#8217;d hoped this would allow me to stop switching machines quite so often for testing.</p>
<p>Loading the site up, I get no body text where I would expect it to load. The beta doesn&#8217;t seem to contain a Script debugger either. Reading through the docs for Safari I have to add the debug menu via terminal window (so no Win specific help then!).</p>
<p>I&#8217;m stuck now with a site I need to be <em>exceptionally </em>Safari friendly, but can&#8217;t debug. So am also stuck with a browser beta I can&#8217;t test any further.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeandeffect.co.uk/blog/2007/programming/js/safari-beta-for-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple returns</title>
		<link>http://codeandeffect.co.uk/blog/2006/work-stuff/simple-returns/</link>
		<comments>http://codeandeffect.co.uk/blog/2006/work-stuff/simple-returns/#comments</comments>
		<pubDate>Fri, 22 Sep 2006 09:51:31 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[js]]></category>
		<category><![CDATA[work stuff]]></category>

		<guid isPermaLink="false">http://www.codeandeffect.co.uk/blog/?p=35</guid>
		<description><![CDATA[Simple Back Button generator (opens in a new window) It&#8217;s not rocket science, in fact it&#8217;s probably not even breadmaker science, but it&#8217;s useful. Detects if there&#8217;s a history to return to before adding a back button to a menu &#8230; <a href="http://codeandeffect.co.uk/blog/2006/work-stuff/simple-returns/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" title="Simple but clever" href="/tests/jsback/">Simple Back Button generator</a> (opens in a new window)</p>
<p>It&#8217;s not rocket science, in fact it&#8217;s probably not even breadmaker science, but it&#8217;s useful. Detects if there&#8217;s a history to return to before adding a back button to a menu of your choosing.</p>
<p>Our CMS generated breadcrumb trail reflects the site structure, not an individual user&#8217;s path into the site &#8211; this was one possible solution to the loss of adequate return navigation when you go from one site area (say a school) to another (a service team perhaps).</p>
]]></content:encoded>
			<wfw:commentRss>http://codeandeffect.co.uk/blog/2006/work-stuff/simple-returns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drag n&#8217; Drop CAPTCHA puzzle</title>
		<link>http://codeandeffect.co.uk/blog/2006/programming/php/dragndrop-captcha/</link>
		<comments>http://codeandeffect.co.uk/blog/2006/programming/php/dragndrop-captcha/#comments</comments>
		<pubDate>Fri, 08 Sep 2006 13:33:09 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[js]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.codeandeffect.co.uk/blog/?p=28</guid>
		<description><![CDATA[Simply re-arrange the images to make a visible key before clicking submit. Fiddling with Scriptaculous earlier today I had an idea for a CAPTCHA mechanism. Cycling through the $_POST array in PHP gives you the form data, in order of &#8230; <a href="http://codeandeffect.co.uk/blog/2006/programming/php/dragndrop-captcha/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div style="border: 0px solid #c0c0c0; padding: 0pt 0px 10px 5px; float: right; width: 218px"><a href="/tests/draganddropcaptcha/"><img id="image30" style="border: 0px none " alt="Drag n Drop CAPTCHA mechanism screenie" src="http://www.codeandeffect.co.uk/blog/wp-content/uploads/2006/09/dragndropcaptcha.png" /></a></p>
<div style="padding: 0pt 0px 5px 5px; text-align: center; font-family: serif; font-size: 90%">Simply re-arrange the images to make a visible key before clicking submit.</div>
</div>
<p>Fiddling with <a title="visit http://script.aculo.us/" href="http://script.aculo.us/">Scriptaculous</a> earlier today I had an idea for a <a title="Wikipedia" href="http://en.wikipedia.org/wiki/Captcha">CAPTCHA</a> mechanism. Cycling through the $_POST array in PHP gives you the form data, in order of submission.Scriptaculous&#8217; <em>sortable</em> feature allows you to change order of items in a List, so adding an image with corresponding hidden input field gives you a basic puzzle  to satisfy the CAPTCHA requirement.</p>
<div><a title="Clickety" href="http://www.codeandeffect.co.uk/tests/draganddropcaptcha/">Simple Drag n&#8217; Drop CAPTCHA</a> (written 8th September, 2006, code available on request).</div>
<p>Still comes with all the same accessibility problems most mechanisms have (with the added JS requirement), but saves the need for image generation.This version *can* use any naming convention for the images and input field names, they&#8217;re generated and checked by an array so don&#8217;t need to be numerically ordered &#8211; which could be a giveaway.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeandeffect.co.uk/blog/2006/programming/php/dragndrop-captcha/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<enclosure url="http://codeandeffect.co.uk/blog/wp-content/uploads/2006/09/dragndropcaptcha.thumbnail.png" length="3664" type="image/jpg" />	</item>
	</channel>
</rss>

