Remove redundant modifier state variables

This commit is contained in:
samhed 2016-08-25 16:55:55 +02:00 committed by Pierre Ossman
parent 8bf688265d
commit b0c6d3c6aa
1 changed files with 12 additions and 21 deletions

View File

@ -50,9 +50,6 @@ var UI;
lastKeyboardinput: null, lastKeyboardinput: null,
defaultKeyboardinputLen: 100, defaultKeyboardinputLen: 100,
ctrlOn: false,
altOn: false,
// Setup rfb object, load settings from browser storage, then call // Setup rfb object, load settings from browser storage, then call
// UI.init to setup the UI/menus // UI.init to setup the UI/menus
load: function(callback) { load: function(callback) {
@ -1280,31 +1277,25 @@ var UI;
toggleCtrl: function() { toggleCtrl: function() {
UI.keepKeyboard(); UI.keepKeyboard();
if(UI.ctrlOn === false) { var btn = document.getElementById('noVNC_toggle_ctrl_button');
UI.rfb.sendKey(KeyTable.XK_Control_L, true); if (btn.classList.contains("noVNC_selected")) {
document.getElementById('noVNC_toggle_ctrl_button')
.classList.add("noVNC_selected");
UI.ctrlOn = true;
} else if(UI.ctrlOn === true) {
UI.rfb.sendKey(KeyTable.XK_Control_L, false); UI.rfb.sendKey(KeyTable.XK_Control_L, false);
document.getElementById('noVNC_toggle_ctrl_button') btn.classList.remove("noVNC_selected");
.classList.remove("noVNC_selected"); } else {
UI.ctrlOn = false; UI.rfb.sendKey(KeyTable.XK_Control_L, true);
btn.classList.add("noVNC_selected");
} }
}, },
toggleAlt: function() { toggleAlt: function() {
UI.keepKeyboard(); UI.keepKeyboard();
if(UI.altOn === false) { var btn = document.getElementById('noVNC_toggle_alt_button');
UI.rfb.sendKey(KeyTable.XK_Alt_L, true); if (btn.classList.contains("noVNC_selected")) {
document.getElementById('noVNC_toggle_alt_button')
.classList.add("noVNC_selected");
UI.altOn = true;
} else if(UI.altOn === true) {
UI.rfb.sendKey(KeyTable.XK_Alt_L, false); UI.rfb.sendKey(KeyTable.XK_Alt_L, false);
document.getElementById('noVNC_toggle_alt_button') btn.classList.remove("noVNC_selected");
.classList.remove("noVNC_selected"); } else {
UI.altOn = false; UI.rfb.sendKey(KeyTable.XK_Alt_L, true);
btn.classList.add("noVNC_selected");
} }
}, },