diff --git a/README.md b/README.md index 830ec55..de58744 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/nsui.js b/lib/nsui.js index 729c0e5..cf3bc32 100644 --- a/lib/nsui.js +++ b/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); + }); + } } };