Skip to content

Instantly share code, notes, and snippets.

@JoeRobich
Created July 24, 2014 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeRobich/1787e17acfc5a0e64835 to your computer and use it in GitHub Desktop.
Save JoeRobich/1787e17acfc5a0e64835 to your computer and use it in GitHub Desktop.
This is a GreaseMonkey script that fixes HipChat's annoying behavior of breaking up multiple consecutive chats into different chat blocks.
// ==UserScript==
// @name       HipChat append fix
// @namespace  http://joeyrobichaud.com/
// @version    0.1
// @description  Sending multiple messages in a row will create multiple chat blocks even though you are the sender of each of them. this fixes that.
// @match      https://*.hipchat.com/chat
// @copyright  2014+, Joey Robichaud
// ==/UserScript==
window.addEventListener("load", function(e) {
    var old_add_chat_text = chat.add_chat_text;
    chat.add_chat_text = function(jid, text, type, args) {
        var oldFrom;
        if (type == "chat" && args.is_echo)
          oldFrom = this.chats_last_from[jid];
        
        old_add_chat_text.apply(this, [jid, text, type, args]);
        
        if (oldFrom)
          this.chats_last_from[jid] = oldFrom;
    };
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment