mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
pikvm/pikvm#813: optional page close confirmation
This commit is contained in:
parent
a244c36010
commit
c15d743f48
@ -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">
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user