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.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle prompt output from the server
|
// Handle prompt output from the server
|
||||||
|
|
@ -243,7 +245,23 @@ 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;
|
||||||
|
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
|
// Register Events
|
||||||
|
|
@ -252,7 +270,10 @@ function onBeforeUnload() {
|
||||||
// Event when client finishes loading
|
// Event when client finishes loading
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Event when client window changes
|
// Event when client window changes
|
||||||
$(window).bind("resize", doWindowResize);
|
$(window).bind("resize", doWindowResize);
|
||||||
|
|
||||||
|
$(document).on("visibilitychange", onVisibilityChange);
|
||||||
|
|
||||||
$("#inputfield").bind("resize", doWindowResize)
|
$("#inputfield").bind("resize", doWindowResize)
|
||||||
.keypress(onKeyPress)
|
.keypress(onKeyPress)
|
||||||
.bind("paste", resizeInputField)
|
.bind("paste", resizeInputField)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue