Standardize on camelCase in App

This commit is contained in:
Samuel Mannehed 2020-05-31 23:36:56 +02:00
parent f2fbaacc82
commit 756af5b44c
2 changed files with 31 additions and 31 deletions

View File

@ -37,9 +37,9 @@ const UI = {
lastKeyboardinput: null, lastKeyboardinput: null,
defaultKeyboardinputLen: 100, defaultKeyboardinputLen: 100,
inhibit_reconnect: true, inhibitReconnect: true,
reconnect_callback: null, reconnectCallback: null,
reconnect_password: null, reconnectPassword: null,
prime() { prime() {
return WebUtil.initSettings().then(() => { return WebUtil.initSettings().then(() => {
@ -394,25 +394,25 @@ const UI = {
document.documentElement.classList.remove("noVNC_disconnecting"); document.documentElement.classList.remove("noVNC_disconnecting");
document.documentElement.classList.remove("noVNC_reconnecting"); document.documentElement.classList.remove("noVNC_reconnecting");
const transition_elem = document.getElementById("noVNC_transition_text"); const transitionElem = document.getElementById("noVNC_transition_text");
switch (state) { switch (state) {
case 'init': case 'init':
break; break;
case 'connecting': case 'connecting':
transition_elem.textContent = _("Connecting..."); transitionElem.textContent = _("Connecting...");
document.documentElement.classList.add("noVNC_connecting"); document.documentElement.classList.add("noVNC_connecting");
break; break;
case 'connected': case 'connected':
document.documentElement.classList.add("noVNC_connected"); document.documentElement.classList.add("noVNC_connected");
break; break;
case 'disconnecting': case 'disconnecting':
transition_elem.textContent = _("Disconnecting..."); transitionElem.textContent = _("Disconnecting...");
document.documentElement.classList.add("noVNC_disconnecting"); document.documentElement.classList.add("noVNC_disconnecting");
break; break;
case 'disconnected': case 'disconnected':
break; break;
case 'reconnecting': case 'reconnecting':
transition_elem.textContent = _("Reconnecting..."); transitionElem.textContent = _("Reconnecting...");
document.documentElement.classList.add("noVNC_reconnecting"); document.documentElement.classList.add("noVNC_reconnecting");
break; break;
default: default:
@ -452,11 +452,11 @@ const UI = {
.classList.remove('noVNC_open'); .classList.remove('noVNC_open');
}, },
showStatus(text, status_type, time) { showStatus(text, statusType, time) {
const statusElem = document.getElementById('noVNC_status'); const statusElem = document.getElementById('noVNC_status');
if (typeof status_type === 'undefined') { if (typeof statusType === 'undefined') {
status_type = 'normal'; statusType = 'normal';
} }
// Don't overwrite more severe visible statuses and never // Don't overwrite more severe visible statuses and never
@ -466,14 +466,14 @@ const UI = {
return; return;
} }
if (statusElem.classList.contains("noVNC_status_warn") && if (statusElem.classList.contains("noVNC_status_warn") &&
status_type === 'normal') { statusType === 'normal') {
return; return;
} }
} }
clearTimeout(UI.statusTimeout); clearTimeout(UI.statusTimeout);
switch (status_type) { switch (statusType) {
case 'error': case 'error':
statusElem.classList.remove("noVNC_status_warn"); statusElem.classList.remove("noVNC_status_warn");
statusElem.classList.remove("noVNC_status_normal"); statusElem.classList.remove("noVNC_status_normal");
@ -503,7 +503,7 @@ const UI = {
} }
// Error messages do not timeout // Error messages do not timeout
if (status_type !== 'error') { if (statusType !== 'error') {
UI.statusTimeout = window.setTimeout(UI.hideStatus, time); UI.statusTimeout = window.setTimeout(UI.hideStatus, time);
} }
}, },
@ -1003,7 +1003,7 @@ const UI = {
if (typeof password === 'undefined') { if (typeof password === 'undefined') {
password = WebUtil.getConfigVar('password'); password = WebUtil.getConfigVar('password');
UI.reconnect_password = password; UI.reconnectPassword = password;
} }
if (password === null) { if (password === null) {
@ -1060,7 +1060,7 @@ const UI = {
UI.connected = false; UI.connected = false;
// Disable automatic reconnecting // Disable automatic reconnecting
UI.inhibit_reconnect = true; UI.inhibitReconnect = true;
UI.updateVisualState('disconnecting'); UI.updateVisualState('disconnecting');
@ -1068,20 +1068,20 @@ const UI = {
}, },
reconnect() { reconnect() {
UI.reconnect_callback = null; UI.reconnectCallback = null;
// if reconnect has been disabled in the meantime, do nothing. // if reconnect has been disabled in the meantime, do nothing.
if (UI.inhibit_reconnect) { if (UI.inhibitReconnect) {
return; return;
} }
UI.connect(null, UI.reconnect_password); UI.connect(null, UI.reconnectPassword);
}, },
cancelReconnect() { cancelReconnect() {
if (UI.reconnect_callback !== null) { if (UI.reconnectCallback !== null) {
clearTimeout(UI.reconnect_callback); clearTimeout(UI.reconnectCallback);
UI.reconnect_callback = null; UI.reconnectCallback = null;
} }
UI.updateVisualState('disconnected'); UI.updateVisualState('disconnected');
@ -1092,7 +1092,7 @@ const UI = {
connectFinished(e) { connectFinished(e) {
UI.connected = true; UI.connected = true;
UI.inhibit_reconnect = false; UI.inhibitReconnect = false;
let msg; let msg;
if (UI.getSetting('encrypt')) { if (UI.getSetting('encrypt')) {
@ -1126,11 +1126,11 @@ const UI = {
} else { } else {
UI.showStatus(_("Failed to connect to server"), 'error'); UI.showStatus(_("Failed to connect to server"), 'error');
} }
} else if (UI.getSetting('reconnect', false) === true && !UI.inhibit_reconnect) { } else if (UI.getSetting('reconnect', false) === true && !UI.inhibitReconnect) {
UI.updateVisualState('reconnecting'); UI.updateVisualState('reconnecting');
const delay = parseInt(UI.getSetting('reconnect_delay')); const delay = parseInt(UI.getSetting('reconnect_delay'));
UI.reconnect_callback = setTimeout(UI.reconnect, delay); UI.reconnectCallback = setTimeout(UI.reconnect, delay);
return; return;
} else { } else {
UI.updateVisualState('disconnected'); UI.updateVisualState('disconnected');
@ -1203,7 +1203,7 @@ const UI = {
inputElemPassword.value = ""; inputElemPassword.value = "";
UI.rfb.sendCredentials({ username: username, password: password }); UI.rfb.sendCredentials({ username: username, password: password });
UI.reconnect_password = password; UI.reconnectPassword = password;
document.getElementById('noVNC_credentials_dlg') document.getElementById('noVNC_credentials_dlg')
.classList.remove('noVNC_open'); .classList.remove('noVNC_open');
}, },
@ -1634,8 +1634,8 @@ const UI = {
* ------v------*/ * ------v------*/
setMouseButton(num) { setMouseButton(num) {
const view_only = UI.rfb.viewOnly; const viewOnly = UI.rfb.viewOnly;
if (UI.rfb && !view_only) { if (UI.rfb && !viewOnly) {
UI.rfb.touchButton = num; UI.rfb.touchButton = num;
} }
@ -1643,7 +1643,7 @@ const UI = {
for (let b = 0; b < blist.length; b++) { for (let b = 0; b < blist.length; b++) {
const button = document.getElementById('noVNC_mouse_button' + const button = document.getElementById('noVNC_mouse_button' +
blist[b]); blist[b]);
if (blist[b] === num && !view_only) { if (blist[b] === num && !viewOnly) {
button.classList.remove("noVNC_hidden"); button.classList.remove("noVNC_hidden");
} else { } else {
button.classList.add("noVNC_hidden"); button.classList.add("noVNC_hidden");

View File

@ -184,7 +184,7 @@ export function injectParamIfMissing(path, param, value) {
const elem = document.createElement('a'); const elem = document.createElement('a');
elem.href = path; elem.href = path;
const param_eq = encodeURIComponent(param) + "="; const paramEq = encodeURIComponent(param) + "=";
let query; let query;
if (elem.search) { if (elem.search) {
query = elem.search.slice(1).split('&'); query = elem.search.slice(1).split('&');
@ -192,8 +192,8 @@ export function injectParamIfMissing(path, param, value) {
query = []; query = [];
} }
if (!query.some(v => v.startsWith(param_eq))) { if (!query.some(v => v.startsWith(paramEq))) {
query.push(param_eq + encodeURIComponent(value)); query.push(paramEq + encodeURIComponent(value));
elem.search = "?" + query.join("&"); elem.search = "?" + query.join("&");
} }