<?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>Phil Bayfield &#187; JavaScript</title>
	<atom:link href="http://www.philbayfield.com/category/dev/dev-js/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.philbayfield.com</link>
	<description>A little about me, my photos and some general geeky stuff!</description>
	<lastBuildDate>Sun, 05 Sep 2010 15:27:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>jQuery chat plugin</title>
		<link>http://www.philbayfield.com/2009/10/12/jquery-chat-plugin/</link>
		<comments>http://www.philbayfield.com/2009/10/12/jquery-chat-plugin/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 20:37:13 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=34</guid>
		<description><![CDATA[The aim of the plugin is to provide a Facebook-like chatroom that can easily be added to any website. The plugin is written in Javascript and makes heavy use of the jQuery library to simplify implementation and integration. The proposed features are: Changable online status Auto-away Chatrooms Private messaging Friends list Anything else that looks [...]]]></description>
			<content:encoded><![CDATA[<p>The aim of the plugin is to provide a Facebook-like chatroom that can easily be added to any website. The plugin is written in Javascript and makes heavy use of the jQuery library to simplify implementation and integration.</p>
<p>The proposed features are:</p>
<ul>
<li>Changable online status</li>
<li>Auto-away</li>
<li>Chatrooms</li>
<li>Private messaging</li>
<li>Friends list</li>
<li>Anything else that looks cool!</li>
</ul>
<p>I have finished work on version 0.1 which is the first working version, here are a few screenshots:</p>
<div id="attachment_127" class="wp-caption alignnone" style="width: 155px"><img class="size-full wp-image-127" title="Status Menu" src="http://www.philbayfield.com/wp-content/uploads/2009/10/statusmenu.png" alt="The Status Menu" width="145" height="137" /><p class="wp-caption-text">The status menu</p></div>
<div id="attachment_129" class="wp-caption alignnone" style="width: 250px"><img class="size-full wp-image-129" title="friendslist" src="http://www.philbayfield.com/wp-content/uploads/2009/10/friendslist.png" alt="The Friends List" width="240" height="383" /><p class="wp-caption-text">The friends list</p></div>
<div id="attachment_130" class="wp-caption alignnone" style="width: 730px"><img class="size-full wp-image-130" title="chatroom" src="http://www.philbayfield.com/wp-content/uploads/2009/10/chatroom.png" alt="An example chat room" width="720" height="188" /><p class="wp-caption-text">An example chat room</p></div>
<p>I have not added private messaging yet, but this will be added in a future version.</p>
<p>Targets for version 0.2:</p>
<ul>
<li>Add private messaging</li>
<li>Improve PHP callback API</li>
<li>Improve speed of message display</li>
<li>Look at using persistent AJAX requests (Comet)</li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2009/10/12/jquery-chat-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin &#8211; Final tweaks</title>
		<link>http://www.philbayfield.com/2009/10/02/wordpress-plugin-final-tweaks/</link>
		<comments>http://www.philbayfield.com/2009/10/02/wordpress-plugin-final-tweaks/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 02:56:12 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=105</guid>
		<description><![CDATA[The plugin is now pretty much finished, there are certainly other options that could be added such as page summaries via AJAX, custom image sizes for specific preview etc but for now the only thing that is really left to do is to add a quicktag option so that the plugin can be easily used [...]]]></description>
			<content:encoded><![CDATA[<p>The plugin is now pretty much finished, there are certainly other options that could be added such as page summaries via AJAX, custom image sizes for specific preview etc but for now the only thing that is really left to do is to add a quicktag option so that the plugin can be easily used from the post editor.</p>
<p>This is very simple to do, first I have created a hook to add a script file:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace; font-size: 1.2em;">add_action<span class="br0">&#40;</span><span class="st_h">&#8216;admin_print_scripts&#8217;</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="sy0">&amp;</span><span class="re0">$this</span><span class="sy0">,</span> <span class="st_h">&#8216;Admin_Script&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>This script is only loaded within the admin (hence the action is &#8216;admin_print_scripts&#8217;) and it tells WordPress which function to get the script definition.</p>
<p>The Admin_Script function attaches a simple Javascript file to add the quicktag:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace; font-size: 1.2em;"><span class="co4">/**<br />
&nbsp;* Load admin javascipt file<br />
&nbsp;*<br />
&nbsp;* @return void<br />
&nbsp;*/</span><br />
<span class="kw2">function</span> Admin_Script<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; wp_enqueue_script<span class="br0">&#40;</span><span class="st_h">&#8216;wp-thumbshot-preview&#8217;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plugin_dir_url<span class="br0">&#40;</span><span class="kw4">__FILE__</span><span class="br0">&#41;</span> <span class="sy0">.</span> <span class="st_h">&#8216;wp-thumbshot-preview.js&#8217;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st_h">&#8216;quicktags&#8217;</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8217;0.1&#8242;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>It&#8217;s fairly obvious what this does, worth noting that quicktags is a prerequisite (so that the quicktags Javascript functions are loaded first).</p>
<p>The Javascript file &#8216;wp-thumbshot-preview.js&#8217; contains the quicktag definition:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace; font-size: 1.2em;">edButtons<span class="br0">&#91;</span>edButtons.<span class="me1">length</span><span class="br0">&#93;</span> <span class="sy0">=</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">new</span> edButton<span class="br0">&#40;</span><span class="st0">&#8216;preview&#8217;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#8216;preview&#8217;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#8216;[preview]&#8216;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#8216;[/preview]&#8216;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#8221;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>Now in the code editor there is a &#8216;preview&#8217; button so that the plugin&#8217;s preview tags can be auto completed!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2009/10/02/wordpress-plugin-final-tweaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
