diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/kvm/index.html | 9 | ||||
-rw-r--r-- | web/kvm/navbar-system.pug | 2 | ||||
-rw-r--r-- | web/share/js/kvm/main.js | 16 |
3 files changed, 22 insertions, 5 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html index 87414671..803223ac 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -318,6 +318,15 @@ </div> </td> </tr> + <tr> + <td>Ask page close confirmation:</td> + <td align="right"> + <div class="switch-box"> + <input checked type="checkbox" id="page-close-ask-switch"> + <label for="page-close-ask-switch"><span class="switch-inner"></span><span class="switch"></span></label> + </div> + </td> + </tr> </table> <hr> <div class="buttons buttons-row"> diff --git a/web/kvm/navbar-system.pug b/web/kvm/navbar-system.pug index c415c8e9..4bf4ea77 100644 --- a/web/kvm/navbar-system.pug +++ b/web/kvm/navbar-system.pug @@ -96,6 +96,8 @@ li(class="right") label(for="gpio-switch-__v3_usb_breaker__") span(class="switch-inner") span(class="switch") + tr + +menu_switch_notable("page-close-ask-switch", "Ask page close confirmation", true, true) hr div(class="buttons buttons-row") button(data-force-hide-menu data-show-window="keyboard-window" class="row50") • Show keyboard diff --git a/web/share/js/kvm/main.js b/web/share/js/kvm/main.js index 85fcb5db..3717f71d 100644 --- a/web/share/js/kvm/main.js +++ b/web/share/js/kvm/main.js @@ -32,11 +32,17 @@ import {Session} from "./session.js"; export function main() { if (checkBrowser()) { - window.onbeforeunload = function(event) { - let text = "Are you sure you want to close PiKVM session?"; - event.returnValue = text; - return text; - }; + tools.storage.bindSimpleSwitch($("page-close-ask-switch"), "page.close.ask", true, function(value) { + if (value) { + window.onbeforeunload = function(event) { + let text = "Are you sure you want to close PiKVM session?"; + event.returnValue = text; + return text; + }; + } else { + window.onbeforeunload = null; + } + }); initWindowManager(); |