adding desktop notifications
This commit is contained in:
parent
de8a0b2e37
commit
81d4941553
2 changed files with 18 additions and 3 deletions
|
@ -18,12 +18,12 @@ Sockets have been introduced in Chromium 24. Therefore, it is required to have a
|
|||
### Messages
|
||||
At first, chromesoul's was only intended to provide an access to internet from the PIE and didn't supported messages. However, I changed my mind and decided to include this feature. Don't panic if you don't want to be disturbed, it's possible to turn it off. All you have to do is to go in your settings and uncheck the little box.
|
||||
|
||||
### Desktop notifications
|
||||
There's a few bugs with avatars, however it works.
|
||||
|
||||
### State change
|
||||
It's on it's way.
|
||||
|
||||
### Desktop notifications
|
||||
Not yet, but soon. Yes, you'll be able to deactivate it.
|
||||
|
||||
### File transfer
|
||||
Maybe later.
|
||||
|
||||
|
|
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