adding desktop notifications

This commit is contained in:
Rodolphe Breard 2013-01-13 20:09:01 +01:00
parent de8a0b2e37
commit 81d4941553
2 changed files with 18 additions and 3 deletions

View file

@ -18,12 +18,12 @@ Sockets have been introduced in Chromium 24. Therefore, it is required to have a
### Messages ### 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. 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 ### State change
It's on it's way. It's on it's way.
### Desktop notifications
Not yet, but soon. Yes, you'll be able to deactivate it.
### File transfer ### File transfer
Maybe later. Maybe later.

View file

@ -98,6 +98,21 @@ Nsui.prototype.addContentToTab = function(tab_name, content) {
if ($cs.opts.get("enable_msg")) { if ($cs.opts.get("enable_msg")) {
tab = this.addNewTab(tab_name); tab = this.addNewTab(tab_name);
tab.appendMessage(content); 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);
});
}
} }
}; };