User:JosephHawk/thing.js

var thing = {};

mainRoom.model.chats.bind("afteradd", function(o) {

var t = o.attributes.text; var i = o.attributes.isInlineAlert; thing.parseEvent(t, i); });

thing.parseEvent = function(t, i) {

if (t.match(/.{1,} has joined the chat/gi) && i == true) { thing.prepReply("Hi! =)");   } };

thing.prepReply = function(r) { $("textarea[name=message]").val(r); thing.sendReply; };

thing.sendReply = function {

var e        = jQuery.Event("keypress"); e.which  = 13; e.keyCode = 13;

$("textarea[name=message]").trigger(e); };