wiki:Development/PlugIns/JavaScript

TracNav(Development)? This is part of the Development Documentation Project, please help document Colloquy if you know anything that would be relevant here for other users to know about.

JavaScript PlugIns for Colloquy

To develop JavaScript PlugIns, you will need:

  • A plain text editor (TextEdit is fine in plain-text mode).
  • The latest list of function names Colloquy looks for (available in the Colloquy SDK JavaScript template below).
  • Reasonably good knowledge of JavaScript, Colloquy classes and utilizing the Cocoa frameworks.
  • A good understanding of how to call Objective-C methods from JavaScript, detailed in Using Objective-C From JavaScript.

There is a template script available in the JavaScript SDK section containing stubs and commentary for all available functions a JavaScript PlugIn for Colloquy can implement.

For those not familiar with the language, we recomend: W3Schools' JavaScript Tutorial.

(for more information come to our chat room)


Example Plugin: Bug URL Reply

The following example will send a reply message to anyone that mentions the word "bug" or "bugs". This is a simple script that matches a regular expression on incomming messages and constructs a reply message to send. Note: this script requires build 3450 or later.

Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found

Example Plugin: Digg Toolbar Item

The following example will allow you to add a Digg toolbar icon to a chat room or direct chat. Note: this script requires build 3466 or later.

Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found

Example Plugin: Grab URL Titles

The following example will take a URL mentioned in the chat and get it's title by fetching the HTML. Save this script in Colloquy's PlugIns folder as "Grab Title.js" and /reload plugins in Colloquy. Note: this script requires build 3437 or later.

Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found
Last modified 7 years ago Last modified on Nov 16, 2010 6:18:22 PM