client: add warning popup if closing the tab while the connection is still open

This commit is contained in:
mappu 2017-02-05 20:57:38 +13:00
parent 226e6751c6
commit d937491545
1 changed files with 10 additions and 0 deletions

View File

@ -974,6 +974,16 @@ window.onload = function() {
usermenu.hide();
};
window.onbeforeunload = function (e) {
if (hub_state === STATE_ACTIVE) {
// n.b. recent Firefox / Chrome don't display the custom message here.
var confirmationMessage = "Still connected to the hub \"" + hub_hubname + "\".\nAre you sure you want to close?";
e.returnValue = confirmationMessage;
return confirmationMessage;
}
// else: ignore
};
timestamp_format_index = persistence_get("timestamps", 0);
desktop_notifications_enabled = persistence_get("popups");