Comment out full notification until webclient has a config pane. Make webclient title reflect game name. Merges #1046.
This commit is contained in:
parent
57ea70cb82
commit
401b60e233
2 changed files with 69 additions and 64 deletions
|
|
@ -206,9 +206,9 @@ function onText(args, kwargs) {
|
||||||
mwin.append("<div class='" + cls + "'>" + args[0] + "</div>");
|
mwin.append("<div class='" + cls + "'>" + args[0] + "</div>");
|
||||||
mwin.animate({
|
mwin.animate({
|
||||||
scrollTop: document.getElementById("messagewindow").scrollHeight
|
scrollTop: document.getElementById("messagewindow").scrollHeight
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
onNewLine(args[0], null);
|
onNewLine(args[0], null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle prompt output from the server
|
// Handle prompt output from the server
|
||||||
|
|
@ -245,74 +245,78 @@ function onDefault(cmdname, args, kwargs) {
|
||||||
// in Firefox, there it's a standard error.
|
// in Firefox, there it's a standard error.
|
||||||
function onBeforeUnload() {
|
function onBeforeUnload() {
|
||||||
return "You are about to leave the game. Please confirm.";
|
return "You are about to leave the game. Please confirm.";
|
||||||
}
|
}
|
||||||
|
|
||||||
var unread = 0;
|
// Notifications
|
||||||
var originalTitle = document.title;
|
var unread = 0;
|
||||||
var focused = true;
|
var originalTitle = document.title;
|
||||||
var favico;
|
var focused = true;
|
||||||
|
var favico;
|
||||||
/*function onVisibilityChange() {
|
|
||||||
if(!document.hidden) {
|
function onBlur(e) {
|
||||||
document.title = originalTitle;
|
focused = false;
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
// Notifications for unfocused window
|
||||||
function onBlur(e) {
|
function onFocus(e) {
|
||||||
focused = false;
|
focused = true;
|
||||||
}
|
document.title = originalTitle;
|
||||||
|
unread = 0;
|
||||||
function onFocus(e) {
|
favico.badge(0);
|
||||||
focused = true;
|
}
|
||||||
document.title = originalTitle;
|
|
||||||
unread = 0;
|
function onNewLine(text, originator) {
|
||||||
favico.badge(0);
|
if(!focused) {
|
||||||
}
|
// Changes unfocused browser tab title to number of unread messages
|
||||||
|
unread++;
|
||||||
function onNewLine(text, originator) {
|
favico.badge(unread);
|
||||||
if(!focused) {
|
document.title = "(" + unread + ") " + originalTitle;
|
||||||
unread++;
|
|
||||||
favico.badge(unread);
|
//// TODO: Following code adds a full notification popup. It
|
||||||
document.title = "(" + unread + ") " + originalTitle;
|
//// 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 = {
|
||||||
var n = new Notification(title, options);
|
// body: text.replace(/(<([^>]+)>)/ig,""),
|
||||||
n.onclick = function(e) {
|
// icon: "/static/website/images/evennia_logo.png"
|
||||||
e.preventDefault();
|
// }
|
||||||
window.focus();
|
//
|
||||||
this.close();
|
// var n = new Notification(title, options);
|
||||||
}
|
// n.onclick = function(e) {
|
||||||
}
|
// e.preventDefault();
|
||||||
})
|
// window.focus();
|
||||||
}
|
// this.close();
|
||||||
}
|
// // }
|
||||||
|
// }
|
||||||
|
//})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register Events
|
// Register Events
|
||||||
//
|
//
|
||||||
|
|
||||||
// Event when client finishes loading
|
// Event when client finishes loading
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
Notification.requestPermission();
|
Notification.requestPermission();
|
||||||
|
|
||||||
favico = new Favico({
|
favico = new Favico({
|
||||||
animation: 'none'
|
animation: 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Event when client window changes
|
// Event when client window changes
|
||||||
$(window).bind("resize", doWindowResize);
|
$(window).bind("resize", doWindowResize);
|
||||||
|
|
||||||
$(window).blur(onBlur);
|
$(window).blur(onBlur);
|
||||||
$(window).focus(onFocus);
|
$(window).focus(onFocus);
|
||||||
|
|
||||||
//$(document).on("visibilitychange", onVisibilityChange);
|
//$(document).on("visibilitychange", onVisibilityChange);
|
||||||
|
|
||||||
$("#inputfield").bind("resize", doWindowResize)
|
$("#inputfield").bind("resize", doWindowResize)
|
||||||
.keypress(onKeyPress)
|
.keypress(onKeyPress)
|
||||||
.bind("paste", resizeInputField)
|
.bind("paste", resizeInputField)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ JQuery available.
|
||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
<html dir="ltr" lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<title> {{game_name}} </title>
|
||||||
<meta http-equiv="content-type", content="application/xhtml+xml; charset=UTF-8" />
|
<meta http-equiv="content-type", content="application/xhtml+xml; charset=UTF-8" />
|
||||||
<meta name="author" content="Evennia" />
|
<meta name="author" content="Evennia" />
|
||||||
<meta name="generator" content="Evennia" />
|
<meta name="generator" content="Evennia" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue