mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 18:26:32 +01:00
Tab/window title notifications in web client, shows the number of unread messages in brackets before the title.
This commit is contained in:
parent
a6e353548f
commit
5790c82837
1 changed files with 24 additions and 3 deletions
|
|
@ -206,7 +206,9 @@ function onText(args, kwargs) {
|
|||
mwin.append("<div class='" + cls + "'>" + args[0] + "</div>");
|
||||
mwin.animate({
|
||||
scrollTop: document.getElementById("messagewindow").scrollHeight
|
||||
}, 0);
|
||||
}, 0);
|
||||
|
||||
onNewLine(args[0], null);
|
||||
}
|
||||
|
||||
// Handle prompt output from the server
|
||||
|
|
@ -243,7 +245,23 @@ 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;
|
||||
|
||||
function onVisibilityChange() {
|
||||
if(!document.hidden) {
|
||||
document.title = originalTitle;
|
||||
}
|
||||
}
|
||||
|
||||
function onNewLine(originator, text) {
|
||||
if(document.hidden) {
|
||||
unread++;
|
||||
document.title = "(" + unread + ") " + originalTitle;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Register Events
|
||||
|
|
@ -252,7 +270,10 @@ function onBeforeUnload() {
|
|||
// Event when client finishes loading
|
||||
$(document).ready(function() {
|
||||
// Event when client window changes
|
||||
$(window).bind("resize", doWindowResize);
|
||||
$(window).bind("resize", doWindowResize);
|
||||
|
||||
$(document).on("visibilitychange", onVisibilityChange);
|
||||
|
||||
$("#inputfield").bind("resize", doWindowResize)
|
||||
.keypress(onKeyPress)
|
||||
.bind("paste", resizeInputField)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue