mirror of
https://github.com/retspen/webvirtcloud
synced 2026-03-22 18:44:49 +00:00
novnc ES6 compatibility is not working. I reverse it. Spice/VNC sending ctrl+alt+fn functionality restored.
This commit is contained in:
parent
f73271e677
commit
76e6388ec5
53 changed files with 19018 additions and 17438 deletions
|
|
@ -1,43 +1,28 @@
|
|||
'use strict';
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isTouchDevice = undefined;
|
||||
exports.supportsCursorURIs = supportsCursorURIs;
|
||||
exports.isMac = isMac;
|
||||
exports.isIE = isIE;
|
||||
exports.isEdge = isEdge;
|
||||
exports.isWindows = isWindows;
|
||||
exports.isIOS = isIOS;
|
||||
|
||||
var _logging = require('./logging.js');
|
||||
|
||||
var Log = _interopRequireWildcard(_logging);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
import * as Log from './logging.js';
|
||||
|
||||
// Touch detection
|
||||
var isTouchDevice = exports.isTouchDevice = 'ontouchstart' in document.documentElement ||
|
||||
// requried for Chrome debugger
|
||||
document.ontouchstart !== undefined ||
|
||||
// required for MS Surface
|
||||
navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; /*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
export var isTouchDevice = ('ontouchstart' in document.documentElement) ||
|
||||
// requried for Chrome debugger
|
||||
(document.ontouchstart !== undefined) ||
|
||||
// required for MS Surface
|
||||
(navigator.maxTouchPoints > 0) ||
|
||||
(navigator.msMaxTouchPoints > 0);
|
||||
window.addEventListener('touchstart', function onFirstTouch() {
|
||||
exports.isTouchDevice = isTouchDevice = true;
|
||||
isTouchDevice = true;
|
||||
window.removeEventListener('touchstart', onFirstTouch, false);
|
||||
}, false);
|
||||
|
||||
var _cursor_uris_supported = null;
|
||||
|
||||
function supportsCursorURIs() {
|
||||
export function supportsCursorURIs () {
|
||||
if (_cursor_uris_supported === null) {
|
||||
try {
|
||||
var target = document.createElement('canvas');
|
||||
|
|
@ -59,22 +44,26 @@ function supportsCursorURIs() {
|
|||
return _cursor_uris_supported;
|
||||
};
|
||||
|
||||
function isMac() {
|
||||
return navigator && !!/mac/i.exec(navigator.platform);
|
||||
export function isMac() {
|
||||
return navigator && !!(/mac/i).exec(navigator.platform);
|
||||
}
|
||||
|
||||
function isIE() {
|
||||
return navigator && !!/trident/i.exec(navigator.userAgent);
|
||||
export function isIE() {
|
||||
return navigator && !!(/trident/i).exec(navigator.userAgent);
|
||||
}
|
||||
|
||||
function isEdge() {
|
||||
return navigator && !!/edge/i.exec(navigator.userAgent);
|
||||
export function isEdge() {
|
||||
return navigator && !!(/edge/i).exec(navigator.userAgent);
|
||||
}
|
||||
|
||||
function isWindows() {
|
||||
return navigator && !!/win/i.exec(navigator.platform);
|
||||
export function isWindows() {
|
||||
return navigator && !!(/win/i).exec(navigator.platform);
|
||||
}
|
||||
|
||||
export function isIOS() {
|
||||
return navigator &&
|
||||
(!!(/ipad/i).exec(navigator.platform) ||
|
||||
!!(/iphone/i).exec(navigator.platform) ||
|
||||
!!(/ipod/i).exec(navigator.platform));
|
||||
}
|
||||
|
||||
function isIOS() {
|
||||
return navigator && (!!/ipad/i.exec(navigator.platform) || !!/iphone/i.exec(navigator.platform) || !!/ipod/i.exec(navigator.platform));
|
||||
}
|
||||
|
|
@ -1,12 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getPointerEvent = getPointerEvent;
|
||||
exports.stopEvent = stopEvent;
|
||||
exports.setCapture = setCapture;
|
||||
exports.releaseCapture = releaseCapture;
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
|
|
@ -19,11 +10,11 @@ exports.releaseCapture = releaseCapture;
|
|||
* Cross-browser event and position routines
|
||||
*/
|
||||
|
||||
function getPointerEvent(e) {
|
||||
export function getPointerEvent (e) {
|
||||
return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e;
|
||||
};
|
||||
|
||||
function stopEvent(e) {
|
||||
export function stopEvent (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
};
|
||||
|
|
@ -65,13 +56,14 @@ var _captureObserver = new MutationObserver(_captureElemChanged);
|
|||
|
||||
var _captureIndex = 0;
|
||||
|
||||
function setCapture(elem) {
|
||||
export function setCapture (elem) {
|
||||
if (elem.setCapture) {
|
||||
|
||||
elem.setCapture();
|
||||
|
||||
// IE releases capture on 'click' events which might not trigger
|
||||
elem.addEventListener('mouseup', releaseCapture);
|
||||
|
||||
} else {
|
||||
// Release any existing capture in case this method is
|
||||
// called multiple times without coordination
|
||||
|
|
@ -103,7 +95,7 @@ function setCapture(elem) {
|
|||
_captureIndex++;
|
||||
|
||||
// Track cursor and get initial cursor
|
||||
_captureObserver.observe(elem, { attributes: true });
|
||||
_captureObserver.observe(elem, {attributes:true});
|
||||
_captureElemChanged();
|
||||
|
||||
captureElem.style.display = "";
|
||||
|
|
@ -115,10 +107,11 @@ function setCapture(elem) {
|
|||
}
|
||||
};
|
||||
|
||||
function releaseCapture() {
|
||||
export function releaseCapture () {
|
||||
if (document.releaseCapture) {
|
||||
|
||||
document.releaseCapture();
|
||||
|
||||
} else {
|
||||
if (!_captureElem) {
|
||||
return;
|
||||
|
|
@ -126,7 +119,7 @@ function releaseCapture() {
|
|||
|
||||
// There might be events already queued, so we need to wait for
|
||||
// them to flush. E.g. contextmenu in Microsoft Edge
|
||||
window.setTimeout(function (expected) {
|
||||
window.setTimeout(function(expected) {
|
||||
// Only clear it if it's the expected grab (i.e. no one
|
||||
// else has initiated a new grab)
|
||||
if (_captureIndex === expected) {
|
||||
|
|
@ -142,4 +135,4 @@ function releaseCapture() {
|
|||
window.removeEventListener('mousemove', _captureProxy);
|
||||
window.removeEventListener('mouseup', _captureProxy);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright 2017 Pierre Ossman for Cendio AB
|
||||
|
|
@ -12,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|||
*/
|
||||
|
||||
var EventTargetMixin = {
|
||||
_listeners: null,
|
||||
_listeners: null,
|
||||
|
||||
addEventListener: function (type, callback) {
|
||||
addEventListener: function(type, callback) {
|
||||
if (!this._listeners) {
|
||||
this._listeners = new Map();
|
||||
}
|
||||
|
|
@ -24,14 +19,14 @@ var EventTargetMixin = {
|
|||
this._listeners.get(type).add(callback);
|
||||
},
|
||||
|
||||
removeEventListener: function (type, callback) {
|
||||
removeEventListener: function(type, callback) {
|
||||
if (!this._listeners || !this._listeners.has(type)) {
|
||||
return;
|
||||
}
|
||||
this._listeners.get(type).delete(callback);
|
||||
},
|
||||
|
||||
dispatchEvent: function (event) {
|
||||
dispatchEvent: function(event) {
|
||||
if (!this._listeners || !this._listeners.has(event.type)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -39,7 +34,7 @@ var EventTargetMixin = {
|
|||
callback.call(this, event);
|
||||
}, this);
|
||||
return !event.defaultPrevented;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
exports.default = EventTargetMixin;
|
||||
export default EventTargetMixin;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.init_logging = init_logging;
|
||||
exports.get_logging = get_logging;
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
|
|
@ -24,24 +17,24 @@ var Info = function (msg) {};
|
|||
var Warn = function (msg) {};
|
||||
var Error = function (msg) {};
|
||||
|
||||
function init_logging(level) {
|
||||
export function init_logging (level) {
|
||||
if (typeof level === 'undefined') {
|
||||
level = _log_level;
|
||||
} else {
|
||||
_log_level = level;
|
||||
}
|
||||
|
||||
exports.Debug = Debug = exports.Info = Info = exports.Warn = Warn = exports.Error = Error = function (msg) {};
|
||||
Debug = Info = Warn = Error = function (msg) {};
|
||||
if (typeof window.console !== "undefined") {
|
||||
switch (level) {
|
||||
case 'debug':
|
||||
exports.Debug = Debug = console.debug.bind(window.console);
|
||||
Debug = console.debug.bind(window.console);
|
||||
case 'info':
|
||||
exports.Info = Info = console.info.bind(window.console);
|
||||
Info = console.info.bind(window.console);
|
||||
case 'warn':
|
||||
exports.Warn = Warn = console.warn.bind(window.console);
|
||||
Warn = console.warn.bind(window.console);
|
||||
case 'error':
|
||||
exports.Error = Error = console.error.bind(window.console);
|
||||
Error = console.error.bind(window.console);
|
||||
case 'none':
|
||||
break;
|
||||
default:
|
||||
|
|
@ -49,14 +42,10 @@ function init_logging(level) {
|
|||
}
|
||||
}
|
||||
};
|
||||
function get_logging() {
|
||||
export function get_logging () {
|
||||
return _log_level;
|
||||
};
|
||||
exports.Debug = Debug;
|
||||
exports.Info = Info;
|
||||
exports.Warn = Warn;
|
||||
exports.Error = Error;
|
||||
export { Debug, Info, Warn, Error };
|
||||
|
||||
// Initialize logging level
|
||||
|
||||
init_logging();
|
||||
init_logging();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright 2017 Pierre Ossman for noVNC
|
||||
|
|
@ -12,12 +10,9 @@
|
|||
if (typeof Object.assign != 'function') {
|
||||
// Must be writable: true, enumerable: false, configurable: true
|
||||
Object.defineProperty(Object, "assign", {
|
||||
value: function assign(target, varArgs) {
|
||||
// .length of function is 2
|
||||
value: function assign(target, varArgs) { // .length of function is 2
|
||||
'use strict';
|
||||
|
||||
if (target == null) {
|
||||
// TypeError if undefined or null
|
||||
if (target == null) { // TypeError if undefined or null
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
|
|
@ -26,8 +21,7 @@ if (typeof Object.assign != 'function') {
|
|||
for (var index = 1; index < arguments.length; index++) {
|
||||
var nextSource = arguments[index];
|
||||
|
||||
if (nextSource != null) {
|
||||
// Skip over if undefined or null
|
||||
if (nextSource != null) { // Skip over if undefined or null
|
||||
for (var nextKey in nextSource) {
|
||||
// Avoid bugs when hasOwnProperty is shadowed
|
||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||
|
|
@ -45,10 +39,10 @@ if (typeof Object.assign != 'function') {
|
|||
|
||||
/* CustomEvent constructor (taken from MDN) */
|
||||
(function () {
|
||||
function CustomEvent(event, params) {
|
||||
function CustomEvent ( event, params ) {
|
||||
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
||||
var evt = document.createEvent('CustomEvent');
|
||||
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
||||
var evt = document.createEvent( 'CustomEvent' );
|
||||
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
|
||||
return evt;
|
||||
}
|
||||
|
||||
|
|
@ -57,4 +51,4 @@ if (typeof Object.assign != 'function') {
|
|||
if (typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = CustomEvent;
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.decodeUTF8 = decodeUTF8;
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
|
|
@ -15,8 +9,7 @@ exports.decodeUTF8 = decodeUTF8;
|
|||
/*
|
||||
* Decode from UTF-8
|
||||
*/
|
||||
function decodeUTF8(utf8string) {
|
||||
"use strict";
|
||||
|
||||
return decodeURIComponent(escape(utf8string));
|
||||
};
|
||||
export function decodeUTF8 (utf8string) {
|
||||
"use strict";
|
||||
return decodeURIComponent(escape(utf8string));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue