jQuery chat plugin

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 cool!

I have finished work on version 0.1 which is the first working version, here are a few screenshots:

The Status Menu
The status menu
The Friends List
The friends list
An example chat room
An example chat room

I have not added private messaging yet, but this will be added in a future version.

Targets for version 0.2:

  • Add private messaging
  • Improve PHP callback API
  • Improve speed of message display
  • Look at using persistent AJAX requests (Comet)
Share

WordPress Plugin – Final tweaks

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.

This is very simple to do, first I have created a hook to add a script file:

[code lang=”php”]add_action(‘admin_print_scripts’, array(&$this, ‘Admin_Script’));[/code]

This script is only loaded within the admin (hence the action is ‘admin_print_scripts’) and it tells WordPress which function to get the script definition.

The Admin_Script function attaches a simple Javascript file to add the quicktag:

[code lang=”php”]/**
* Load admin javascipt file
*
* @return void
*/
function Admin_Script() {
wp_enqueue_script(‘wp-thumbshot-preview’,
plugin_dir_url(__FILE__) . ‘wp-thumbshot-preview.js’,
array(‘quicktags’),
‘0.1’);
}[/code]

It’s fairly obvious what this does, worth noting that quicktags is a prerequisite (so that the quicktags Javascript functions are loaded first).

The Javascript file ‘wp-thumbshot-preview.js’ contains the quicktag definition:

[code lang=”javascript”]edButtons[edButtons.length] =
new edButton(‘preview’,
‘preview’,
‘[preview]’,
‘[/preview]’,
”);[/code]

Now in the code editor there is a ‘preview’ button so that the plugin’s preview tags can be auto completed!

Share