Added a close warning event to the webclient.
This commit is contained in:
parent
7e3bc95c4c
commit
e88892642b
1 changed files with 8 additions and 1 deletions
|
|
@ -233,6 +233,12 @@ function onDefault(cmdname, args, kwargs) {
|
|||
mwin.scrollTop(mwin[0].scrollHeight);
|
||||
}
|
||||
|
||||
// Ask if user really wants to exit session when closing
|
||||
// the tab or reloading the page. Note: the message is not shown
|
||||
// in Firefox, there it's a standard error.
|
||||
function onBeforeUnload() {
|
||||
return "You are about to leave the game. Please confirm.";
|
||||
}
|
||||
|
||||
//
|
||||
// Register Events
|
||||
|
|
@ -269,7 +275,8 @@ $(document).ready(function() {
|
|||
// Handle pressing the send button
|
||||
$("#inputsend").bind("click", doSendText);
|
||||
// Event when closing window (have to have Evennia initialized)
|
||||
$(window).bind("beforeunload", Evennia.connection.close);
|
||||
$(window).bind("beforeunload", onBeforeUnload);
|
||||
$(window).bind("unload", Evennia.connection.close);
|
||||
|
||||
doWindowResize();
|
||||
// set an idle timer to send idle every 3 minutes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue