mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge branch 'fix_notification_webclient' of git://github.com/chainsol/evennia into chainsol-fix_notification_webclient
This commit is contained in:
commit
a994fd3c63
1 changed files with 24 additions and 21 deletions
|
|
@ -369,28 +369,29 @@ function onNewLine(text, originator) {
|
|||
unread++;
|
||||
favico.badge(unread);
|
||||
document.title = "(" + unread + ") " + originalTitle;
|
||||
if ("Notification" in window){
|
||||
if (("notification_popup" in options) && (options["notification_popup"])) {
|
||||
Notification.requestPermission().then(function(result) {
|
||||
if(result === "granted") {
|
||||
var title = originalTitle === "" ? "Evennia" : originalTitle;
|
||||
var options = {
|
||||
body: text.replace(/(<([^>]+)>)/ig,""),
|
||||
icon: "/static/website/images/evennia_logo.png"
|
||||
}
|
||||
|
||||
if (("notification_popup" in options) && (options["notification_popup"])) {
|
||||
Notification.requestPermission().then(function(result) {
|
||||
if(result === "granted") {
|
||||
var title = originalTitle === "" ? "Evennia" : originalTitle;
|
||||
var options = {
|
||||
body: text.replace(/(<([^>]+)>)/ig,""),
|
||||
icon: "/static/website/images/evennia_logo.png"
|
||||
var n = new Notification(title, options);
|
||||
n.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
window.focus();
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
var n = new Notification(title, options);
|
||||
n.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
window.focus();
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (("notification_sound" in options) && (options["notification_sound"])) {
|
||||
var audio = new Audio("/static/webclient/media/notification.wav");
|
||||
audio.play();
|
||||
});
|
||||
}
|
||||
if (("notification_sound" in options) && (options["notification_sound"])) {
|
||||
var audio = new Audio("/static/webclient/media/notification.wav");
|
||||
audio.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -427,7 +428,9 @@ function doStartDragDialog(event) {
|
|||
// Event when client finishes loading
|
||||
$(document).ready(function() {
|
||||
|
||||
Notification.requestPermission();
|
||||
if ("Notification" in window) {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
|
||||
favico = new Favico({
|
||||
animation: 'none'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue