Commit 1c7650f0 authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_web_jabber_client: Desktop Notifications when receiving messages.

parent 10ef148f
...@@ -270,6 +270,19 @@ ...@@ -270,6 +270,19 @@
// Only notify when page has no focused. // Only notify when page has no focused.
// It simplifies a lot notification status // It simplifies a lot notification status
document.querySelector("link[rel='shortcut icon']").setAttribute("href", "gadget_jabberclient_notification_warning.ico"); document.querySelector("link[rel='shortcut icon']").setAttribute("href", "gadget_jabberclient_notification_warning.ico");
if ("Notification" in window) {
if (Notification.permission === "granted") {
var notification = new Notification(argument_list[0], {body: argument_list[2]});
}
else if (Notification.permission !== "denied") {
Notification.requestPermission(function (permission) {
if (permission === "granted") {
var notification = new Notification(argument_list[0], {body: argument_list[2]});
}
});
}
}
} }
var gadget = this; var gadget = this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment