<?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>Website Design Sheffield - Mark Goddard &#187; javascript</title>
	<atom:link href="http://blog.0100.tv/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.0100.tv</link>
	<description>Web Design &#38; Development blog</description>
	<lastBuildDate>Sat, 02 Oct 2010 09:47:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Fixing the Hover event on the iPad/iPhone/iPod</title>
		<link>http://blog.0100.tv/2010/05/fixing-the-hover-event-on-the-ipadiphoneipod/</link>
		<comments>http://blog.0100.tv/2010/05/fixing-the-hover-event-on-the-ipadiphoneipod/#comments</comments>
		<pubDate>Fri, 21 May 2010 15:39:38 +0000</pubDate>
		<dc:creator>Mark Goddard</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">http://blog.0100.tv/?p=666</guid>
		<description><![CDATA[In truth it&#8217;s not a fix as the iPad doesn&#8217;t have the ability to hover. Apple has developed extra events to replace hover on it&#8217;s mobile touch devices. I&#8217;ve recently been working a lot on the iPad and came across the problem of hovered navigation not showing up. It&#8217;s a css :hover event that fires [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-large wp-image-667" title="ipad.jpg" src="http://blog.0100.tv/wp-content/uploads/2010/05/ipad.jpg-510x285.png" alt="" width="510" height="285" /></p>
<p>In truth it&#8217;s not a fix as the iPad doesn&#8217;t have the ability to hover.</p>
<p>Apple has developed extra events to replace hover on it&#8217;s mobile touch devices. I&#8217;ve recently been working a lot on the iPad and came across the problem of hovered navigation not showing up. It&#8217;s a css :hover event that fires through a CSS selector on an &lt;a&gt; element with no href attribute.</p>
<p>To emulate the hover we simply add an event listener to the element we want to have a hover event. In jQuery we do this (make sure you insert it into document.ready):</p>
<pre>//ipad and iphone fix
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
    $(".menu li a").click(function(){
        //we just need to attach a click event listener to provoke iPhone/iPod/iPad's hover event
        //strange
    });
}
</pre>
<p>That should enable the element to be touched, and stimulate and iPad hover event.</p>
<p>If you&#8217;re having problems getting hovered elements to fire you could also try using touchstart or touchend which is probably a better method depending on what you&#8217;re trying to accomplish:</p>
<pre>
</pre>
<pre>if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
    $(".menu li a").bind('touchstart', function(){
        console.log("touch started");
    });
</pre>
<pre>
</pre>
<pre>    $(".menu li a").bind('touchend', function(){
        console.log("touch ended");
    });</pre>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.0100.tv/2010/05/fixing-the-hover-event-on-the-ipadiphoneipod/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Developing for multiple browsers *sigh*</title>
		<link>http://blog.0100.tv/2009/10/developing-for-multiple-browsers-sigh/</link>
		<comments>http://blog.0100.tv/2009/10/developing-for-multiple-browsers-sigh/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 10:56:26 +0000</pubDate>
		<dc:creator>Mark Goddard</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Website Design]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://blog.0100.tv/?p=501</guid>
		<description><![CDATA[I know it&#8217;s unfortunately the &#8220;taboo&#8221; of modern website design, but many developers don&#8217;t want to simply leave their IE7 visitors and IE6 visitors in the dark. It&#8217;s fine for sites like this one, or for web applications but what about corporation websites? For sites that HAVE to support older/alternative browsers. This came to light [...]]]></description>
			<content:encoded><![CDATA[<p>I know it&#8217;s unfortunately the &#8220;taboo&#8221; of modern website design, but many developers don&#8217;t want to simply leave their IE7 visitors and IE6 visitors in the dark. It&#8217;s fine for sites like this one, or for web applications but what about corporation websites? For sites that HAVE to support older/alternative browsers. This came to light ever more when I recently worked on a website which would mean that customers worth millions could possibly be using IE6. There&#8217;s 50% of employees there too who still run IE7 so not supporting them wasn&#8217;t an option. I needed (and used) a large set of tools to help me accomplish this task, and I&#8217;m going to tell you about them.</p>
<p>Every web developer <strong>should</strong> (<em>and probably does</em>) use these tools on a daily basis. They streamline your development and help speed up little niggles with your site.<span id="more-501"></span></p>
<h3><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Web Developer Toolbar</a></strong></h3>
<p><img class="alignnone size-full wp-image-506" title="Web Developer Toolbar" src="http://blog.0100.tv/wp-content/uploads/2009/10/fftb1.jpg" alt="fftb" width="510" height="150" /></p>
<p>This handy toolbar includes features such as in browser CSS editing which lets you see CSS changes live, the ability to disable Javascript, Cookies, CSS and Images (for usability testing) and includes many handy features.</p>
<p><a href="http://blog.0100.tv/wp-content/uploads/2009/10/google.jpg"><img class="size-thumbnail wp-image-503 alignright" title="google" src="http://blog.0100.tv/wp-content/uploads/2009/10/google-100x100.jpg" alt="google" width="100" height="100" /></a>Some fancy tricks also include:</p>
<ul>
<li><strong>Element outlining</strong><br />
This allows you to see which &lt;div/input/anything&gt; tags are lining up wrong and combined with the CSS editor proves a powerful tool in element alignment.</li>
<li><strong>Disabling CSS</strong><br />
This allows you to see how your layout holds up with browsers which don&#8217;t support CSS (such as screen readers). If your content is laid out poorly, it. will. be. read. out. loud. poorly.</li>
<li><strong>Browser Resizing</strong><br />
Want to see how your site looks in a 1024&#215;768 browsers? Click the re-size button and the toolbar will set your browser window to any size you specify!</li>
<li><strong>Quick Validation links</strong><br />
Want to know if your XHTML or CSS validates? There&#8217;s quick handy links under the Tools drop-down.</li>
<li><strong>Generated Source vs Source</strong><br />
Is your Javascript messing up your code? Then view the Generated Source to see what it&#8217;s actually doing to your pages.</li>
<li><strong>Quickly Edit HTML &amp; CSS in-line</strong><br />
It&#8217;s a quick and dirty way to see how your new CSS/HTML code works in your site. Simply open the editor and type away to see your page update <strong>live</strong>.</li>
</ul>
<p>There&#8217;s many more options you can play with. All you need is <a href="http://www.mozilla-europe.org/en/firefox/" target="_blank">Firefox</a> and the <a href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Web Developer Toolbar</a>.</p>
<h3><a href="https://addons.mozilla.org/en-US/firefox/addon/1843" target="_blank">Firebug</a></h3>
<p><img class="alignnone size-full wp-image-507" title="Firebug" src="http://blog.0100.tv/wp-content/uploads/2009/10/fb.jpg" alt="Firebug" width="510" height="150" /></p>
<p>Firebug is a tool used by almost every web developer in the world. If you&#8217;ve not installed it yet, do it immediately as it will save you many man hours fixing bugs in your websites code. It&#8217;s had over <strong>19 million</strong> downloads and averages <strong>22,000</strong> downloads every day.</p>
<h3><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/271">Colorzilla</a></strong></h3>
<p><strong><img class="alignnone size-full wp-image-509" title="Colorzilla" src="http://blog.0100.tv/wp-content/uploads/2009/10/colorzilla.jpg" alt="colorzilla" width="510" height="150" /><br />
</strong></p>
<p>When I can&#8217;t remember how to <a href="http://www.lts.com/class/hex1.htm" target="_blank">count in hex</a> (which often happens) I use Colorzilla. It makes sure my <span style="color: #009ecc;">#009ecc</span> is not <span style="color: #02a4d3;">#02a4d3</span> and that my <span style="color: #666666;">#666</span> isn&#8217;t <span style="color: #999999;">#999</span>. It&#8217;s best to keep consistency and is what separates a good designer, with a great designer.</p>
<p>There&#8217;s loads more Firefox Add-ons you could also check out:</p>
<ul>
<li><strong>YSlow</strong> <a href="https://addons.mozilla.org/en-US/firefox/addon/5369">https://addons.mozilla.org/en-US/firefox/addon/5369</a></li>
<li><strong>Pixel Perfect</strong> <a href="https://addons.mozilla.org/en-US/firefox/addon/7943">https://addons.mozilla.org/en-US/firefox/addon/7943</a></li>
<li><strong>Firecookie</strong> <a href="https://addons.mozilla.org/en-US/firefox/addon/6683">https://addons.mozilla.org/en-US/firefox/addon/6683</a></li>
<li><strong>PageDiff</strong> <a href="https://addons.mozilla.org/en-US/firefox/addon/4274">https://addons.mozilla.org/en-US/firefox/addon/4274</a></li>
</ul>
<h3><a href="http://0100.ws/69d/" target="_blank"><strong>Internet Explorer Developer Tools</strong></a></h3>
<p><strong><img class="alignnone size-full wp-image-515" title="Internet Explorer Developer Tools" src="http://blog.0100.tv/wp-content/uploads/2009/10/iedt.jpg" alt="Internet Explorer Developer Tools" width="510" height="150" /><br />
</strong></p>
<p>On the Internet Explorer front there&#8217;s not much for the modern Web Developer. However, using the Firefox tools above covers most if not all of your needs, except for IE8, IE7 and IE6 testing. This is what I&#8217;ll go over next.</p>
<p>The best tool is actually one released by Microsoft themselves. The aptly named <a href="http://0100.ws/69d/" target="_blank"><strong>Internet Explorer Developer Toolbar</strong></a> which gives you a few tools to play with which include a CSS and HTML editor, the ability to disable CSS and images, use a colour picker and outline elements. It&#8217;s basically a shorter version of the Firefox web developer toolbar. It also allows you to quickly switch between IE7 and IE8 browser rendering. Simply select which browser mode you need and you can see what your page looks like in IE7.</p>
<p>Now for IE6 (cringe). I know a lot of developer are now dropping support but as previously mentioned sometimes it&#8217;s not an option, and we sometimes need to think about this when developing mass market websites.</p>
<h3><a href="http://www.spoon.net/browsers/" target="_blank"><strong>Spoon.net</strong></a></h3>
<p>It&#8217;s a tool I only recently found and because Microsoft won&#8217;t properly develop something which lets you run IE6 on your machine, Spoon developed a browser plug-in which lets you run ANY browser, well, IN browser. They call it &#8220;App Virtualization&#8221; and I call it magic as it let&#8217;s you run IE6! (<em>note, as of writing I couldn&#8217;t get it to buffer on Windows 7 64-bit but could on Vista (32) and XP (32), let me know, maybe it needs to be XP Virtualized?</em>)</p>
<h3><a href="https://browserlab.adobe.com/" target="_blank">Adobe BrowserLab</a></h3>
<p><a href="http://blog.0100.tv/wp-content/uploads/2009/10/adobe.jpg"><img class="alignnone size-medium wp-image-516" title="adobe" src="http://blog.0100.tv/wp-content/uploads/2009/10/adobe-510x248.jpg" alt="adobe" width="510" height="248" /></a></p>
<p>This amazing tool lets you preview your pages side by side and even overlay pages (known as onion skin). You can also preview your site in many browsers which include Internet Explorer 6/7/8, Safari 3/4 and Firefox 2/3. The only downside is you can&#8217;t preview it as a functional page so can only be used for styling sakes, and it&#8217;s a little slow to run sometimes.</p>
<p><strong>I hope you found these tools useful for your web developing needs and good luck (you&#8217;ll need it if your working with IE6)</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.0100.tv/2009/10/developing-for-multiple-browsers-sigh/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>University is over! (for a year anyway)</title>
		<link>http://blog.0100.tv/2009/07/university-is-over-for-a-year-anyway/</link>
		<comments>http://blog.0100.tv/2009/07/university-is-over-for-a-year-anyway/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 19:23:18 +0000</pubDate>
		<dc:creator>Mark Goddard</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Website Design]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[graphic design]]></category>
		<category><![CDATA[illustration]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[powerpoint]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.0100.tv/?p=270</guid>
		<description><![CDATA[So University is done and dusted for 2009. I won&#8217;t be returning until September 2010 which makes for a nice break. In the end I got my grades (A,A,B,B,B,C) which I was very happy with. To top all this off I thought I&#8217;d showcase some of the work I did to receive these grades. Visual [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.0100.tv/wp-content/uploads/2009/07/stamps_final.jpg"><img class="alignnone size-full wp-image-291" title="Stamps" src="http://blog.0100.tv/wp-content/uploads/2009/07/stamps.jpg" alt="Stamps" width="510" height="150" /></a></p>
<p>So University is done and dusted for 2009. I won&#8217;t be returning until September 2010 which makes for a nice break. In the end I got my grades (A,A,B,B,B,C) which I was very happy with. To top all this off I thought I&#8217;d showcase some of the work I did to receive these grades.</p>
<h3><strong>Visual Design</strong> <em>(B Grade)</em></h3>
<p><a href="http://turnitoff.info/2.jpg"><img class="alignnone size-full wp-image-293" title="Plugs" src="http://blog.0100.tv/wp-content/uploads/2009/07/plugs.jpg" alt="Plugs" width="510" height="150" /></a><br />
I&#8217;ll start with a Module I didn&#8217;t thoroughly enjoy this year due to boring briefs, however, I did a little bit of illustration for it which included some postage stamps, posters and even included some Video in After Effects. You can see the video, the illustrations and the posters over at <a href="http://turnitoff.info/">http://turnitoff.info/</a> (the posters reside in the footer of the page)<br />
The site was built using the latest in Javascript and jQuery technology so check it out, hover over the elements, play with the buttons. Your probably better off using FireFox too, as IE couldn&#8217;t really handle it&#8217;s superior web modernness. <strong>Make sure you check out the video at the bottom of the website too</strong> (yes that is me speaking sounding common as muck).</p>
<p>For Visual design I <a href="http://blog.0100.tv/wp-content/uploads/2009/07/stamps_final1.jpg">also illustrated the stamps</a> shown in the header image. It&#8217;s based on Music Technology over the years and I think I captured the best four from the past century or so. You can <a href="http://blog.0100.tv/wp-content/uploads/2009/07/stamps_final1.jpg">see them in all their vector glory</a> too.</p>
<h3><a href="http://blog.0100.tv/wp-content/uploads/2009/07/website2.2.2.jpg"></a><a href="http://blog.0100.tv/wp-content/uploads/2009/07/website2.2.2.jpg"><img class="alignright size-medium wp-image-295" title="Website" src="http://blog.0100.tv/wp-content/uploads/2009/07/website2.2.2-205x150.jpg" alt="Website" width="205" height="150" /></a><strong>Multimedia Product</strong><em> (C Grade)</em></h3>
<p>This was a complex one, which also means I can&#8217;t demonstrate it online. The idea was simple, Unique Bidding auctions.</p>
<p>The site featured a <strong>worlds first</strong> in online bidding. Live real time bidding in auctions. You could actually watch LIVE bidders placing their respective amounts on the page as it went along. This meant users could bid against each other based on other users&#8217; bids. Clever eh! It was all jQuery and PHP grabbing the data from a database. It was awfully complex and also included a 10,000 word document explaing the process and research behind it. There was also a <a href="http://blog.0100.tv/wp-content/uploads/2009/07/SuiGenerisPresentation.ppsx">very fancy presentation which explains the fundementals</a> if anyone wants to watch it. <a href="http://blog.0100.tv/wp-content/uploads/2009/07/SuiGenerisPresentation.ppsx">Its the branding, the functionality and the UI all rolled into a short few slides</a>.</p>
<p>It also had it&#8217;s own iPhone web application which tied into the whole site shwoing live bids from anywhere in the world at any time.</p>
<h3><strong>Web Programming</strong><em> (A grade)</em></h3>
<p>Another interesting one. And one which I actually really enjoyed.</p>
<p><a href="http://blog.0100.tv/wp-content/uploads/2009/07/guest.jpg"></a><a href="http://blog.0100.tv/wp-content/uploads/2009/07/guest.jpg"><img class="alignright size-medium wp-image-297" title="guest" src="http://blog.0100.tv/wp-content/uploads/2009/07/guest-186x150.jpg" alt="guest" width="186" height="150" /></a>Assignment one involved <a href="http://hermes.hud.ac.uk/u0754700/assign1/">building a file based Guestbook</a> with full admin features, the ability to edit posts and delete them, a <strong>swear word filter</strong> to stip out those naughty words and a slick simple UI. It also had AJAX editing of comments right in the page. No loading, no navigating, just click and change! I think you can guess what <em>Lady Part</em> and <em>Ping Pongs</em> were supposed to say! It maybe available as a free download if anyone is interested in the future.</p>
<p>Assignment two <a href="http://hermes.hud.ac.uk/u0754700/assign2/">was a dog database</a> website. Very similar to Battersea dogs homes website. It needed full admin controls and the ability to save dogs as favourites and have the ability to search the dogs too. The brief was very extensive, and I covered everything. <a href="http://hermes.hud.ac.uk/u0754700/assign2/">Check it out online right now</a>. I ended up building a commercial site based on this for <a href="http://cliffekennels.co.uk/">Cliffe Kennels</a>.</p>
<h3><strong>Authoring</strong> <em>(B Grade)</em></h3>
<p>It was basically <a href="http://0100.tv/d/showcase/spiro/">Actionscript 3.0 work</a>. For assignment 1 I had to develop an interface which included an <a href="http://0100.tv/d/showcase/spiro/">animation, using the drawing API and the components within Flash 8</a>. I ended up building a <a href="http://0100.tv/d/showcase/spiro/">Spirograph</a> kind of application which allowed you to colour it yourself and watch the application build it for you. Very nice! <a href="http://0100.tv/d/showcase/spiro/">Have a look at it</a>. I also built a flash gallery using XML and class files. But it&#8217;s not something I have online at the moment.</p>
<h3><strong>Multimedia Design &amp; Production </strong>(A Grade)</h3>
<p>This is a group project, and something which is a real challenge working with four different creative minds. My University chum <a href="http://chris.kovalenko.co.uk/news/launch/">Chris Kovalenko</a> was part of our A grade group which created a chairty website and CDROM called the West Yorkshire Autistic Society (completely fake). <a href="http://wyas.0100.tv/">Check out the site</a>.</p>
<h3><strong>Intro to Video</strong> <em>(B Grade)</em></h3>
<p>My mate Adam Fisher helped me out with this one as I couldn&#8217;t star, edit and film the whole video. He rode the bike, I edited it, The Chemists supplied the music. It actually works quite well for my first every video. So I&#8217;m quite happy with it as a 2nd year project.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="510" height="408" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=4680390&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="510" height="408" src="http://vimeo.com/moogaloop.swf?clip_id=4680390&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>That&#8217;s it! I hope this gives someone some kind of inspiration either for university or for their next project. If it did help you in any way shape or form, <strong>drop me a comment</strong>!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.0100.tv/2009/07/university-is-over-for-a-year-anyway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TwiPho &#8211; Twitter Photo Search</title>
		<link>http://blog.0100.tv/2009/05/twipho-twitter-photo-search/</link>
		<comments>http://blog.0100.tv/2009/05/twipho-twitter-photo-search/#comments</comments>
		<pubDate>Sat, 09 May 2009 22:32:49 +0000</pubDate>
		<dc:creator>Mark Goddard</dc:creator>
				<category><![CDATA[Website Design]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[twipho]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://blog.0100.tv/?p=231</guid>
		<description><![CDATA[Well, it seems I have more time on my hands than I need. Wednesday my on-line chum Matt decided he wanted to &#8220;build something&#8221;. Anything he said. He was open to suggestions. One of those was a Twitter photo search. To cut a long story short I stole by own suggestion and built it myself. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-314" title="twipho" src="http://blog.0100.tv/wp-content/uploads/2009/05/twipho.png" alt="twipho" width="510" height="150" /></p>
<p>Well, it seems I have more time on my hands than I need. Wednesday my on-line chum <a href="http://matt.developedthe.net/">Matt</a> decided he wanted to &#8220;build something&#8221;. Anything he said. He was open to suggestions. One of those was a <a href="http://twipho.net/">Twitter photo search</a>. To cut a long story short I stole by own suggestion and built it myself.</p>
<p><a href="http://twipho.net/">TwiPho</a> was born out of two days coding (Thursday, 7th May and Friday 8th May) which accumulated to about 8 hours coding. Not bad to say I visited Alton Towers on Friday too.</p>
<p>Anyway, TwiPho is a Twitter Photo Search engine. It uses Twitters brilliant API (<a href="http://blog.0100.tv/2009/05/using-twitter-and-twitpic-the-apis/">which I wrote about Wednesday</a>) including TwitPic&#8217;s API, img.ly&#8217;s API and yfrog&#8217;s API. All Twitter image hosts. It searches though Twitter to find images related to a search keyword and shows you the images. 100% JavaScript, 100% AJAX. It uses the powerful jQuery framework too, which is a massive boost for my programming ego.</p>
<p>Anyway please have a look at it over at <a href="http://twipho.net/">http://twipho.net/</a> and even <a href="http://twitter.com/home?status=RT Twitter Photo Search http://twipho.net/">let you friends know about it on Twitter</a>!</p>
<p>It&#8217;s even been <a href="http://jquerystyle.com/">featured on jQuery Style</a>, so thanks again to them!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.0100.tv/2009/05/twipho-twitter-photo-search/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>UPDATED: Using Twitter and TwitPic, the API&#8217;s</title>
		<link>http://blog.0100.tv/2009/05/using-twitter-and-twitpic-the-apis/</link>
		<comments>http://blog.0100.tv/2009/05/using-twitter-and-twitpic-the-apis/#comments</comments>
		<pubDate>Wed, 06 May 2009 13:57:51 +0000</pubDate>
		<dc:creator>Mark Goddard</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[information]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[twitpic]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.0100.tv/?p=225</guid>
		<description><![CDATA[UPDATED: I have now added in a few lines to cache the file. This saves on bandwidth and can sometimes speed things up when the twitpic service is running slow, it&#8217;s a simple extension to an already simple script. Most people have become addicted to Twitter, and I&#8217;m no exception. I got an iPhone the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.0100.tv/wp-content/uploads/2009/05/twitpic.png"><img class="alignnone size-full wp-image-379" title="twitpic" src="http://blog.0100.tv/wp-content/uploads/2009/05/twitpic.png" alt="twitpic" width="510" height="160" /></a></p>
<p><strong>UPDATED: I have now added in a few lines to cache the file. This saves on bandwidth and can sometimes speed things up when the twitpic service is running slow, it&#8217;s a simple extension to an already simple script.</strong></p>
<p>Most people have become addicted to Twitter, and I&#8217;m no exception.</p>
<p>I got an iPhone the other week and <a href="http://twitter.com/0100">have been posting regularly</a>, but there is one thing that is very nice, and that&#8217;s the API built into Twitter. It&#8217;s quite a nice feature, and one that I have been getting to grips with recently.</p>
<p>I decided I wanted to show my Twitter updates on the new website I have been building and because Twitter supports JSON feeds, I thought I&#8217;d have a crack at using jQuery to show these posts.</p>
<p>It&#8217;s something that&#8217;s actually quite easy. Using jQuery&#8217;s AJAX function $.getJSON it meant I could grab the feed and format it how I wished. First off make sure you have included the latest version of jQuery into your website.</p>
<pre class="code"><code class="javascript">&lt;<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text/javascript" </span><span class="attribute-name">src</span>=<span class="attribute-value">"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"</span>&gt;&lt;/<span class="end-tag">script</span>&gt;</code></pre>
<p>This needs to go where scripts usually reside. In your HTML &lt;head&gt; tag. You will also need to wrap all the below code in the jQuery documen.ready() function.</p>
<p>In this example I only wanted to grab one result so I started off with&#8230;<span id="more-225"></span></p>
<pre class="code"><code class="javascript">$(document).ready(function() {
var userName = "0100";
	$.getJSON("http://twitter.com/statuses/user_timeline/"+ userName +".json?count=1&amp;callback=?", function(json){
 		var lastTweet = json[0].text;
		var tweetTime = json[0].created_at;
		$("#twitterTxt").html(lastTweet);
		$("#twitterTime").html(tweetTime);
	});
});</code></pre>
<p>That&#8217;s it! All nine lines of it. All you need to do it make two divs, one with the ID twitterTxt and the other with the ID twitterTime. You also need to change your username in the variable too.</p>
<p>The only problem with this is the dates. It&#8217;s not &#8220;twitter timed&#8221; at all. We want the &#8220;posted 1 minute ago&#8221; text we all look for on twitter. Luckily, twitter already wrote a function for this called <a href="http://blog.0100.tv/wp-content/uploads/2009/05/relative_time.js">relative_time()</a> which you <a href="http://blog.0100.tv/wp-content/uploads/2009/05/relative_time.js">can download and use</a>. All you have to do is wrap the tweetTime var with the function like:</p>
<pre class="code"><code class="javascript">		var tweetTime = relative_time(json[0].created_at);</code></pre>
<p>Just make sure you copy in the function to your javascript or include it into the page.</p>
<h2>TwitPic API, displaying images</h2>
<p>After we have our twitter updates showing on our page we can now show the TwitPic photos too! Every time you post a photo through your twitter updates we can show this on the page as a link. I only wanted to show one image but for this example I have written the code to show as many images as TwitPic allows. I&#8217;m not sure of the actual limit but I think ten is a good number. For this example you need to have PHP 5 with <a href="http://us2.php.net/manual/en/book.simplexml.php">SimpleXML</a>. It&#8217;s a brilliant function and something which makes using RSS feeds with PHP very easy.</p>
<p>Once again it&#8217;s only around ten lines of code, but the results are great.<br />
We will need to start by looking at the format of the RSS feed. Open up http://twitpic.com/photos/0100/feed.rss and analyse it. (view the source if you just see a formatted page in firefox).</p>
<p>We start off using the <a href="http://us.php.net/simplexml_load_file">simplexml_load_file()</a> function in PHP to grab the actual feed:</p>
<pre class="code"><code class="php">$username = "0100";
$yourRSS = "http://twitpic.com/photos/".$username."/feed.rss";
$xml = simplexml_load_file($yourRSS, 'SimpleXMLElement', LIBXML_NOCDATA);</code></pre>
<p>Nothing too difficult there except the option <strong>LIBXML_NOCDATA</strong>. TwitPic gives us the data as CDATA. This option simply strips out the uneeded code.</p>
<p>We then need to grab the actual image a link. Note: TwitPic&#8217;s TOS state you must link back to the original TwitPic page, which is fair enough.</p>
<pre class="code"><code class="php">$link = str_replace($username.": &lt;br&gt;","",$xml-&gt;channel-&gt;item[$i]-&gt;description);</code></pre>
<p>This simply points to the SimpleXML object and grabs the description entry in the RSS. This is placed in a for() loop to loop through the entries. We also have to replace the username and page break that TwitPic outputs, it looks silly otherwise. All we have to do is echo that out and we are done!</p>
<p>To save you all time I have uploaded a full PHP script for you to use. It&#8217;s very easy and only requires you to change a few parameters. It will then echo out a unordered list for you to use in your site!</p>
<p><strong>Note: There is now an <a href="http://blog.0100.tv/wp-content/uploads/2009/05/twitpicall2.txt">updated version of the script that you can download</a>.</strong></p>
<p><strong><span style="text-decoration: line-through;">Download the full PHP file <a href="http://blog.0100.tv/wp-content/uploads/2009/05/twitpicall1.txt">TwitPic API &#8211; Simple XML PHP</a></span>. You can also <a href="http://0100.tv/dev/new/twitpicAll.php">see a demo of the output</a>.</strong></p>
<p>Hope this all helped you to use Twitters and TwitPic&#8217;s API&#8217;s!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.0100.tv/2009/05/using-twitter-and-twitpic-the-apis/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

