Skip to content

Instantly share code, notes, and snippets.

@dylemma
Created September 20, 2012 16:38
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 dylemma/3756964 to your computer and use it in GitHub Desktop.
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
$(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