Our First User Built Plugins

Anyone with administrator rights can write plugins that everyone will have enabled.

We sent out over 400 emails today to the people who signed up. Within only a few hours of signing up @mattbuck wrote a highlight-your-name plugin. He told us it wasn’t ready for usage yet and that he had ideas for improvement but we can’t blame him. He learned a plugin API in 2 hours and released this really cool plugin.

plugin.onMessageInsertion = function(event){
  var last_insertion = Talker.getLastRow();
  var message = last_insertion.find('td.message').find('p:last');
  var current_user_name = Talker.getCurrentUser().name;
  var name_expression = new RegExp(current_user_name);

  if (message.html().match(name_expression)){
    var subs = message.html().split(current_user_name);
    message.html(subs[0] + "<span style='background-color: yellow;'>" 
          + current_user_name 
          + "</span>" + subs[1]);

  }
}

Though we hadn’t shared it yet we have a similar plugin for making entire blocks glow when they contain your name:

plugin.onMessageInsertion = function(event) {
  var me = Talker.currentUser.name;
  var blocks = $("blockquote:contains('" + me + "')")
                       .add("blockquote:contains('" + me.toLowerCase() + "')");

  blocks.css({
    '-moz-box-shadow': '0 0 10px #FF0',
    '-webkit-box-shadow': '0 0 10px #FF0'
  });    
}

Writing plugins is easier than we thought. Other things that could be done with plugins:

  • Converting ticket numbers to clickable links to your favourite ticket tracker.
  • Adding embed support for other sites than youtube(or overwriting the one we built in)
  • Playing a sound when your name is mentioned.
  • With the REST API making it easy to send messages to the log you could also receive messages whenever your continuous integration hits a snag. A plugin could change the background colour of your background.

Just in a day of using Talker @cheeaun created 3 plugins! One for emoticons, one for integrating Google searches and one for embedding GitHub gists into the log.

blog comments powered by Disqus