Implemented the notification popup option
This commit is contained in:
parent
24cb3d3b31
commit
7027a2cf9b
1 changed files with 18 additions and 21 deletions
|
|
@ -349,27 +349,24 @@ function onNewLine(text, originator) {
|
||||||
favico.badge(unread);
|
favico.badge(unread);
|
||||||
document.title = "(" + unread + ") " + originalTitle;
|
document.title = "(" + unread + ") " + originalTitle;
|
||||||
|
|
||||||
//// TODO: Following code adds a full notification popup. It
|
if (("notification_popup" in options) && (options["notification_popup"])) {
|
||||||
//// works fine but should be possible to turn off if a player
|
Notification.requestPermission().then(function(result) {
|
||||||
//// wants to (pending webclient config pane).
|
if(result === "granted") {
|
||||||
////
|
var title = originalTitle === "" ? "Evennia" : originalTitle;
|
||||||
//Notification.requestPermission().then(function(result) {
|
var options = {
|
||||||
// if(result === "granted") {
|
body: text.replace(/(<([^>]+)>)/ig,""),
|
||||||
//
|
icon: "/static/website/images/evennia_logo.png"
|
||||||
// var title = originalTitle === "" ? "Evennia" : originalTitle;
|
}
|
||||||
// var options = {
|
|
||||||
// body: text.replace(/(<([^>]+)>)/ig,""),
|
var n = new Notification(title, options);
|
||||||
// icon: "/static/website/images/evennia_logo.png"
|
n.onclick = function(e) {
|
||||||
// }
|
e.preventDefault();
|
||||||
//
|
window.focus();
|
||||||
// var n = new Notification(title, options);
|
this.close();
|
||||||
// n.onclick = function(e) {
|
}
|
||||||
// e.preventDefault();
|
}
|
||||||
// window.focus();
|
});
|
||||||
// this.close();
|
}
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
//})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue