Merge branch 'style' of https://github.com/CendioOssman/noVNC
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
// No ES6 can be used in this file since it's used for the translation
|
||||
/* eslint-disable prefer-arrow-callback */
|
||||
|
||||
(function() {
|
||||
(function _scope() {
|
||||
"use strict";
|
||||
|
||||
// Fallback for all uncought errors
|
||||
function handleError (event, err) {
|
||||
function handleError(event, err) {
|
||||
try {
|
||||
const msg = document.getElementById('noVNC_fallback_errormsg');
|
||||
|
||||
@@ -53,6 +53,6 @@
|
||||
// from being printed to the browser console.
|
||||
return false;
|
||||
}
|
||||
window.addEventListener('error', function (evt) { handleError(evt, evt.error); });
|
||||
window.addEventListener('unhandledrejection', function (evt) { handleError(evt.reason, evt.reason); });
|
||||
window.addEventListener('error', function onerror(evt) { handleError(evt, evt.error); });
|
||||
window.addEventListener('unhandledrejection', function onreject(evt) { handleError(evt.reason, evt.reason); });
|
||||
})();
|
||||
|
||||
+9
-5
@@ -53,10 +53,12 @@ export class Localizer {
|
||||
.replace("_", "-")
|
||||
.split("-");
|
||||
|
||||
if (userLang[0] !== supLang[0])
|
||||
if (userLang[0] !== supLang[0]) {
|
||||
continue;
|
||||
if (userLang[1] !== supLang[1])
|
||||
}
|
||||
if (userLang[1] !== supLang[1]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.language = supportedLanguages[j];
|
||||
return;
|
||||
@@ -69,10 +71,12 @@ export class Localizer {
|
||||
.replace("_", "-")
|
||||
.split("-");
|
||||
|
||||
if (userLang[0] !== supLang[0])
|
||||
if (userLang[0] !== supLang[0]) {
|
||||
continue;
|
||||
if (supLang[1] !== undefined)
|
||||
}
|
||||
if (supLang[1] !== undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.language = supportedLanguages[j];
|
||||
return;
|
||||
@@ -132,7 +136,7 @@ export class Localizer {
|
||||
}
|
||||
if (elem.hasAttribute("label") &&
|
||||
isAnyOf(elem.tagName, ["MENUITEM", "MENU", "OPTGROUP",
|
||||
"OPTION", "TRACK"])) {
|
||||
"OPTION", "TRACK"])) {
|
||||
translateAttribute(elem, "label");
|
||||
}
|
||||
// FIXME: Should update "lang"
|
||||
|
||||
@@ -145,10 +145,9 @@ const UI = {
|
||||
// set manually
|
||||
let port = window.location.port;
|
||||
if (!port) {
|
||||
if (window.location.protocol.substring(0,5) == 'https') {
|
||||
if (window.location.protocol.substring(0, 5) == 'https') {
|
||||
port = 443;
|
||||
}
|
||||
else if (window.location.protocol.substring(0,4) == 'http') {
|
||||
} else if (window.location.protocol.substring(0, 4) == 'http') {
|
||||
port = 80;
|
||||
}
|
||||
}
|
||||
@@ -779,7 +778,7 @@ const UI = {
|
||||
const ctrl = document.getElementById('noVNC_setting_' + name);
|
||||
let val = WebUtil.readSetting(name);
|
||||
if (typeof val !== 'undefined' && val !== null && ctrl.type === 'checkbox') {
|
||||
if (val.toString().toLowerCase() in {'0':1, 'no':1, 'false':1}) {
|
||||
if (val.toString().toLowerCase() in {'0': 1, 'no': 1, 'false': 1}) {
|
||||
val = false;
|
||||
} else {
|
||||
val = true;
|
||||
@@ -940,7 +939,7 @@ const UI = {
|
||||
},
|
||||
|
||||
clipboardReceive(e) {
|
||||
Log.Debug(">> UI.clipboardReceive: " + e.detail.text.substr(0,40) + "...");
|
||||
Log.Debug(">> UI.clipboardReceive: " + e.detail.text.substr(0, 40) + "...");
|
||||
document.getElementById('noVNC_clipboard_text').value = e.detail.text;
|
||||
Log.Debug("<< UI.clipboardReceive");
|
||||
},
|
||||
@@ -952,7 +951,7 @@ const UI = {
|
||||
|
||||
clipboardSend() {
|
||||
const text = document.getElementById('noVNC_clipboard_text').value;
|
||||
Log.Debug(">> UI.clipboardSend: " + text.substr(0,40) + "...");
|
||||
Log.Debug(">> UI.clipboardSend: " + text.substr(0, 40) + "...");
|
||||
UI.rfb.clipboardPasteFrom(text);
|
||||
Log.Debug("<< UI.clipboardSend");
|
||||
},
|
||||
@@ -1011,7 +1010,7 @@ const UI = {
|
||||
url = UI.getSetting('encrypt') ? 'wss' : 'ws';
|
||||
|
||||
url += '://' + host;
|
||||
if(port) {
|
||||
if (port) {
|
||||
url += ':' + port;
|
||||
}
|
||||
url += '/' + path;
|
||||
@@ -1334,7 +1333,7 @@ const UI = {
|
||||
// Move the caret to the end
|
||||
input.setSelectionRange(l, l);
|
||||
} catch (err) {
|
||||
// setSelectionRange is undefined in Google Chrome
|
||||
// setSelectionRange is undefined in Google Chrome
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1502,7 +1501,7 @@ const UI = {
|
||||
},
|
||||
|
||||
toggleExtraKeys() {
|
||||
if(document.getElementById('noVNC_modifiers')
|
||||
if (document.getElementById('noVNC_modifiers')
|
||||
.classList.contains("noVNC_open")) {
|
||||
UI.closeExtraKeys();
|
||||
} else {
|
||||
@@ -1556,7 +1555,7 @@ const UI = {
|
||||
UI.rfb.touchButton = num;
|
||||
}
|
||||
|
||||
const blist = [0, 1,2,4];
|
||||
const blist = [0, 1, 2, 4];
|
||||
for (let b = 0; b < blist.length; b++) {
|
||||
const button = document.getElementById('noVNC_mouse_button' +
|
||||
blist[b]);
|
||||
|
||||
+14
-14
@@ -10,7 +10,7 @@
|
||||
import { init_logging as main_init_logging } from '../core/util/logging.js';
|
||||
|
||||
// init log level reading the logging HTTP param
|
||||
export function init_logging (level) {
|
||||
export function init_logging(level) {
|
||||
"use strict";
|
||||
if (typeof level !== "undefined") {
|
||||
main_init_logging(level);
|
||||
@@ -21,12 +21,12 @@ export function init_logging (level) {
|
||||
}
|
||||
|
||||
// Read a query string variable
|
||||
export function getQueryVar (name, defVal) {
|
||||
export function getQueryVar(name, defVal) {
|
||||
"use strict";
|
||||
const re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
|
||||
match = document.location.href.match(re);
|
||||
if (typeof defVal === 'undefined') { defVal = null; }
|
||||
|
||||
|
||||
if (match) {
|
||||
return decodeURIComponent(match[1]);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export function getQueryVar (name, defVal) {
|
||||
}
|
||||
|
||||
// Read a hash fragment variable
|
||||
export function getHashVar (name, defVal) {
|
||||
export function getHashVar(name, defVal) {
|
||||
"use strict";
|
||||
const re = new RegExp('.*[&#]' + name + '=([^&]*)'),
|
||||
match = document.location.hash.match(re);
|
||||
@@ -50,7 +50,7 @@ export function getHashVar (name, defVal) {
|
||||
|
||||
// Read a variable from the fragment or the query string
|
||||
// Fragment takes precedence
|
||||
export function getConfigVar (name, defVal) {
|
||||
export function getConfigVar(name, defVal) {
|
||||
"use strict";
|
||||
const val = getHashVar(name);
|
||||
|
||||
@@ -66,7 +66,7 @@ export function getConfigVar (name, defVal) {
|
||||
*/
|
||||
|
||||
// No days means only for this browser session
|
||||
export function createCookie (name, value, days) {
|
||||
export function createCookie(name, value, days) {
|
||||
"use strict";
|
||||
let date, expires;
|
||||
if (days) {
|
||||
@@ -86,7 +86,7 @@ export function createCookie (name, value, days) {
|
||||
document.cookie = name + "=" + value + expires + "; path=/" + secure;
|
||||
}
|
||||
|
||||
export function readCookie (name, defaultValue) {
|
||||
export function readCookie(name, defaultValue) {
|
||||
"use strict";
|
||||
const nameEQ = name + "=";
|
||||
const ca = document.cookie.split(';');
|
||||
@@ -104,7 +104,7 @@ export function readCookie (name, defaultValue) {
|
||||
return (typeof defaultValue !== 'undefined') ? defaultValue : null;
|
||||
}
|
||||
|
||||
export function eraseCookie (name) {
|
||||
export function eraseCookie(name) {
|
||||
"use strict";
|
||||
createCookie(name, "", -1);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ export function eraseCookie (name) {
|
||||
|
||||
let settings = {};
|
||||
|
||||
export function initSettings (callback /*, ...callbackArgs */) {
|
||||
export function initSettings(callback /*, ...callbackArgs */) {
|
||||
"use strict";
|
||||
const callbackArgs = Array.prototype.slice.call(arguments, 1);
|
||||
if (window.chrome && window.chrome.storage) {
|
||||
@@ -134,12 +134,12 @@ export function initSettings (callback /*, ...callbackArgs */) {
|
||||
}
|
||||
|
||||
// Update the settings cache, but do not write to permanent storage
|
||||
export function setSetting (name, value) {
|
||||
export function setSetting(name, value) {
|
||||
settings[name] = value;
|
||||
}
|
||||
|
||||
// No days means only for this browser session
|
||||
export function writeSetting (name, value) {
|
||||
export function writeSetting(name, value) {
|
||||
"use strict";
|
||||
if (settings[name] === value) return;
|
||||
settings[name] = value;
|
||||
@@ -150,7 +150,7 @@ export function writeSetting (name, value) {
|
||||
}
|
||||
}
|
||||
|
||||
export function readSetting (name, defaultValue) {
|
||||
export function readSetting(name, defaultValue) {
|
||||
"use strict";
|
||||
let value;
|
||||
if ((name in settings) || (window.chrome && window.chrome.storage)) {
|
||||
@@ -170,7 +170,7 @@ export function readSetting (name, defaultValue) {
|
||||
return value;
|
||||
}
|
||||
|
||||
export function eraseSetting (name) {
|
||||
export function eraseSetting(name) {
|
||||
"use strict";
|
||||
// Deleting here means that next time the setting is read when using local
|
||||
// storage, it will be pulled from local storage again.
|
||||
@@ -185,7 +185,7 @@ export function eraseSetting (name) {
|
||||
}
|
||||
}
|
||||
|
||||
export function injectParamIfMissing (path, param, value) {
|
||||
export function injectParamIfMissing(path, param, value) {
|
||||
// force pretend that we're dealing with a relative path
|
||||
// (assume that we wanted an extra if we pass one in)
|
||||
path = "/" + path;
|
||||
|
||||
Reference in New Issue
Block a user