From 3c1681fd2bc43dffcc75b82760d3f068af97574c Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Fri, 8 Nov 2019 01:34:30 +0300 Subject: refactoring --- web/share/js/kvm/atx.js | 6 +----- web/share/js/kvm/mouse.js | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'web/share') diff --git a/web/share/js/kvm/atx.js b/web/share/js/kvm/atx.js index d65d1ded..a7c6bbed 100644 --- a/web/share/js/kvm/atx.js +++ b/web/share/js/kvm/atx.js @@ -45,11 +45,7 @@ export function Atx() { self.setState = function(state) { if (state) { - if (state.enabled) { - $("atx-dropdown").classList.remove("feature-disabled"); - } else { - $("atx-dropdown").classList.add("feature-disabled"); - } + $("atx-dropdown").classList.toggle("feature-disabled", !state.enabled); } $("atx-power-led").className = ((state && state.leds.power) ? "led-green" : "led-gray"); diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index 03d90a06..3b5da1de 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -64,11 +64,7 @@ export function Mouse() { self.setSocket = function(ws) { __ws = ws; - if (ws) { - $("stream-box").classList.add("stream-box-mouse-enabled"); - } else { - $("stream-box").classList.remove("stream-box-mouse-enabled"); - } + $("stream-box").classList.toggle("stream-box-mouse-enabled", ws); __updateLeds(); }; -- cgit v1.2.3