Created
September 20, 2012 16:38
-
-
Save dylemma/3756964 to your computer and use it in GitHub Desktop.
Run this to get a popup notification when you receive a message @Yourself within HipChat's web client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var notifyFunc = chat.notify | |
var extraNotifyFunc = function(jid, sender, message){ | |
selfPopups(jid, message); | |
notifyFunc(jid, sender, message); | |
} | |
chat.notify = extraNotifyFunc | |
function selfPopups(jid, message) { | |
var messageText = util.strip_tags(message) | |
if(!chat.name_tag_regex.exec(messageText)) return | |
if(chat.is_focused) return | |
var notif = new Notification("Hey!", { | |
tag: 'hipchat_notif', | |
body: messageText | |
}) | |
notif.onclick = function(){ | |
chat.focus_chat(jid) | |
this.cancel() | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment