diff --git a/evennia/web/webclient/static/webclient/js/webclient_gui.js b/evennia/web/webclient/static/webclient/js/webclient_gui.js
index 6cf1b1aaa3..7505ca491e 100644
--- a/evennia/web/webclient/static/webclient/js/webclient_gui.js
+++ b/evennia/web/webclient/static/webclient/js/webclient_gui.js
@@ -206,9 +206,9 @@ function onText(args, kwargs) {
mwin.append("
" + args[0] + "
");
mwin.animate({
scrollTop: document.getElementById("messagewindow").scrollHeight
- }, 0);
-
- onNewLine(args[0], null);
+ }, 0);
+
+ onNewLine(args[0], null);
}
// Handle prompt output from the server
@@ -245,74 +245,78 @@ function onDefault(cmdname, args, kwargs) {
// in Firefox, there it's a standard error.
function onBeforeUnload() {
return "You are about to leave the game. Please confirm.";
-}
-
-var unread = 0;
-var originalTitle = document.title;
-var focused = true;
-var favico;
-
-/*function onVisibilityChange() {
- if(!document.hidden) {
- document.title = originalTitle;
- }
-}*/
-
-function onBlur(e) {
- focused = false;
-}
-
-function onFocus(e) {
- focused = true;
- document.title = originalTitle;
- unread = 0;
- favico.badge(0);
-}
-
-function onNewLine(text, originator) {
- if(!focused) {
- unread++;
- favico.badge(unread);
- document.title = "(" + unread + ") " + originalTitle;
- 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();
- }
- }
- })
- }
-}
+}
+
+// Notifications
+var unread = 0;
+var originalTitle = document.title;
+var focused = true;
+var favico;
+
+function onBlur(e) {
+ focused = false;
+}
+
+// Notifications for unfocused window
+function onFocus(e) {
+ focused = true;
+ document.title = originalTitle;
+ unread = 0;
+ favico.badge(0);
+}
+
+function onNewLine(text, originator) {
+ if(!focused) {
+ // Changes unfocused browser tab title to number of unread messages
+ unread++;
+ favico.badge(unread);
+ document.title = "(" + unread + ") " + originalTitle;
+
+ //// TODO: Following code adds a full notification popup. It
+ //// works fine but should be possible to turn off if a player
+ //// wants to (pending webclient config pane).
+ ////
+ //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();
+ // // }
+ // }
+ //})
+ }
+}
//
// Register Events
//
// Event when client finishes loading
-$(document).ready(function() {
-
- Notification.requestPermission();
-
- favico = new Favico({
- animation: 'none'
- });
-
+$(document).ready(function() {
+
+ Notification.requestPermission();
+
+ favico = new Favico({
+ animation: 'none'
+ });
+
// Event when client window changes
- $(window).bind("resize", doWindowResize);
-
- $(window).blur(onBlur);
- $(window).focus(onFocus);
-
- //$(document).on("visibilitychange", onVisibilityChange);
-
+ $(window).bind("resize", doWindowResize);
+
+ $(window).blur(onBlur);
+ $(window).focus(onFocus);
+
+ //$(document).on("visibilitychange", onVisibilityChange);
+
$("#inputfield").bind("resize", doWindowResize)
.keypress(onKeyPress)
.bind("paste", resizeInputField)
diff --git a/evennia/web/webclient/templates/webclient/base.html b/evennia/web/webclient/templates/webclient/base.html
index e4169b4159..39838a50e1 100644
--- a/evennia/web/webclient/templates/webclient/base.html
+++ b/evennia/web/webclient/templates/webclient/base.html
@@ -10,6 +10,7 @@ JQuery available.
{% load staticfiles %}
+ {{game_name}}