adding desktop notifications
This commit is contained in:
parent
de8a0b2e37
commit
81d4941553
2 changed files with 18 additions and 3 deletions
15
lib/nsui.js
15
lib/nsui.js
|
@ -98,6 +98,21 @@ Nsui.prototype.addContentToTab = function(tab_name, content) {
|
|||
if ($cs.opts.get("enable_msg")) {
|
||||
tab = this.addNewTab(tab_name);
|
||||
tab.appendMessage(content);
|
||||
|
||||
if (typeof content.login !== "undefined" && content.login !== null && $cs.opts.get("enable_notif")) {
|
||||
$cs.avatars.get(content.login, function(url) {
|
||||
var notif = webkitNotifications.createNotification(
|
||||
url,
|
||||
content.login,
|
||||
content.message.substr(0, 24)
|
||||
);
|
||||
console.log(notif);
|
||||
notif.show();
|
||||
setTimeout(function() {
|
||||
notif.cancel();
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue