summaryrefslogtreecommitdiff
path: root/web/share
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-08-06 02:00:13 +0300
committerMaxim Devaev <[email protected]>2021-08-06 02:00:13 +0300
commitd5b59043de77e6ef1bfaec62d4491ecb38351b39 (patch)
tree49549af980b3b555318114ccea94bf9483c08191 /web/share
parentba22978d634dbbf11a0c9cb7573052199f6a763e (diff)
atx confirmation
Diffstat (limited to 'web/share')
-rw-r--r--web/share/js/kvm/atx.js38
1 files changed, 26 insertions, 12 deletions
diff --git a/web/share/js/kvm/atx.js b/web/share/js/kvm/atx.js
index b787eccf..380dfb51 100644
--- a/web/share/js/kvm/atx.js
+++ b/web/share/js/kvm/atx.js
@@ -36,6 +36,12 @@ export function Atx() {
$("atx-power-led").title = "Power Led";
$("atx-hdd-led").title = "Disk Activity Led";
+ $("atx-ask-switch").checked = parseInt(tools.storage.get("atx.ask", "1"));
+ tools.el.setOnClick($("atx-ask-switch"), function() {
+ tools.storage.set("atx.ask", ($("atx-ask-switch").checked ? 1 : 0));
+ }, false);
+
+
for (let args of [
["atx-power-button", "power", "Are you sure you want to press the power button?"],
["atx-power-button-long", "power_long", `
@@ -70,19 +76,27 @@ export function Atx() {
};
var __clickButton = function(button, confirm_msg) {
- wm.confirm(confirm_msg).then(function(ok) {
- if (ok) {
- let http = tools.makeRequest("POST", `/api/atx/click?button=${button}`, function() {
- if (http.readyState === 4) {
- if (http.status === 409) {
- wm.error("Performing another ATX operation for other client.<br>Please try again later");
- } else if (http.status !== 200) {
- wm.error("Click error:<br>", http.responseText);
- }
+ let click_button = function() {
+ let http = tools.makeRequest("POST", `/api/atx/click?button=${button}`, function() {
+ if (http.readyState === 4) {
+ if (http.status === 409) {
+ wm.error("Performing another ATX operation for other client.<br>Please try again later");
+ } else if (http.status !== 200) {
+ wm.error("Click error:<br>", http.responseText);
}
- });
- }
- });
+ }
+ });
+ };
+
+ if ($("atx-ask-switch").checked) {
+ wm.confirm(confirm_msg).then(function(ok) {
+ if (ok) {
+ click_button();
+ }
+ });
+ } else {
+ click_button();
+ }
};
__init__();