mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +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
|
@ -66,22 +66,22 @@
|
|||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Send key(s) <span class="caret"></span></a>
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{% trans "Send key(s)" %} <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li onclick='sendCtrlAltDel();'><a href='#'>Ctrl+Alt+Del</a></li>
|
||||
<li id="ctrlaltdel"><a href='#'>Ctrl+Alt+Del</a></li>
|
||||
<li class="divider"></li>
|
||||
<li onclick='sendCtrlAltFN(0);'><a href='#'>Ctrl+Alt+F1</a></li>
|
||||
<li onclick='sendCtrlAltFN(1);'><a href='#'>Ctrl+Alt+F2</a></li>
|
||||
<li onclick='sendCtrlAltFN(2);'><a href='#'>Ctrl+Alt+F3</a></li>
|
||||
<li onclick='sendCtrlAltFN(3);'><a href='#'>Ctrl+Alt+F4</a></li>
|
||||
<li onclick='sendCtrlAltFN(4);'><a href='#'>Ctrl+Alt+F5</a></li>
|
||||
<li onclick='sendCtrlAltFN(5);'><a href='#'>Ctrl+Alt+F6</a></li>
|
||||
<li onclick='sendCtrlAltFN(6);'><a href='#'>Ctrl+Alt+F7</a></li>
|
||||
<li onclick='sendCtrlAltFN(7);'><a href='#'>Ctrl+Alt+F8</a></li>
|
||||
<li onclick='sendCtrlAltFN(8);'><a href='#'>Ctrl+Alt+F9</a></li>
|
||||
<li onclick='sendCtrlAltFN(9);'><a href='#'>Ctrl+Alt+F10</a></li>
|
||||
<li onclick='sendCtrlAltFN(10);'><a href='#'>Ctrl+Alt+F11</a></li>
|
||||
<li onclick='sendCtrlAltFN(11);'><a href='#'>Ctrl+Alt+F12</a></li>
|
||||
<li id="ctrlaltf1"><a href='#'>Ctrl+Alt+F1</a></li>
|
||||
<li id="ctrlaltf2"><a href='#'>Ctrl+Alt+F2</a></li>
|
||||
<li id="ctrlaltf3"><a href='#'>Ctrl+Alt+F3</a></li>
|
||||
<li id="ctrlaltf4"><a href='#'>Ctrl+Alt+F4</a></li>
|
||||
<li id="ctrlaltf5"><a href='#'>Ctrl+Alt+F5</a></li>
|
||||
<li id="ctrlaltf6"><a href='#'>Ctrl+Alt+F6</a></li>
|
||||
<li id="ctrlaltf7"><a href='#'>Ctrl+Alt+F7</a></li>
|
||||
<li id="ctrlaltf8"><a href='#'>Ctrl+Alt+F8</a></li>
|
||||
<li id="ctrlaltf9"><a href='#'>Ctrl+Alt+F9</a></li>
|
||||
<li id="ctrlaltf10"><a href='#'>Ctrl+Alt+F10</a></li>
|
||||
<li id="ctrlaltf11"><a href='#'>Ctrl+Alt+F11</a></li>
|
||||
<li id="ctrlaltf12"><a href='#'>Ctrl+Alt+F12</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li id="fullscreen_button"><a href='#'>{% trans "Fullscreen" %}</a></li>
|
||||
|
@ -89,7 +89,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
/nav>
|
||||
<div id='main_container' class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
|
|
@ -188,30 +188,6 @@
|
|||
resize_helper(sc);
|
||||
}
|
||||
|
||||
function sendCtrlAltFN(f) {
|
||||
if (sc && sc.inputs && sc.inputs.state === "ready"){
|
||||
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
|
||||
|
||||
if (keys_code[f]==undefined) {
|
||||
return;
|
||||
}
|
||||
var key = new SpiceMsgcKeyDown();
|
||||
var msg = new SpiceMiniData();
|
||||
|
||||
update_modifier(true, KEY_LCtrl, sc);
|
||||
update_modifier(true, KEY_Alt, sc);
|
||||
|
||||
key.code = keys_code[f];
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
|
||||
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
|
||||
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
|
||||
}
|
||||
}
|
||||
|
||||
function fullscreen() {
|
||||
var screen=document.getElementById('spice-screen?');
|
||||
if(screen.requestFullscreen) {
|
||||
|
@ -236,7 +212,19 @@
|
|||
});
|
||||
*/
|
||||
document.getElementById("fullscreen_button").addEventListener('click', fullscreen);
|
||||
|
||||
document.getElementById('ctrlaltdel').addEventListener('click', sendCtrlAltDel);
|
||||
document.getElementById('ctrlaltf1').addEventListener('click', function(){sendCtrlAltFN(0);});
|
||||
document.getElementById('ctrlaltf2').addEventListener('click', function(){sendCtrlAltFN(1);});
|
||||
document.getElementById('ctrlaltf3').addEventListener('click', function(){sendCtrlAltFN(2);});
|
||||
document.getElementById('ctrlaltf4').addEventListener('click', function(){sendCtrlAltFN(3);});
|
||||
document.getElementById('ctrlaltf5').addEventListener('click', function(){sendCtrlAltFN(4);});
|
||||
document.getElementById('ctrlaltf6').addEventListener('click', function(){sendCtrlAltFN(5);});
|
||||
document.getElementById('ctrlaltf7').addEventListener('click', function(){sendCtrlAltFN(6);});
|
||||
document.getElementById('ctrlaltf8').addEventListener('click', function(){sendCtrlAltFN(7);});
|
||||
document.getElementById('ctrlaltf9').addEventListener('click', function(){sendCtrlAltFN(8);});
|
||||
document.getElementById('ctrlaltf10').addEventListener('click', function(){sendCtrlAltFN(9);});
|
||||
document.getElementById('ctrlaltf11').addEventListener('click', function(){sendCtrlAltFN(10);});
|
||||
document.getElementById('ctrlaltf12').addEventListener('click', function(){sendCtrlAltFN(11);});
|
||||
connect();
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -210,30 +210,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function sendCtrlAltFN(f) {
|
||||
if (sc && sc.inputs && sc.inputs.state === "ready"){
|
||||
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
|
||||
|
||||
if (keys_code[f]==undefined) {
|
||||
return;
|
||||
}
|
||||
var key = new SpiceMsgcKeyDown();
|
||||
var msg = new SpiceMiniData();
|
||||
|
||||
update_modifier(true, KEY_LCtrl, sc);
|
||||
update_modifier(true, KEY_Alt, sc);
|
||||
|
||||
key.code = keys_code[f];
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
|
||||
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
|
||||
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
|
||||
}
|
||||
}
|
||||
|
||||
function fullscreen() {
|
||||
var screen=document.getElementById('spice-screen');
|
||||
if(screen.requestFullscreen) {
|
||||
|
@ -259,6 +235,19 @@
|
|||
});
|
||||
*/
|
||||
document.getElementById("fullscreen_button").addEventListener('click', fullscreen);
|
||||
document.getElementById('ctrlaltdel').addEventListener('click', sendCtrlAltDel);
|
||||
document.getElementById('ctrlaltf1').addEventListener('click', function(){sendCtrlAltFN(0);});
|
||||
document.getElementById('ctrlaltf2').addEventListener('click', function(){sendCtrlAltFN(1);});
|
||||
document.getElementById('ctrlaltf3').addEventListener('click', function(){sendCtrlAltFN(2);});
|
||||
document.getElementById('ctrlaltf4').addEventListener('click', function(){sendCtrlAltFN(3);});
|
||||
document.getElementById('ctrlaltf5').addEventListener('click', function(){sendCtrlAltFN(4);});
|
||||
document.getElementById('ctrlaltf6').addEventListener('click', function(){sendCtrlAltFN(5);});
|
||||
document.getElementById('ctrlaltf7').addEventListener('click', function(){sendCtrlAltFN(6);});
|
||||
document.getElementById('ctrlaltf8').addEventListener('click', function(){sendCtrlAltFN(7);});
|
||||
document.getElementById('ctrlaltf9').addEventListener('click', function(){sendCtrlAltFN(8);});
|
||||
document.getElementById('ctrlaltf10').addEventListener('click', function(){sendCtrlAltFN(9);});
|
||||
document.getElementById('ctrlaltf11').addEventListener('click', function(){sendCtrlAltFN(10);});
|
||||
document.getElementById('ctrlaltf12').addEventListener('click', function(){sendCtrlAltFN(11);});
|
||||
connect();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
or the fragment:
|
||||
http://example.com/#host=HOST&port=PORT&encrypt=1
|
||||
-->
|
||||
<title xmlns="http://www.w3.org/1999/html">WebVirtCloud - noVNC</title>
|
||||
<title>WebVirtCloud - noVNC</title>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
|
||||
|
@ -65,12 +65,26 @@
|
|||
<script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script>
|
||||
|
||||
<!-- begin scripts -->
|
||||
<script src="{% static "js/novnc/app.js" %}"></script>
|
||||
<!-- promise polyfills promises for IE11 -->
|
||||
<script src="{% static "js/novnc/vendor/promise.js" %}"></script>
|
||||
<!-- ES2015/ES6 modules polyfill -->
|
||||
<script type="module">
|
||||
window._noVNC_has_module_support = true;
|
||||
</script>
|
||||
<script>
|
||||
window.addEventListener("load", function() {
|
||||
if (window._noVNC_has_module_support) return;
|
||||
var loader = document.createElement("script");
|
||||
loader.src = "{% static "js/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js" %}";
|
||||
document.head.appendChild(loader);
|
||||
});
|
||||
</script>
|
||||
<!-- actual script modules -->
|
||||
<script type="module" crossorigin="anonymous" src="{% static "js/novnc/app/ui.js" %}"></script>
|
||||
<!-- end scripts -->
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="noVNC_fallback_error" class="noVNC_center">
|
||||
<div>
|
||||
<div>noVNC encountered an error:</div>
|
||||
|
@ -274,9 +288,7 @@
|
|||
<div id="noVNC_connect_dlg">
|
||||
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
|
||||
<div id="noVNC_connect_button">
|
||||
<div>
|
||||
<img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect
|
||||
</div>
|
||||
<div><img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -63,9 +63,7 @@
|
|||
<!-- promise polyfills promises for IE11 -->
|
||||
<script src="{% static "js/novnc/vendor/promise.js" %}"></script>
|
||||
<!-- ES2015/ES6 modules polyfill -->
|
||||
<script type="module">
|
||||
window._noVNC_has_module_support = true;
|
||||
</script>
|
||||
<script type="module"> window._noVNC_has_module_support = false;</script>
|
||||
<script>
|
||||
window.addEventListener("load", function() {
|
||||
if (window._noVNC_has_module_support) return;
|
||||
|
@ -76,6 +74,7 @@
|
|||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="noVNC_status_bar">
|
||||
|
@ -92,9 +91,7 @@
|
|||
</div>
|
||||
<div id='vnc_container'></div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block foot %}
|
||||
<!-- actual script modules -->
|
||||
<script type="module" crossorigin="anonymous">
|
||||
// Load supporting scripts
|
||||
|
@ -125,17 +122,38 @@
|
|||
rfb.sendCredentials({ password: document.getElementById('password_input').value });
|
||||
return false;
|
||||
}
|
||||
function sendCtrlAltFN(f) {
|
||||
var keys_code=[0xFFBE,0xFFBF,0xFFC0,0xFFC1,0xFFC2,0xFFC3,0xFFC4,0xFFC5,0xFFC6,0xFFC7,0xFFC8,0xFFC9];
|
||||
if (keys_code[f]==undefined) {
|
||||
return;
|
||||
|
||||
function fullscreen() {
|
||||
if (document.fullscreenElement || // alternative standard method
|
||||
document.mozFullScreenElement || // currently working methods
|
||||
document.webkitFullscreenElement ||
|
||||
document.msFullscreenElement) {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.webkitExitFullscreen) {
|
||||
document.webkitExitFullscreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
rfb.sendKey(0xFFE3, 'down');
|
||||
rfb.sendKey(0xFFE9, 'down');
|
||||
rfb.sendKey(keys_code[f], 'down');
|
||||
rfb.sendKey(keys_code[f], 'up');
|
||||
rfb.sendKey(0xFFE9, 'up');
|
||||
rfb.sendKey(0xFFE3, 'up');
|
||||
} else {
|
||||
if (document.documentElement.requestFullscreen) {
|
||||
document.documentElement.requestFullscreen();
|
||||
} else if (document.documentElement.mozRequestFullScreen) {
|
||||
document.documentElement.mozRequestFullScreen();
|
||||
} else if (document.documentElement.webkitRequestFullscreen) {
|
||||
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||
} else if (document.body.msRequestFullscreen) {
|
||||
document.body.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function sendCtrlAltFN(f) {
|
||||
rfb.sendCtrlAltFN(f);
|
||||
return false;
|
||||
}
|
||||
function sendCtrlAltDel() {
|
||||
rfb.sendCtrlAltDel();
|
||||
|
@ -199,6 +217,21 @@
|
|||
document.getElementById('machineShutdownButton').onclick = machineShutdown;
|
||||
document.getElementById('machineRebootButton').onclick = machineReboot;
|
||||
document.getElementById('machineResetButton').onclick = machineReset;
|
||||
document.getElementById('fullscreen_button').onclick = fullscreen;
|
||||
|
||||
document.getElementById('ctrlaltdel').addEventListener('click', sendCtrlAltDel);
|
||||
document.getElementById('ctrlaltf1').addEventListener('click', function(){sendCtrlAltFN(0);});
|
||||
document.getElementById('ctrlaltf2').addEventListener('click', function(){sendCtrlAltFN(1);});
|
||||
document.getElementById('ctrlaltf3').addEventListener('click', function(){sendCtrlAltFN(2);});
|
||||
document.getElementById('ctrlaltf4').addEventListener('click', function(){sendCtrlAltFN(3);});
|
||||
document.getElementById('ctrlaltf5').addEventListener('click', function(){sendCtrlAltFN(4);});
|
||||
document.getElementById('ctrlaltf6').addEventListener('click', function(){sendCtrlAltFN(5);});
|
||||
document.getElementById('ctrlaltf7').addEventListener('click', function(){sendCtrlAltFN(6);});
|
||||
document.getElementById('ctrlaltf8').addEventListener('click', function(){sendCtrlAltFN(7);});
|
||||
document.getElementById('ctrlaltf9').addEventListener('click', function(){sendCtrlAltFN(8);});
|
||||
document.getElementById('ctrlaltf10').addEventListener('click', function(){sendCtrlAltFN(9);});
|
||||
document.getElementById('ctrlaltf11').addEventListener('click', function(){sendCtrlAltFN(10);});
|
||||
document.getElementById('ctrlaltf12').addEventListener('click', function(){sendCtrlAltFN(11);});
|
||||
|
||||
WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn'));
|
||||
document.title = WebUtil.getConfigVar('title', 'noVNC');
|
||||
|
@ -275,4 +308,6 @@
|
|||
rfb.resizeSession = WebUtil.getConfigVar('resize', false);
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
|
@ -111,7 +111,7 @@
|
|||
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
||||
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC/Spice Console" %}">
|
||||
<span class="glyphicon glyphicon-eye-open"></span>
|
||||
</button>
|
||||
{% endifequal %}
|
||||
|
|
12082
static/js/novnc/app.js
12082
static/js/novnc/app.js
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Localizer = Localizer;
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
|
@ -16,7 +10,7 @@ exports.Localizer = Localizer;
|
|||
* Localization Utilities
|
||||
*/
|
||||
|
||||
function Localizer() {
|
||||
export function Localizer() {
|
||||
// Currently configured language
|
||||
this.language = 'en';
|
||||
|
||||
|
@ -48,7 +42,8 @@ Localizer.prototype = {
|
|||
userLang = userLang.split("-");
|
||||
|
||||
// Built-in default?
|
||||
if (userLang[0] === 'en' && (userLang[1] === undefined || userLang[1] === 'us')) {
|
||||
if ((userLang[0] === 'en') &&
|
||||
((userLang[1] === undefined) || (userLang[1] === 'us'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -59,8 +54,10 @@ Localizer.prototype = {
|
|||
supLang = supLang.replace("_", "-");
|
||||
supLang = supLang.split("-");
|
||||
|
||||
if (userLang[0] !== supLang[0]) continue;
|
||||
if (userLang[1] !== supLang[1]) continue;
|
||||
if (userLang[0] !== supLang[0])
|
||||
continue;
|
||||
if (userLang[1] !== supLang[1])
|
||||
continue;
|
||||
|
||||
this.language = supportedLanguages[j];
|
||||
return;
|
||||
|
@ -73,8 +70,10 @@ Localizer.prototype = {
|
|||
supLang = supLang.replace("_", "-");
|
||||
supLang = supLang.split("-");
|
||||
|
||||
if (userLang[0] !== supLang[0]) continue;
|
||||
if (supLang[1] !== undefined) continue;
|
||||
if (userLang[0] !== supLang[0])
|
||||
continue;
|
||||
if (supLang[1] !== undefined)
|
||||
continue;
|
||||
|
||||
this.language = supportedLanguages[j];
|
||||
return;
|
||||
|
@ -121,26 +120,34 @@ Localizer.prototype = {
|
|||
}
|
||||
|
||||
if (enabled) {
|
||||
if (elem.hasAttribute("abbr") && elem.tagName === "TH") {
|
||||
if (elem.hasAttribute("abbr") &&
|
||||
elem.tagName === "TH") {
|
||||
translateAttribute(elem, "abbr");
|
||||
}
|
||||
if (elem.hasAttribute("alt") && isAnyOf(elem.tagName, ["AREA", "IMG", "INPUT"])) {
|
||||
if (elem.hasAttribute("alt") &&
|
||||
isAnyOf(elem.tagName, ["AREA", "IMG", "INPUT"])) {
|
||||
translateAttribute(elem, "alt");
|
||||
}
|
||||
if (elem.hasAttribute("download") && isAnyOf(elem.tagName, ["A", "AREA"])) {
|
||||
if (elem.hasAttribute("download") &&
|
||||
isAnyOf(elem.tagName, ["A", "AREA"])) {
|
||||
translateAttribute(elem, "download");
|
||||
}
|
||||
if (elem.hasAttribute("label") && isAnyOf(elem.tagName, ["MENUITEM", "MENU", "OPTGROUP", "OPTION", "TRACK"])) {
|
||||
if (elem.hasAttribute("label") &&
|
||||
isAnyOf(elem.tagName, ["MENUITEM", "MENU", "OPTGROUP",
|
||||
"OPTION", "TRACK"])) {
|
||||
translateAttribute(elem, "label");
|
||||
}
|
||||
// FIXME: Should update "lang"
|
||||
if (elem.hasAttribute("placeholder") && isAnyOf(elem.tagName, ["INPUT", "TEXTAREA"])) {
|
||||
if (elem.hasAttribute("placeholder") &&
|
||||
isAnyOf(elem.tagName, ["INPUT", "TEXTAREA"])) {
|
||||
translateAttribute(elem, "placeholder");
|
||||
}
|
||||
if (elem.hasAttribute("title")) {
|
||||
translateAttribute(elem, "title");
|
||||
}
|
||||
if (elem.hasAttribute("value") && elem.tagName === "INPUT" && isAnyOf(elem.getAttribute("type"), ["reset", "button", "submit"])) {
|
||||
if (elem.hasAttribute("value") &&
|
||||
elem.tagName === "INPUT" &&
|
||||
isAnyOf(elem.getAttribute("type"), ["reset", "button", "submit"])) {
|
||||
translateAttribute(elem, "value");
|
||||
}
|
||||
}
|
||||
|
@ -156,8 +163,8 @@ Localizer.prototype = {
|
|||
}
|
||||
|
||||
process(document.body, true);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var l10n = exports.l10n = new Localizer();
|
||||
exports.default = l10n.get.bind(l10n);
|
||||
export var l10n = new Localizer();
|
||||
export default l10n.get.bind(l10n);
|
||||
|
|
|
@ -1,49 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _logging = require('../core/util/logging.js');
|
||||
|
||||
var Log = _interopRequireWildcard(_logging);
|
||||
|
||||
var _localization = require('./localization.js');
|
||||
|
||||
var _localization2 = _interopRequireDefault(_localization);
|
||||
|
||||
var _browser = require('../core/util/browser.js');
|
||||
|
||||
var _events = require('../core/util/events.js');
|
||||
|
||||
var _keysym = require('../core/input/keysym.js');
|
||||
|
||||
var _keysym2 = _interopRequireDefault(_keysym);
|
||||
|
||||
var _keysymdef = require('../core/input/keysymdef.js');
|
||||
|
||||
var _keysymdef2 = _interopRequireDefault(_keysymdef);
|
||||
|
||||
var _keyboard = require('../core/input/keyboard.js');
|
||||
|
||||
var _keyboard2 = _interopRequireDefault(_keyboard);
|
||||
|
||||
var _rfb = require('../core/rfb.js');
|
||||
|
||||
var _rfb2 = _interopRequireDefault(_rfb);
|
||||
|
||||
var _display = require('../core/display.js');
|
||||
|
||||
var _display2 = _interopRequireDefault(_display);
|
||||
|
||||
var _webutil = require('./webutil.js');
|
||||
|
||||
var WebUtil = _interopRequireWildcard(_webutil);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
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; } }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
|
@ -54,6 +8,17 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
import * as Log from '../core/util/logging.js';
|
||||
import _, { l10n } from './localization.js';
|
||||
import { isTouchDevice } from '../core/util/browser.js';
|
||||
import { setCapture, getPointerEvent } from '../core/util/events.js';
|
||||
import KeyTable from "../core/input/keysym.js";
|
||||
import keysyms from "../core/input/keysymdef.js";
|
||||
import Keyboard from "../core/input/keyboard.js";
|
||||
import RFB from "../core/rfb.js";
|
||||
import Display from "../core/display.js";
|
||||
import * as WebUtil from "./webutil.js";
|
||||
|
||||
var UI = {
|
||||
|
||||
connected: false,
|
||||
|
@ -95,20 +60,19 @@ var UI = {
|
|||
start: function(callback) {
|
||||
|
||||
// Setup global variables first
|
||||
UI.isSafari = navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1;
|
||||
UI.isSafari = (navigator.userAgent.indexOf('Safari') !== -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') === -1);
|
||||
|
||||
UI.initSettings();
|
||||
|
||||
// Translate the DOM
|
||||
_localization.l10n.translateDOM();
|
||||
l10n.translateDOM();
|
||||
|
||||
// Adapt the interface for touch screen devices
|
||||
if (_browser.isTouchDevice) {
|
||||
if (isTouchDevice) {
|
||||
document.documentElement.classList.add("noVNC_touch");
|
||||
// Remove the address bar
|
||||
setTimeout(function () {
|
||||
window.scrollTo(0, 1);
|
||||
}, 100);
|
||||
setTimeout(function() { window.scrollTo(0, 1); }, 100);
|
||||
}
|
||||
|
||||
// Restore control bar position
|
||||
|
@ -126,7 +90,8 @@ var UI = {
|
|||
UI.addConnectionControlHandlers();
|
||||
UI.addClipboardHandlers();
|
||||
UI.addSettingsHandlers();
|
||||
document.getElementById("noVNC_status").addEventListener('click', UI.hideStatus);
|
||||
document.getElementById("noVNC_status")
|
||||
.addEventListener('click', UI.hideStatus);
|
||||
|
||||
// Bootstrap fallback input handler
|
||||
UI.keyboardinputReset();
|
||||
|
@ -137,7 +102,6 @@ var UI = {
|
|||
|
||||
document.documentElement.classList.remove("noVNC_loading");
|
||||
|
||||
// *ali*
|
||||
//var autoconnect = WebUtil.getConfigVar('autoconnect', false);
|
||||
var autoconnect = UI.getSetting('autoconnect');
|
||||
if (autoconnect === 'true' || autoconnect == '1') {
|
||||
|
@ -157,8 +121,13 @@ var UI = {
|
|||
initFullscreen: function() {
|
||||
// Only show the button if fullscreen is properly supported
|
||||
// * Safari doesn't support alphanumerical input while in fullscreen
|
||||
if (!UI.isSafari && (document.documentElement.requestFullscreen || document.documentElement.mozRequestFullScreen || document.documentElement.webkitRequestFullscreen || document.body.msRequestFullscreen)) {
|
||||
document.getElementById('noVNC_fullscreen_button').classList.remove("noVNC_hidden");
|
||||
if (!UI.isSafari &&
|
||||
(document.documentElement.requestFullscreen ||
|
||||
document.documentElement.mozRequestFullScreen ||
|
||||
document.documentElement.webkitRequestFullscreen ||
|
||||
document.body.msRequestFullscreen)) {
|
||||
document.getElementById('noVNC_fullscreen_button')
|
||||
.classList.remove("noVNC_hidden");
|
||||
UI.addFullscreenHandlers();
|
||||
}
|
||||
},
|
||||
|
@ -182,7 +151,8 @@ var UI = {
|
|||
if (!port) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +160,7 @@ var UI = {
|
|||
/* Populate the controls if defaults are provided in the URL */
|
||||
UI.initSetting('host', window.location.hostname);
|
||||
UI.initSetting('port', port);
|
||||
UI.initSetting('encrypt', window.location.protocol === "https:");
|
||||
UI.initSetting('encrypt', (window.location.protocol === "https:"));
|
||||
UI.initSetting('view_clip', false);
|
||||
UI.initSetting('resize', 'off');
|
||||
UI.initSetting('shared', true);
|
||||
|
@ -230,19 +200,29 @@ var UI = {
|
|||
* ------v------*/
|
||||
|
||||
addControlbarHandlers: function() {
|
||||
document.getElementById("noVNC_control_bar").addEventListener('mousemove', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('mouseup', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('mousedown', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('keydown', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('mousemove', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('mouseup', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('mousedown', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('keydown', UI.activateControlbar);
|
||||
|
||||
document.getElementById("noVNC_control_bar").addEventListener('mousedown', UI.keepControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('keydown', UI.keepControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('mousedown', UI.keepControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('keydown', UI.keepControlbar);
|
||||
|
||||
document.getElementById("noVNC_view_drag_button").addEventListener('click', UI.toggleViewDrag);
|
||||
document.getElementById("noVNC_view_drag_button")
|
||||
.addEventListener('click', UI.toggleViewDrag);
|
||||
|
||||
document.getElementById("noVNC_control_bar_handle").addEventListener('mousedown', UI.controlbarHandleMouseDown);
|
||||
document.getElementById("noVNC_control_bar_handle").addEventListener('mouseup', UI.controlbarHandleMouseUp);
|
||||
document.getElementById("noVNC_control_bar_handle").addEventListener('mousemove', UI.dragControlbarHandle);
|
||||
document.getElementById("noVNC_control_bar_handle")
|
||||
.addEventListener('mousedown', UI.controlbarHandleMouseDown);
|
||||
document.getElementById("noVNC_control_bar_handle")
|
||||
.addEventListener('mouseup', UI.controlbarHandleMouseUp);
|
||||
document.getElementById("noVNC_control_bar_handle")
|
||||
.addEventListener('mousemove', UI.dragControlbarHandle);
|
||||
// resize events aren't available for elements
|
||||
window.addEventListener('resize', UI.updateControlbarHandle);
|
||||
|
||||
|
@ -253,43 +233,52 @@ var UI = {
|
|||
},
|
||||
|
||||
addTouchSpecificHandlers: function() {
|
||||
document.getElementById("noVNC_mouse_button0").addEventListener('click', function () {
|
||||
UI.setMouseButton(1);
|
||||
});
|
||||
document.getElementById("noVNC_mouse_button1").addEventListener('click', function () {
|
||||
UI.setMouseButton(2);
|
||||
});
|
||||
document.getElementById("noVNC_mouse_button2").addEventListener('click', function () {
|
||||
UI.setMouseButton(4);
|
||||
});
|
||||
document.getElementById("noVNC_mouse_button4").addEventListener('click', function () {
|
||||
UI.setMouseButton(0);
|
||||
});
|
||||
document.getElementById("noVNC_keyboard_button").addEventListener('click', UI.toggleVirtualKeyboard);
|
||||
document.getElementById("noVNC_mouse_button0")
|
||||
.addEventListener('click', function () { UI.setMouseButton(1); });
|
||||
document.getElementById("noVNC_mouse_button1")
|
||||
.addEventListener('click', function () { UI.setMouseButton(2); });
|
||||
document.getElementById("noVNC_mouse_button2")
|
||||
.addEventListener('click', function () { UI.setMouseButton(4); });
|
||||
document.getElementById("noVNC_mouse_button4")
|
||||
.addEventListener('click', function () { UI.setMouseButton(0); });
|
||||
document.getElementById("noVNC_keyboard_button")
|
||||
.addEventListener('click', UI.toggleVirtualKeyboard);
|
||||
|
||||
UI.touchKeyboard = new _keyboard2.default(document.getElementById('noVNC_keyboardinput'));
|
||||
UI.touchKeyboard = new Keyboard(document.getElementById('noVNC_keyboardinput'));
|
||||
UI.touchKeyboard.onkeyevent = UI.keyEvent;
|
||||
UI.touchKeyboard.grab();
|
||||
document.getElementById("noVNC_keyboardinput").addEventListener('input', UI.keyInput);
|
||||
document.getElementById("noVNC_keyboardinput").addEventListener('focus', UI.onfocusVirtualKeyboard);
|
||||
document.getElementById("noVNC_keyboardinput").addEventListener('blur', UI.onblurVirtualKeyboard);
|
||||
document.getElementById("noVNC_keyboardinput").addEventListener('submit', function () {
|
||||
return false;
|
||||
});
|
||||
document.getElementById("noVNC_keyboardinput")
|
||||
.addEventListener('input', UI.keyInput);
|
||||
document.getElementById("noVNC_keyboardinput")
|
||||
.addEventListener('focus', UI.onfocusVirtualKeyboard);
|
||||
document.getElementById("noVNC_keyboardinput")
|
||||
.addEventListener('blur', UI.onblurVirtualKeyboard);
|
||||
document.getElementById("noVNC_keyboardinput")
|
||||
.addEventListener('submit', function () { return false; });
|
||||
|
||||
document.documentElement.addEventListener('mousedown', UI.keepVirtualKeyboard, true);
|
||||
document.documentElement
|
||||
.addEventListener('mousedown', UI.keepVirtualKeyboard, true);
|
||||
|
||||
document.getElementById("noVNC_control_bar").addEventListener('touchstart', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('touchmove', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('touchend', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('input', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('touchstart', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('touchmove', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('touchend', UI.activateControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('input', UI.activateControlbar);
|
||||
|
||||
document.getElementById("noVNC_control_bar").addEventListener('touchstart', UI.keepControlbar);
|
||||
document.getElementById("noVNC_control_bar").addEventListener('input', UI.keepControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('touchstart', UI.keepControlbar);
|
||||
document.getElementById("noVNC_control_bar")
|
||||
.addEventListener('input', UI.keepControlbar);
|
||||
|
||||
document.getElementById("noVNC_control_bar_handle").addEventListener('touchstart', UI.controlbarHandleMouseDown);
|
||||
document.getElementById("noVNC_control_bar_handle").addEventListener('touchend', UI.controlbarHandleMouseUp);
|
||||
document.getElementById("noVNC_control_bar_handle").addEventListener('touchmove', UI.dragControlbarHandle);
|
||||
document.getElementById("noVNC_control_bar_handle")
|
||||
.addEventListener('touchstart', UI.controlbarHandleMouseDown);
|
||||
document.getElementById("noVNC_control_bar_handle")
|
||||
.addEventListener('touchend', UI.controlbarHandleMouseUp);
|
||||
document.getElementById("noVNC_control_bar_handle")
|
||||
.addEventListener('touchmove', UI.dragControlbarHandle);
|
||||
},
|
||||
|
||||
addExtraKeysHandlers: function() {
|
||||
|
@ -299,33 +288,52 @@ var UI = {
|
|||
document.getElementById("noVNC_send_tab_button").addEventListener('click', UI.sendTab);
|
||||
document.getElementById("noVNC_send_esc_button").addEventListener('click', UI.sendEsc);
|
||||
document.getElementById("noVNC_send_ctrl_alt_del_button").addEventListener('click', UI.sendCtrlAltDel);
|
||||
|
||||
document.getElementById('ctrlaltdel').addEventListener('click', UI.sendCtrlAltDel);
|
||||
document.getElementById('ctrlaltf1').addEventListener('click', function(){UI.sendCtrlAltFN(0);});
|
||||
document.getElementById('ctrlaltf2').addEventListener('click', function(){UI.sendCtrlAltFN(1);});
|
||||
document.getElementById('ctrlaltf3').addEventListener('click', function(){UI.sendCtrlAltFN(2);});
|
||||
document.getElementById('ctrlaltf4').addEventListener('click', function(){UI.sendCtrlAltFN(3);});
|
||||
document.getElementById('ctrlaltf5').addEventListener('click', function(){UI.sendCtrlAltFN(4);});
|
||||
document.getElementById('ctrlaltf6').addEventListener('click', function(){UI.sendCtrlAltFN(5);});
|
||||
document.getElementById('ctrlaltf7').addEventListener('click', function(){UI.sendCtrlAltFN(6);});
|
||||
document.getElementById('ctrlaltf8').addEventListener('click', function(){UI.sendCtrlAltFN(7);});
|
||||
document.getElementById('ctrlaltf9').addEventListener('click', function(){UI.sendCtrlAltFN(8);});
|
||||
document.getElementById('ctrlaltf10').addEventListener('click', function(){UI.sendCtrlAltFN(9);});
|
||||
document.getElementById('ctrlaltf11').addEventListener('click', function(){UI.sendCtrlAltFN(10);});
|
||||
document.getElementById('ctrlaltf12').addEventListener('click', function(){UI.sendCtrlAltFN(11);});
|
||||
},
|
||||
|
||||
addMachineHandlers: function() {
|
||||
document.getElementById("noVNC_shutdown_button").addEventListener('click', function () {
|
||||
UI.rfb.machineShutdown();
|
||||
});
|
||||
document.getElementById("noVNC_reboot_button").addEventListener('click', function () {
|
||||
UI.rfb.machineReboot();
|
||||
});
|
||||
document.getElementById("noVNC_reset_button").addEventListener('click', function () {
|
||||
UI.rfb.machineReset();
|
||||
});
|
||||
document.getElementById("noVNC_power_button").addEventListener('click', UI.togglePowerPanel);
|
||||
document.getElementById("noVNC_shutdown_button")
|
||||
.addEventListener('click', function() { UI.rfb.machineShutdown(); });
|
||||
document.getElementById("noVNC_reboot_button")
|
||||
.addEventListener('click', function() { UI.rfb.machineReboot(); });
|
||||
document.getElementById("noVNC_reset_button")
|
||||
.addEventListener('click', function() { UI.rfb.machineReset(); });
|
||||
document.getElementById("noVNC_power_button")
|
||||
.addEventListener('click', UI.togglePowerPanel);
|
||||
},
|
||||
|
||||
addConnectionControlHandlers: function() {
|
||||
document.getElementById("noVNC_disconnect_button").addEventListener('click', UI.disconnect);
|
||||
document.getElementById("noVNC_connect_button").addEventListener('click', UI.connect);
|
||||
document.getElementById("noVNC_cancel_reconnect_button").addEventListener('click', UI.cancelReconnect);
|
||||
document.getElementById("noVNC_disconnect_button")
|
||||
.addEventListener('click', UI.disconnect);
|
||||
document.getElementById("noVNC_connect_button")
|
||||
.addEventListener('click', UI.connect);
|
||||
document.getElementById("noVNC_cancel_reconnect_button")
|
||||
.addEventListener('click', UI.cancelReconnect);
|
||||
|
||||
document.getElementById("noVNC_password_button").addEventListener('click', UI.setPassword);
|
||||
document.getElementById("noVNC_password_button")
|
||||
.addEventListener('click', UI.setPassword);
|
||||
},
|
||||
|
||||
addClipboardHandlers: function() {
|
||||
document.getElementById("noVNC_clipboard_button").addEventListener('click', UI.toggleClipboardPanel);
|
||||
document.getElementById("noVNC_clipboard_text").addEventListener('change', UI.clipboardSend);
|
||||
document.getElementById("noVNC_clipboard_clear_button").addEventListener('click', UI.clipboardClear);
|
||||
document.getElementById("noVNC_clipboard_button")
|
||||
.addEventListener('click', UI.toggleClipboardPanel);
|
||||
document.getElementById("noVNC_clipboard_text")
|
||||
.addEventListener('change', UI.clipboardSend);
|
||||
document.getElementById("noVNC_clipboard_clear_button")
|
||||
.addEventListener('click', UI.clipboardClear);
|
||||
},
|
||||
|
||||
// Add a call to save settings when the element changes,
|
||||
|
@ -333,15 +341,14 @@ var UI = {
|
|||
addSettingChangeHandler: function(name, changeFunc) {
|
||||
var settingElem = document.getElementById("noVNC_setting_" + name);
|
||||
if (changeFunc === undefined) {
|
||||
changeFunc = function () {
|
||||
UI.saveSetting(name);
|
||||
};
|
||||
changeFunc = function () { UI.saveSetting(name); };
|
||||
}
|
||||
settingElem.addEventListener('change', changeFunc);
|
||||
},
|
||||
|
||||
addSettingsHandlers: function() {
|
||||
document.getElementById("noVNC_settings_button").addEventListener('click', UI.toggleSettingsPanel);
|
||||
document.getElementById("noVNC_settings_button")
|
||||
.addEventListener('click', UI.toggleSettingsPanel);
|
||||
|
||||
UI.addSettingChangeHandler('encrypt');
|
||||
UI.addSettingChangeHandler('resize');
|
||||
|
@ -364,6 +371,7 @@ var UI = {
|
|||
|
||||
addFullscreenHandlers: function() {
|
||||
document.getElementById("noVNC_fullscreen_button").addEventListener('click', UI.toggleFullscreen);
|
||||
document.getElementById("fullscreen_button").addEventListener('click', UI.toggleFullscreen);
|
||||
|
||||
window.addEventListener('fullscreenchange', UI.updateFullscreenButton);
|
||||
window.addEventListener('mozfullscreenchange', UI.updateFullscreenButton);
|
||||
|
@ -390,25 +398,25 @@ var UI = {
|
|||
case 'init':
|
||||
break;
|
||||
case 'connecting':
|
||||
transition_elem.textContent = (0, _localization2.default)("Connecting...");
|
||||
transition_elem.textContent = _("Connecting...");
|
||||
document.documentElement.classList.add("noVNC_connecting");
|
||||
break;
|
||||
case 'connected':
|
||||
document.documentElement.classList.add("noVNC_connected");
|
||||
break;
|
||||
case 'disconnecting':
|
||||
transition_elem.textContent = (0, _localization2.default)("Disconnecting...");
|
||||
transition_elem.textContent = _("Disconnecting...");
|
||||
document.documentElement.classList.add("noVNC_disconnecting");
|
||||
break;
|
||||
case 'disconnected':
|
||||
break;
|
||||
case 'reconnecting':
|
||||
transition_elem.textContent = (0, _localization2.default)("Reconnecting...");
|
||||
transition_elem.textContent = _("Reconnecting...");
|
||||
document.documentElement.classList.add("noVNC_reconnecting");
|
||||
break;
|
||||
default:
|
||||
Log.Error("Invalid visual state: " + state);
|
||||
UI.showStatus((0, _localization2.default)("Internal error"), 'error');
|
||||
UI.showStatus(_("Internal error"), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -441,7 +449,8 @@ var UI = {
|
|||
UI.setViewDrag(false);
|
||||
|
||||
// State change also closes the password dialog
|
||||
document.getElementById('noVNC_password_dlg').classList.remove('noVNC_open');
|
||||
document.getElementById('noVNC_password_dlg')
|
||||
.classList.remove('noVNC_open');
|
||||
},
|
||||
|
||||
showStatus: function(text, status_type, time) {
|
||||
|
@ -465,7 +474,8 @@ var UI = {
|
|||
visible_status_type = 'normal';
|
||||
}
|
||||
}
|
||||
if (visible_status_type === 'error' || visible_status_type === 'warn' && status_type === 'normal') {
|
||||
if (visible_status_type === 'error' ||
|
||||
(visible_status_type === 'warn' && status_type === 'normal')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -513,12 +523,14 @@ var UI = {
|
|||
clearTimeout(UI.idleControlbarTimeout);
|
||||
// We manipulate the anchor instead of the actual control
|
||||
// bar in order to avoid creating new a stacking group
|
||||
document.getElementById('noVNC_control_bar_anchor').classList.remove("noVNC_idle");
|
||||
document.getElementById('noVNC_control_bar_anchor')
|
||||
.classList.remove("noVNC_idle");
|
||||
UI.idleControlbarTimeout = window.setTimeout(UI.idleControlbar, 2000);
|
||||
},
|
||||
|
||||
idleControlbar: function() {
|
||||
document.getElementById('noVNC_control_bar_anchor').classList.add("noVNC_idle");
|
||||
document.getElementById('noVNC_control_bar_anchor')
|
||||
.classList.add("noVNC_idle");
|
||||
},
|
||||
|
||||
keepControlbar: function() {
|
||||
|
@ -526,16 +538,19 @@ var UI = {
|
|||
},
|
||||
|
||||
openControlbar: function() {
|
||||
document.getElementById('noVNC_control_bar').classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_control_bar')
|
||||
.classList.add("noVNC_open");
|
||||
},
|
||||
|
||||
closeControlbar: function() {
|
||||
UI.closeAllPanels();
|
||||
document.getElementById('noVNC_control_bar').classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_control_bar')
|
||||
.classList.remove("noVNC_open");
|
||||
},
|
||||
|
||||
toggleControlbar: function() {
|
||||
if (document.getElementById('noVNC_control_bar').classList.contains("noVNC_open")) {
|
||||
if (document.getElementById('noVNC_control_bar')
|
||||
.classList.contains("noVNC_open")) {
|
||||
UI.closeControlbar();
|
||||
} else {
|
||||
UI.openControlbar();
|
||||
|
@ -546,9 +561,7 @@ var UI = {
|
|||
// Temporarily disable animation to avoid weird movement
|
||||
var bar = document.getElementById('noVNC_control_bar');
|
||||
bar.style.transitionDuration = '0s';
|
||||
bar.addEventListener('transitionend', function () {
|
||||
this.style.transitionDuration = "";
|
||||
});
|
||||
bar.addEventListener('transitionend', function () { this.style.transitionDuration = ""; });
|
||||
|
||||
var anchor = document.getElementById('noVNC_control_bar_anchor');
|
||||
if (anchor.classList.contains("noVNC_right")) {
|
||||
|
@ -575,14 +588,14 @@ var UI = {
|
|||
dragControlbarHandle: function (e) {
|
||||
if (!UI.controlbarGrabbed) return;
|
||||
|
||||
var ptr = (0, _events.getPointerEvent)(e);
|
||||
var ptr = getPointerEvent(e);
|
||||
|
||||
var anchor = document.getElementById('noVNC_control_bar_anchor');
|
||||
if (ptr.clientX < window.innerWidth * 0.1) {
|
||||
if (ptr.clientX < (window.innerWidth * 0.1)) {
|
||||
if (anchor.classList.contains("noVNC_right")) {
|
||||
UI.toggleControlbarSide();
|
||||
}
|
||||
} else if (ptr.clientX > window.innerWidth * 0.9) {
|
||||
} else if (ptr.clientX > (window.innerWidth * 0.9)) {
|
||||
if (!anchor.classList.contains("noVNC_right")) {
|
||||
UI.toggleControlbarSide();
|
||||
}
|
||||
|
@ -613,7 +626,8 @@ var UI = {
|
|||
moveControlbarHandle: function (viewportRelativeY) {
|
||||
var handle = document.getElementById("noVNC_control_bar_handle");
|
||||
var handleHeight = handle.getBoundingClientRect().height;
|
||||
var controlbarBounds = document.getElementById("noVNC_control_bar").getBoundingClientRect();
|
||||
var controlbarBounds = document.getElementById("noVNC_control_bar")
|
||||
.getBoundingClientRect();
|
||||
var margin = 10;
|
||||
|
||||
// These heights need to be non-zero for the below logic to work
|
||||
|
@ -627,14 +641,18 @@ var UI = {
|
|||
if (newY < controlbarBounds.top + margin) {
|
||||
// Force coordinates to be below the top of the control bar
|
||||
newY = controlbarBounds.top + margin;
|
||||
} else if (newY > controlbarBounds.top + controlbarBounds.height - handleHeight - margin) {
|
||||
|
||||
} else if (newY > controlbarBounds.top +
|
||||
controlbarBounds.height - handleHeight - margin) {
|
||||
// Force coordinates to be above the bottom of the control bar
|
||||
newY = controlbarBounds.top + controlbarBounds.height - handleHeight - margin;
|
||||
newY = controlbarBounds.top +
|
||||
controlbarBounds.height - handleHeight - margin;
|
||||
}
|
||||
|
||||
// Corner case: control bar too small for stable position
|
||||
if (controlbarBounds.height < handleHeight + margin * 2) {
|
||||
newY = controlbarBounds.top + (controlbarBounds.height - handleHeight) / 2;
|
||||
if (controlbarBounds.height < (handleHeight + margin * 2)) {
|
||||
newY = controlbarBounds.top +
|
||||
(controlbarBounds.height - handleHeight) / 2;
|
||||
}
|
||||
|
||||
// The transform needs coordinates that are relative to the parent
|
||||
|
@ -651,7 +669,7 @@ var UI = {
|
|||
},
|
||||
|
||||
controlbarHandleMouseUp: function(e) {
|
||||
if (e.type == "mouseup" && e.button != 0) return;
|
||||
if ((e.type == "mouseup") && (e.button != 0)) return;
|
||||
|
||||
// mouseup and mousedown on the same place toggles the controlbar
|
||||
if (UI.controlbarGrabbed && !UI.controlbarDrag) {
|
||||
|
@ -666,16 +684,16 @@ var UI = {
|
|||
},
|
||||
|
||||
controlbarHandleMouseDown: function(e) {
|
||||
if (e.type == "mousedown" && e.button != 0) return;
|
||||
if ((e.type == "mousedown") && (e.button != 0)) return;
|
||||
|
||||
var ptr = (0, _events.getPointerEvent)(e);
|
||||
var ptr = getPointerEvent(e);
|
||||
|
||||
var handle = document.getElementById("noVNC_control_bar_handle");
|
||||
var bounds = handle.getBoundingClientRect();
|
||||
|
||||
// Touch events have implicit capture
|
||||
if (e.type === "mousedown") {
|
||||
(0, _events.setCapture)(handle);
|
||||
setCapture(handle);
|
||||
}
|
||||
|
||||
UI.controlbarGrabbed = true;
|
||||
|
@ -731,6 +749,7 @@ var UI = {
|
|||
var ctrl = document.getElementById('noVNC_setting_' + name);
|
||||
if (ctrl.type === 'checkbox') {
|
||||
ctrl.checked = value;
|
||||
|
||||
} else if (typeof ctrl.options !== 'undefined') {
|
||||
for (var i = 0; i < ctrl.options.length; i += 1) {
|
||||
if (ctrl.options[i].value === value) {
|
||||
|
@ -750,8 +769,7 @@ var UI = {
|
|||
|
||||
// Save control setting to cookie
|
||||
saveSetting: function(name) {
|
||||
var val,
|
||||
ctrl = document.getElementById('noVNC_setting_' + name);
|
||||
var val, ctrl = document.getElementById('noVNC_setting_' + name);
|
||||
if (ctrl.type === 'checkbox') {
|
||||
val = ctrl.checked;
|
||||
} else if (typeof ctrl.options !== 'undefined') {
|
||||
|
@ -830,17 +848,22 @@ var UI = {
|
|||
UI.updateSetting('reconnect');
|
||||
UI.updateSetting('reconnect_delay');
|
||||
|
||||
document.getElementById('noVNC_settings').classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_settings_button').classList.add("noVNC_selected");
|
||||
document.getElementById('noVNC_settings')
|
||||
.classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_settings_button')
|
||||
.classList.add("noVNC_selected");
|
||||
},
|
||||
|
||||
closeSettingsPanel: function() {
|
||||
document.getElementById('noVNC_settings').classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_settings_button').classList.remove("noVNC_selected");
|
||||
document.getElementById('noVNC_settings')
|
||||
.classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_settings_button')
|
||||
.classList.remove("noVNC_selected");
|
||||
},
|
||||
|
||||
toggleSettingsPanel: function() {
|
||||
if (document.getElementById('noVNC_settings').classList.contains("noVNC_open")) {
|
||||
if (document.getElementById('noVNC_settings')
|
||||
.classList.contains("noVNC_open")) {
|
||||
UI.closeSettingsPanel();
|
||||
} else {
|
||||
UI.openSettingsPanel();
|
||||
|
@ -857,17 +880,22 @@ var UI = {
|
|||
UI.closeAllPanels();
|
||||
UI.openControlbar();
|
||||
|
||||
document.getElementById('noVNC_power').classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_power_button').classList.add("noVNC_selected");
|
||||
document.getElementById('noVNC_power')
|
||||
.classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_power_button')
|
||||
.classList.add("noVNC_selected");
|
||||
},
|
||||
|
||||
closePowerPanel: function() {
|
||||
document.getElementById('noVNC_power').classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_power_button').classList.remove("noVNC_selected");
|
||||
document.getElementById('noVNC_power')
|
||||
.classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_power_button')
|
||||
.classList.remove("noVNC_selected");
|
||||
},
|
||||
|
||||
togglePowerPanel: function() {
|
||||
if (document.getElementById('noVNC_power').classList.contains("noVNC_open")) {
|
||||
if (document.getElementById('noVNC_power')
|
||||
.classList.contains("noVNC_open")) {
|
||||
UI.closePowerPanel();
|
||||
} else {
|
||||
UI.openPowerPanel();
|
||||
|
@ -876,10 +904,14 @@ var UI = {
|
|||
|
||||
// Disable/enable power button
|
||||
updatePowerButton: function() {
|
||||
if (UI.connected && UI.rfb.capabilities.power && !UI.rfb.viewOnly) {
|
||||
document.getElementById('noVNC_power_button').classList.remove("noVNC_hidden");
|
||||
if (UI.connected &&
|
||||
UI.rfb.capabilities.power &&
|
||||
!UI.rfb.viewOnly) {
|
||||
document.getElementById('noVNC_power_button')
|
||||
.classList.remove("noVNC_hidden");
|
||||
} else {
|
||||
document.getElementById('noVNC_power_button').classList.add("noVNC_hidden");
|
||||
document.getElementById('noVNC_power_button')
|
||||
.classList.add("noVNC_hidden");
|
||||
// Close power panel if open
|
||||
UI.closePowerPanel();
|
||||
}
|
||||
|
@ -895,17 +927,22 @@ var UI = {
|
|||
UI.closeAllPanels();
|
||||
UI.openControlbar();
|
||||
|
||||
document.getElementById('noVNC_clipboard').classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_clipboard_button').classList.add("noVNC_selected");
|
||||
document.getElementById('noVNC_clipboard')
|
||||
.classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_clipboard_button')
|
||||
.classList.add("noVNC_selected");
|
||||
},
|
||||
|
||||
closeClipboardPanel: function() {
|
||||
document.getElementById('noVNC_clipboard').classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_clipboard_button').classList.remove("noVNC_selected");
|
||||
document.getElementById('noVNC_clipboard')
|
||||
.classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_clipboard_button')
|
||||
.classList.remove("noVNC_selected");
|
||||
},
|
||||
|
||||
toggleClipboardPanel: function() {
|
||||
if (document.getElementById('noVNC_clipboard').classList.contains("noVNC_open")) {
|
||||
if (document.getElementById('noVNC_clipboard')
|
||||
.classList.contains("noVNC_open")) {
|
||||
UI.closeClipboardPanel();
|
||||
} else {
|
||||
UI.openClipboardPanel();
|
||||
|
@ -937,11 +974,13 @@ var UI = {
|
|||
* ------v------*/
|
||||
|
||||
openConnectPanel: function() {
|
||||
document.getElementById('noVNC_connect_dlg').classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_connect_dlg')
|
||||
.classList.add("noVNC_open");
|
||||
},
|
||||
|
||||
closeConnectPanel: function() {
|
||||
document.getElementById('noVNC_connect_dlg').classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_connect_dlg')
|
||||
.classList.remove("noVNC_open");
|
||||
},
|
||||
|
||||
connect: function(event, password) {
|
||||
|
@ -968,7 +1007,7 @@ var UI = {
|
|||
|
||||
if (!host) {
|
||||
Log.Error("Can't connect when host is: " + host);
|
||||
UI.showStatus((0, _localization2.default)("Must set host"), 'error');
|
||||
UI.showStatus(_("Must set host"), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -987,16 +1026,15 @@ var UI = {
|
|||
}
|
||||
url += '/' + path;
|
||||
|
||||
UI.rfb = new _rfb2.default(document.getElementById('noVNC_container'), url, { shared: UI.getSetting('shared'),
|
||||
UI.rfb = new RFB(document.getElementById('noVNC_container'), url,
|
||||
{ shared: UI.getSetting('shared'),
|
||||
repeaterID: UI.getSetting('repeaterID'),
|
||||
credentials: { password: password } });
|
||||
UI.rfb.addEventListener("connect", UI.connectFinished);
|
||||
UI.rfb.addEventListener("disconnect", UI.disconnectFinished);
|
||||
UI.rfb.addEventListener("credentialsrequired", UI.credentials);
|
||||
UI.rfb.addEventListener("securityfailure", UI.securityFailed);
|
||||
UI.rfb.addEventListener("capabilities", function () {
|
||||
UI.updatePowerButton();
|
||||
});
|
||||
UI.rfb.addEventListener("capabilities", function () { UI.updatePowerButton(); });
|
||||
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
|
||||
UI.rfb.addEventListener("bell", UI.bell);
|
||||
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
|
||||
|
@ -1050,9 +1088,9 @@ var UI = {
|
|||
|
||||
let msg;
|
||||
if (UI.getSetting('encrypt')) {
|
||||
msg = (0, _localization2.default)("Connected (encrypted) to ") + UI.desktopName;
|
||||
msg = _("Connected (encrypted) to ") + UI.desktopName;
|
||||
} else {
|
||||
msg = (0, _localization2.default)("Connected (unencrypted) to ") + UI.desktopName;
|
||||
msg = _("Connected (unencrypted) to ") + UI.desktopName;
|
||||
}
|
||||
UI.showStatus(msg);
|
||||
UI.updateVisualState('connected');
|
||||
|
@ -1075,9 +1113,10 @@ var UI = {
|
|||
if (!e.detail.clean) {
|
||||
UI.updateVisualState('disconnected');
|
||||
if (wasConnected) {
|
||||
UI.showStatus((0, _localization2.default)("Something went wrong, connection is closed"), 'error');
|
||||
UI.showStatus(_("Something went wrong, connection is closed"),
|
||||
'error');
|
||||
} else {
|
||||
UI.showStatus((0, _localization2.default)("Failed to connect to server"), 'error');
|
||||
UI.showStatus(_("Failed to connect to server"), 'error');
|
||||
}
|
||||
} else if (UI.getSetting('reconnect', false) === true && !UI.inhibit_reconnect) {
|
||||
UI.updateVisualState('reconnecting');
|
||||
|
@ -1087,7 +1126,7 @@ var UI = {
|
|||
return;
|
||||
} else {
|
||||
UI.updateVisualState('disconnected');
|
||||
UI.showStatus((0, _localization2.default)("Disconnected"), 'normal');
|
||||
UI.showStatus(_("Disconnected"), 'normal');
|
||||
}
|
||||
|
||||
UI.openControlbar();
|
||||
|
@ -1100,9 +1139,10 @@ var UI = {
|
|||
// directly from the server. Note that we can't control if
|
||||
// this string is translated or not.
|
||||
if ('reason' in e.detail) {
|
||||
msg = (0, _localization2.default)("New connection has been rejected with reason: ") + e.detail.reason;
|
||||
msg = _("New connection has been rejected with reason: ") +
|
||||
e.detail.reason;
|
||||
} else {
|
||||
msg = (0, _localization2.default)("New connection has been rejected");
|
||||
msg = _("New connection has been rejected");
|
||||
}
|
||||
UI.showStatus(msg, 'error');
|
||||
},
|
||||
|
@ -1115,14 +1155,15 @@ var UI = {
|
|||
|
||||
credentials: function(e) {
|
||||
// FIXME: handle more types
|
||||
document.getElementById('noVNC_password_dlg').classList.add('noVNC_open');
|
||||
document.getElementById('noVNC_password_dlg')
|
||||
.classList.add('noVNC_open');
|
||||
|
||||
setTimeout(function () {
|
||||
document.getElementById('noVNC_password_input').focus();
|
||||
}, 100);
|
||||
|
||||
Log.Warn("Server asked for a password");
|
||||
UI.showStatus((0, _localization2.default)("Password is required"), "warning");
|
||||
UI.showStatus(_("Password is required"), "warning");
|
||||
},
|
||||
|
||||
setPassword: function(e) {
|
||||
|
@ -1135,7 +1176,8 @@ var UI = {
|
|||
inputElem.value = "";
|
||||
UI.rfb.sendCredentials({ password: password });
|
||||
UI.reconnect_password = password;
|
||||
document.getElementById('noVNC_password_dlg').classList.remove('noVNC_open');
|
||||
document.getElementById('noVNC_password_dlg')
|
||||
.classList.remove('noVNC_open');
|
||||
},
|
||||
|
||||
/* ------^-------
|
||||
|
@ -1147,7 +1189,8 @@ var UI = {
|
|||
toggleFullscreen: function() {
|
||||
if (document.fullscreenElement || // alternative standard method
|
||||
document.mozFullScreenElement || // currently working methods
|
||||
document.webkitFullscreenElement || document.msFullscreenElement) {
|
||||
document.webkitFullscreenElement ||
|
||||
document.msFullscreenElement) {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
|
@ -1175,10 +1218,13 @@ var UI = {
|
|||
updateFullscreenButton: function() {
|
||||
if (document.fullscreenElement || // alternative standard method
|
||||
document.mozFullScreenElement || // currently working methods
|
||||
document.webkitFullscreenElement || document.msFullscreenElement) {
|
||||
document.getElementById('noVNC_fullscreen_button').classList.add("noVNC_selected");
|
||||
document.webkitFullscreenElement ||
|
||||
document.msFullscreenElement ) {
|
||||
document.getElementById('noVNC_fullscreen_button')
|
||||
.classList.add("noVNC_selected");
|
||||
} else {
|
||||
document.getElementById('noVNC_fullscreen_button').classList.remove("noVNC_selected");
|
||||
document.getElementById('noVNC_fullscreen_button')
|
||||
.classList.remove("noVNC_selected");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1209,7 +1255,7 @@ var UI = {
|
|||
var cur_clip = UI.rfb.clipViewport;
|
||||
var new_clip = UI.getSetting('view_clip');
|
||||
|
||||
if (_browser.isTouchDevice) {
|
||||
if (isTouchDevice) {
|
||||
// Touch devices usually have shit scrollbars
|
||||
new_clip = true;
|
||||
}
|
||||
|
@ -1227,7 +1273,8 @@ var UI = {
|
|||
enableDisableViewClip: function() {
|
||||
var resizeSetting = UI.getSetting('resize');
|
||||
// Disable clipping if we are scaling, connected or on touch
|
||||
if (resizeSetting === 'scale' || _browser.isTouchDevice) {
|
||||
if (resizeSetting === 'scale' ||
|
||||
isTouchDevice) {
|
||||
UI.disableSetting('view_clip');
|
||||
} else {
|
||||
UI.enableSetting('view_clip');
|
||||
|
@ -1275,7 +1322,7 @@ var UI = {
|
|||
|
||||
// Different behaviour for touch vs non-touch
|
||||
// The button is disabled instead of hidden on touch devices
|
||||
if (_browser.isTouchDevice) {
|
||||
if (isTouchDevice) {
|
||||
viewDragButton.classList.remove("noVNC_hidden");
|
||||
|
||||
if (UI.rfb.clipViewport) {
|
||||
|
@ -1301,7 +1348,7 @@ var UI = {
|
|||
* ------v------*/
|
||||
|
||||
showVirtualKeyboard: function() {
|
||||
if (!_browser.isTouchDevice) return;
|
||||
if (!isTouchDevice) return;
|
||||
|
||||
var input = document.getElementById('noVNC_keyboardinput');
|
||||
|
||||
|
@ -1317,7 +1364,7 @@ var UI = {
|
|||
},
|
||||
|
||||
hideVirtualKeyboard: function() {
|
||||
if (!_browser.isTouchDevice) return;
|
||||
if (!isTouchDevice) return;
|
||||
|
||||
var input = document.getElementById('noVNC_keyboardinput');
|
||||
|
||||
|
@ -1327,7 +1374,8 @@ var UI = {
|
|||
},
|
||||
|
||||
toggleVirtualKeyboard: function () {
|
||||
if (document.getElementById('noVNC_keyboard_button').classList.contains("noVNC_selected")) {
|
||||
if (document.getElementById('noVNC_keyboard_button')
|
||||
.classList.contains("noVNC_selected")) {
|
||||
UI.hideVirtualKeyboard();
|
||||
} else {
|
||||
UI.showVirtualKeyboard();
|
||||
|
@ -1335,14 +1383,16 @@ var UI = {
|
|||
},
|
||||
|
||||
onfocusVirtualKeyboard: function(event) {
|
||||
document.getElementById('noVNC_keyboard_button').classList.add("noVNC_selected");
|
||||
document.getElementById('noVNC_keyboard_button')
|
||||
.classList.add("noVNC_selected");
|
||||
if (UI.rfb) {
|
||||
UI.rfb.focusOnClick = false;
|
||||
}
|
||||
},
|
||||
|
||||
onblurVirtualKeyboard: function(event) {
|
||||
document.getElementById('noVNC_keyboard_button').classList.remove("noVNC_selected");
|
||||
document.getElementById('noVNC_keyboard_button')
|
||||
.classList.remove("noVNC_selected");
|
||||
if (UI.rfb) {
|
||||
UI.rfb.focusOnClick = true;
|
||||
}
|
||||
|
@ -1435,10 +1485,10 @@ var UI = {
|
|||
|
||||
// Send the key events
|
||||
for (i = 0; i < backspaces; i++) {
|
||||
UI.rfb.sendKey(_keysym2.default.XK_BackSpace, "Backspace");
|
||||
UI.rfb.sendKey(KeyTable.XK_BackSpace, "Backspace");
|
||||
}
|
||||
for (i = newLen - inputs; i < newLen; i++) {
|
||||
UI.rfb.sendKey(_keysymdef2.default.lookup(newValue.charCodeAt(i)));
|
||||
UI.rfb.sendKey(keysyms.lookup(newValue.charCodeAt(i)));
|
||||
}
|
||||
|
||||
// Control the text content length in the keyboardinput element
|
||||
|
@ -1469,17 +1519,22 @@ var UI = {
|
|||
UI.closeAllPanels();
|
||||
UI.openControlbar();
|
||||
|
||||
document.getElementById('noVNC_modifiers').classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.add("noVNC_selected");
|
||||
document.getElementById('noVNC_modifiers')
|
||||
.classList.add("noVNC_open");
|
||||
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||
.classList.add("noVNC_selected");
|
||||
},
|
||||
|
||||
closeExtraKeys: function() {
|
||||
document.getElementById('noVNC_modifiers').classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.remove("noVNC_selected");
|
||||
document.getElementById('noVNC_modifiers')
|
||||
.classList.remove("noVNC_open");
|
||||
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||
.classList.remove("noVNC_selected");
|
||||
},
|
||||
|
||||
toggleExtraKeys: function() {
|
||||
if (document.getElementById('noVNC_modifiers').classList.contains("noVNC_open")) {
|
||||
if(document.getElementById('noVNC_modifiers')
|
||||
.classList.contains("noVNC_open")) {
|
||||
UI.closeExtraKeys();
|
||||
} else {
|
||||
UI.openExtraKeys();
|
||||
|
@ -1487,20 +1542,20 @@ var UI = {
|
|||
},
|
||||
|
||||
sendEsc: function() {
|
||||
UI.rfb.sendKey(_keysym2.default.XK_Escape, "Escape");
|
||||
UI.rfb.sendKey(KeyTable.XK_Escape, "Escape");
|
||||
},
|
||||
|
||||
sendTab: function() {
|
||||
UI.rfb.sendKey(_keysym2.default.XK_Tab);
|
||||
UI.rfb.sendKey(KeyTable.XK_Tab);
|
||||
},
|
||||
|
||||
toggleCtrl: function() {
|
||||
var btn = document.getElementById('noVNC_toggle_ctrl_button');
|
||||
if (btn.classList.contains("noVNC_selected")) {
|
||||
UI.rfb.sendKey(_keysym2.default.XK_Control_L, "ControlLeft", false);
|
||||
UI.rfb.sendKey(KeyTable.XK_Control_L, "ControlLeft", false);
|
||||
btn.classList.remove("noVNC_selected");
|
||||
} else {
|
||||
UI.rfb.sendKey(_keysym2.default.XK_Control_L, "ControlLeft", true);
|
||||
UI.rfb.sendKey(KeyTable.XK_Control_L, "ControlLeft", true);
|
||||
btn.classList.add("noVNC_selected");
|
||||
}
|
||||
},
|
||||
|
@ -1508,10 +1563,10 @@ var UI = {
|
|||
toggleAlt: function() {
|
||||
var btn = document.getElementById('noVNC_toggle_alt_button');
|
||||
if (btn.classList.contains("noVNC_selected")) {
|
||||
UI.rfb.sendKey(_keysym2.default.XK_Alt_L, "AltLeft", false);
|
||||
UI.rfb.sendKey(KeyTable.XK_Alt_L, "AltLeft", false);
|
||||
btn.classList.remove("noVNC_selected");
|
||||
} else {
|
||||
UI.rfb.sendKey(_keysym2.default.XK_Alt_L, "AltLeft", true);
|
||||
UI.rfb.sendKey(KeyTable.XK_Alt_L, "AltLeft", true);
|
||||
btn.classList.add("noVNC_selected");
|
||||
}
|
||||
},
|
||||
|
@ -1520,6 +1575,10 @@ var UI = {
|
|||
UI.rfb.sendCtrlAltDel();
|
||||
},
|
||||
|
||||
sendCtrlAltFN: function(f) {
|
||||
UI.rfb.sendCtrlAltFN(f);
|
||||
},
|
||||
|
||||
/* ------^-------
|
||||
* /EXTRA KEYS
|
||||
* ==============
|
||||
|
@ -1534,7 +1593,8 @@ var UI = {
|
|||
|
||||
var blist = [0, 1,2,4];
|
||||
for (var b = 0; b < blist.length; b++) {
|
||||
var button = document.getElementById('noVNC_mouse_button' + blist[b]);
|
||||
var button = document.getElementById('noVNC_mouse_button' +
|
||||
blist[b]);
|
||||
if (blist[b] === num && !view_only) {
|
||||
button.classList.remove("noVNC_hidden");
|
||||
} else {
|
||||
|
@ -1549,11 +1609,15 @@ var UI = {
|
|||
|
||||
// Hide input related buttons in view only mode
|
||||
if (UI.rfb.viewOnly) {
|
||||
document.getElementById('noVNC_keyboard_button').classList.add('noVNC_hidden');
|
||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.add('noVNC_hidden');
|
||||
document.getElementById('noVNC_keyboard_button')
|
||||
.classList.add('noVNC_hidden');
|
||||
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||
.classList.add('noVNC_hidden');
|
||||
} else {
|
||||
document.getElementById('noVNC_keyboard_button').classList.remove('noVNC_hidden');
|
||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.remove('noVNC_hidden');
|
||||
document.getElementById('noVNC_keyboard_button')
|
||||
.classList.remove('noVNC_hidden');
|
||||
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||
.classList.remove('noVNC_hidden');
|
||||
}
|
||||
UI.setMouseButton(1); //has it's own logic for hiding/showing
|
||||
},
|
||||
|
@ -1592,7 +1656,7 @@ var UI = {
|
|||
optn.text = text;
|
||||
optn.value = value;
|
||||
selectbox.options.add(optn);
|
||||
}
|
||||
},
|
||||
|
||||
/* ------^-------
|
||||
* /MISC
|
||||
|
@ -1602,10 +1666,10 @@ var UI = {
|
|||
|
||||
// Set up translations
|
||||
var LINGUAS = ["de", "el", "es", "nl", "pl", "sv", "tr", "zh"];
|
||||
_localization.l10n.setup(LINGUAS);
|
||||
if (_localization.l10n.language !== "en" && _localization.l10n.dictionary === undefined) {
|
||||
WebUtil.fetchJSON('../static/js/novnc/app/locale/' + _localization.l10n.language + '.json', function (translations) {
|
||||
_localization.l10n.dictionary = translations;
|
||||
l10n.setup(LINGUAS);
|
||||
if (l10n.language !== "en" && l10n.dictionary === undefined) {
|
||||
WebUtil.fetchJSON('/static/js/novnc/app/locale/' + l10n.language + '.json', function (translations) {
|
||||
l10n.dictionary = translations;
|
||||
|
||||
// wait for translations to load before loading the UI
|
||||
UI.prime();
|
||||
|
@ -1617,4 +1681,4 @@ if (_localization.l10n.language !== "en" && _localization.l10n.dictionary === un
|
|||
UI.prime();
|
||||
}
|
||||
|
||||
exports.default = UI;
|
||||
export default UI;
|
||||
|
|
|
@ -1,35 +1,4 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.init_logging = init_logging;
|
||||
exports.getQueryVar = getQueryVar;
|
||||
exports.getHashVar = getHashVar;
|
||||
exports.getConfigVar = getConfigVar;
|
||||
exports.createCookie = createCookie;
|
||||
exports.readCookie = readCookie;
|
||||
exports.eraseCookie = eraseCookie;
|
||||
exports.initSettings = initSettings;
|
||||
exports.writeSetting = writeSetting;
|
||||
exports.readSetting = readSetting;
|
||||
exports.eraseSetting = eraseSetting;
|
||||
exports.injectParamIfMissing = injectParamIfMissing;
|
||||
exports.fetchJSON = fetchJSON;
|
||||
|
||||
var _logging = require("../core/util/logging.js");
|
||||
|
||||
// init log level reading the logging HTTP param
|
||||
function init_logging(level) {
|
||||
"use strict";
|
||||
|
||||
if (typeof level !== "undefined") {
|
||||
(0, _logging.init_logging)(level);
|
||||
} else {
|
||||
var param = document.location.href.match(/logging=([A-Za-z0-9\._\-]*)/);
|
||||
(0, _logging.init_logging)(param || undefined);
|
||||
}
|
||||
} /*
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
* Copyright (C) 2013 NTT corp.
|
||||
|
@ -38,17 +7,25 @@ function init_logging(level) {
|
|||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
;
|
||||
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) {
|
||||
"use strict";
|
||||
if (typeof level !== "undefined") {
|
||||
main_init_logging(level);
|
||||
} else {
|
||||
var param = document.location.href.match(/logging=([A-Za-z0-9\._\-]*)/);
|
||||
main_init_logging(param || undefined);
|
||||
}
|
||||
};
|
||||
|
||||
// Read a query string variable
|
||||
function getQueryVar(name, defVal) {
|
||||
export function getQueryVar (name, defVal) {
|
||||
"use strict";
|
||||
|
||||
var re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
|
||||
match = document.location.href.match(re);
|
||||
if (typeof defVal === 'undefined') {
|
||||
defVal = null;
|
||||
}
|
||||
if (typeof defVal === 'undefined') { defVal = null; }
|
||||
if (match) {
|
||||
return decodeURIComponent(match[1]);
|
||||
} else {
|
||||
|
@ -57,14 +34,11 @@ function getQueryVar(name, defVal) {
|
|||
};
|
||||
|
||||
// Read a hash fragment variable
|
||||
function getHashVar(name, defVal) {
|
||||
export function getHashVar (name, defVal) {
|
||||
"use strict";
|
||||
|
||||
var re = new RegExp('.*[&#]' + name + '=([^&]*)'),
|
||||
match = document.location.hash.match(re);
|
||||
if (typeof defVal === 'undefined') {
|
||||
defVal = null;
|
||||
}
|
||||
if (typeof defVal === 'undefined') { defVal = null; }
|
||||
if (match) {
|
||||
return decodeURIComponent(match[1]);
|
||||
} else {
|
||||
|
@ -74,9 +48,8 @@ function getHashVar(name, defVal) {
|
|||
|
||||
// Read a variable from the fragment or the query string
|
||||
// Fragment takes precedence
|
||||
function getConfigVar(name, defVal) {
|
||||
export function getConfigVar (name, defVal) {
|
||||
"use strict";
|
||||
|
||||
var val = getHashVar(name);
|
||||
if (val === null) {
|
||||
val = getQueryVar(name, defVal);
|
||||
|
@ -89,13 +62,12 @@ function getConfigVar(name, defVal) {
|
|||
*/
|
||||
|
||||
// No days means only for this browser session
|
||||
function createCookie(name, value, days) {
|
||||
export function createCookie (name, value, days) {
|
||||
"use strict";
|
||||
|
||||
var date, expires;
|
||||
if (days) {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toGMTString();
|
||||
} else {
|
||||
expires = "";
|
||||
|
@ -110,27 +82,21 @@ function createCookie(name, value, days) {
|
|||
document.cookie = name + "=" + value + expires + "; path=/" + secure;
|
||||
};
|
||||
|
||||
function readCookie(name, defaultValue) {
|
||||
export function readCookie (name, defaultValue) {
|
||||
"use strict";
|
||||
|
||||
var nameEQ = name + "=",
|
||||
ca = document.cookie.split(';');
|
||||
|
||||
for (var i = 0; i < ca.length; i += 1) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) === ' ') {
|
||||
c = c.substring(1, c.length);
|
||||
while (c.charAt(0) === ' ') { c = c.substring(1, c.length); }
|
||||
if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length, c.length); }
|
||||
}
|
||||
if (c.indexOf(nameEQ) === 0) {
|
||||
return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
}
|
||||
return typeof defaultValue !== 'undefined' ? defaultValue : null;
|
||||
return (typeof defaultValue !== 'undefined') ? defaultValue : null;
|
||||
};
|
||||
|
||||
function eraseCookie(name) {
|
||||
export function eraseCookie (name) {
|
||||
"use strict";
|
||||
|
||||
createCookie(name, "", -1);
|
||||
};
|
||||
|
||||
|
@ -140,9 +106,8 @@ function eraseCookie(name) {
|
|||
|
||||
var settings = {};
|
||||
|
||||
function initSettings(callback /*, ...callbackArgs */) {
|
||||
export function initSettings (callback /*, ...callbackArgs */) {
|
||||
"use strict";
|
||||
|
||||
var callbackArgs = Array.prototype.slice.call(arguments, 1);
|
||||
if (window.chrome && window.chrome.storage) {
|
||||
window.chrome.storage.sync.get(function (cfg) {
|
||||
|
@ -160,9 +125,8 @@ function initSettings(callback /*, ...callbackArgs */) {
|
|||
};
|
||||
|
||||
// No days means only for this browser session
|
||||
function writeSetting(name, value) {
|
||||
export function writeSetting (name, value) {
|
||||
"use strict";
|
||||
|
||||
if (window.chrome && window.chrome.storage) {
|
||||
if (settings[name] !== value) {
|
||||
settings[name] = value;
|
||||
|
@ -173,9 +137,8 @@ function writeSetting(name, value) {
|
|||
}
|
||||
};
|
||||
|
||||
function readSetting(name, defaultValue) {
|
||||
export function readSetting (name, defaultValue) {
|
||||
"use strict";
|
||||
|
||||
var value;
|
||||
if (window.chrome && window.chrome.storage) {
|
||||
value = settings[name];
|
||||
|
@ -192,9 +155,8 @@ function readSetting(name, defaultValue) {
|
|||
}
|
||||
};
|
||||
|
||||
function eraseSetting(name) {
|
||||
export function eraseSetting (name) {
|
||||
"use strict";
|
||||
|
||||
if (window.chrome && window.chrome.storage) {
|
||||
window.chrome.storage.sync.remove(name);
|
||||
delete settings[name];
|
||||
|
@ -203,7 +165,7 @@ function eraseSetting(name) {
|
|||
}
|
||||
};
|
||||
|
||||
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;
|
||||
|
@ -219,9 +181,7 @@ function injectParamIfMissing(path, param, value) {
|
|||
query = [];
|
||||
}
|
||||
|
||||
if (!query.some(function (v) {
|
||||
return v.startsWith(param_eq);
|
||||
})) {
|
||||
if (!query.some(function (v) { return v.startsWith(param_eq); })) {
|
||||
query.push(param_eq + encodeURIComponent(value));
|
||||
elem.search = "?" + query.join("&");
|
||||
}
|
||||
|
@ -239,7 +199,7 @@ function injectParamIfMissing(path, param, value) {
|
|||
// IE11 support or polyfill promises and fetch in IE11.
|
||||
// resolve will receive an object on success, while reject
|
||||
// will receive either an event or an error on failure.
|
||||
function fetchJSON(path, resolve, reject) {
|
||||
export function fetchJSON(path, resolve, reject) {
|
||||
// NB: IE11 doesn't support JSON as a responseType
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('GET', path);
|
||||
|
|
|
@ -1,30 +1,25 @@
|
|||
'use strict';
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
// From: http://hg.mozilla.org/mozilla-central/raw-file/ec10630b1a54/js/src/devtools/jint/sunspider/string-base64.js
|
||||
|
||||
var _logging = require('./util/logging.js');
|
||||
import * as Log from './util/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; } }
|
||||
|
||||
exports.default = {
|
||||
export default {
|
||||
/* Convert data (an array of integers) to a Base64 string. */
|
||||
toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''),
|
||||
base64Pad : '=',
|
||||
|
||||
encode: function (data) {
|
||||
"use strict";
|
||||
|
||||
var result = '';
|
||||
var toBase64Table = this.toBase64Table;
|
||||
var length = data.length;
|
||||
var lengthpad = length % 3;
|
||||
var lengthpad = (length % 3);
|
||||
// Convert every three bytes to 4 ascii characters.
|
||||
|
||||
for (var i = 0; i < length - 2; i += 3) {
|
||||
for (var i = 0; i < (length - 2); i += 3) {
|
||||
result += toBase64Table[data[i] >> 2];
|
||||
result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
|
||||
result += toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)];
|
||||
|
@ -51,12 +46,20 @@ exports.default = {
|
|||
},
|
||||
|
||||
/* Convert Base64 data to a string */
|
||||
toBinaryTable: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1],
|
||||
toBinaryTable : [
|
||||
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
|
||||
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
|
||||
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
|
||||
52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1,
|
||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
|
||||
15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
|
||||
-1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
|
||||
41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
|
||||
],
|
||||
|
||||
decode: function (data, offset) {
|
||||
"use strict";
|
||||
|
||||
offset = typeof offset !== 'undefined' ? offset : 0;
|
||||
offset = typeof(offset) !== 'undefined' ? offset : 0;
|
||||
var toBinaryTable = this.toBinaryTable;
|
||||
var base64Pad = this.base64Pad;
|
||||
var result, result_length;
|
||||
|
@ -64,18 +67,16 @@ exports.default = {
|
|||
var leftdata = 0; // bits decoded, but yet to be appended
|
||||
var data_length = data.indexOf('=') - offset;
|
||||
|
||||
if (data_length < 0) {
|
||||
data_length = data.length - offset;
|
||||
}
|
||||
if (data_length < 0) { data_length = data.length - offset; }
|
||||
|
||||
/* Every four characters is 3 resulting numbers */
|
||||
result_length = (data_length >> 2) * 3 + Math.floor(data_length % 4 / 1.5);
|
||||
result_length = (data_length >> 2) * 3 + Math.floor((data_length % 4) / 1.5);
|
||||
result = new Array(result_length);
|
||||
|
||||
// Convert one by one.
|
||||
for (var idx = 0, i = offset; i < data.length; i++) {
|
||||
var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
var padding = data.charAt(i) === base64Pad;
|
||||
var padding = (data.charAt(i) === base64Pad);
|
||||
// Skip illegal characters and whitespace
|
||||
if (c === -1) {
|
||||
Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
|
||||
|
@ -83,7 +84,7 @@ exports.default = {
|
|||
}
|
||||
|
||||
// Collect data into leftdata, update bitcount
|
||||
leftdata = leftdata << 6 | c;
|
||||
leftdata = (leftdata << 6) | c;
|
||||
leftbits += 6;
|
||||
|
||||
// If we have 8 or more bits, append 8 bits to the result
|
||||
|
@ -91,7 +92,7 @@ exports.default = {
|
|||
leftbits -= 8;
|
||||
// Append if not padding.
|
||||
if (!padding) {
|
||||
result[idx++] = leftdata >> leftbits & 0xff;
|
||||
result[idx++] = (leftdata >> leftbits) & 0xff;
|
||||
}
|
||||
leftdata &= (1 << leftbits) - 1;
|
||||
}
|
||||
|
@ -107,8 +108,3 @@ exports.default = {
|
|||
return result;
|
||||
}
|
||||
}; /* End of Base64 namespace */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// From: http://hg.mozilla.org/mozilla-central/raw-file/ec10630b1a54/js/src/devtools/jint/sunspider/string-base64.js
|
|
@ -1,9 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = DES;
|
||||
/*
|
||||
* Ported from Flashlight VNC ActionScript implementation:
|
||||
* http://www.wizhelp.com/flashlight-vnc/
|
||||
|
@ -81,67 +75,67 @@ exports.default = DES;
|
|||
* fine Java utilities: http://www.acme.com/java/
|
||||
*/
|
||||
|
||||
function DES(passwd) {
|
||||
export default function DES(passwd) {
|
||||
"use strict";
|
||||
|
||||
// Tables, permutations, S-boxes, etc.
|
||||
|
||||
var PC2 = [13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31],
|
||||
var PC2 = [13,16,10,23, 0, 4, 2,27,14, 5,20, 9,22,18,11, 3,
|
||||
25, 7,15, 6,26,19,12, 1,40,51,30,36,46,54,29,39,
|
||||
50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31 ],
|
||||
totrot = [ 1, 2, 4, 6, 8,10,12,14,15,17,19,21,23,25,27,28],
|
||||
z = 0x0,
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
SP1,
|
||||
SP2,
|
||||
SP3,
|
||||
SP4,
|
||||
SP5,
|
||||
SP6,
|
||||
SP7,
|
||||
SP8,
|
||||
z = 0x0, a,b,c,d,e,f, SP1,SP2,SP3,SP4,SP5,SP6,SP7,SP8,
|
||||
keys = [];
|
||||
|
||||
a=1<<16; b=1<<24; c=a|b; d=1<<2; e=1<<10; f=d|e;
|
||||
SP1 = [c | e, z | z, a | z, c | f, c | d, a | f, z | d, a | z, z | e, c | e, c | f, z | e, b | f, c | d, b | z, z | d, z | f, b | e, b | e, a | e, a | e, c | z, c | z, b | f, a | d, b | d, b | d, a | d, z | z, z | f, a | f, b | z, a | z, c | f, z | d, c | z, c | e, b | z, b | z, z | e, c | d, a | z, a | e, b | d, z | e, z | d, b | f, a | f, c | f, a | d, c | z, b | f, b | d, z | f, a | f, c | e, z | f, b | e, b | e, z | z, a | d, a | e, z | z, c | d];
|
||||
SP1 = [c|e,z|z,a|z,c|f,c|d,a|f,z|d,a|z,z|e,c|e,c|f,z|e,b|f,c|d,b|z,z|d,
|
||||
z|f,b|e,b|e,a|e,a|e,c|z,c|z,b|f,a|d,b|d,b|d,a|d,z|z,z|f,a|f,b|z,
|
||||
a|z,c|f,z|d,c|z,c|e,b|z,b|z,z|e,c|d,a|z,a|e,b|d,z|e,z|d,b|f,a|f,
|
||||
c|f,a|d,c|z,b|f,b|d,z|f,a|f,c|e,z|f,b|e,b|e,z|z,a|d,a|e,z|z,c|d];
|
||||
a=1<<20; b=1<<31; c=a|b; d=1<<5; e=1<<15; f=d|e;
|
||||
SP2 = [c | f, b | e, z | e, a | f, a | z, z | d, c | d, b | f, b | d, c | f, c | e, b | z, b | e, a | z, z | d, c | d, a | e, a | d, b | f, z | z, b | z, z | e, a | f, c | z, a | d, b | d, z | z, a | e, z | f, c | e, c | z, z | f, z | z, a | f, c | d, a | z, b | f, c | z, c | e, z | e, c | z, b | e, z | d, c | f, a | f, z | d, z | e, b | z, z | f, c | e, a | z, b | d, a | d, b | f, b | d, a | d, a | e, z | z, b | e, z | f, b | z, c | d, c | f, a | e];
|
||||
SP2 = [c|f,b|e,z|e,a|f,a|z,z|d,c|d,b|f,b|d,c|f,c|e,b|z,b|e,a|z,z|d,c|d,
|
||||
a|e,a|d,b|f,z|z,b|z,z|e,a|f,c|z,a|d,b|d,z|z,a|e,z|f,c|e,c|z,z|f,
|
||||
z|z,a|f,c|d,a|z,b|f,c|z,c|e,z|e,c|z,b|e,z|d,c|f,a|f,z|d,z|e,b|z,
|
||||
z|f,c|e,a|z,b|d,a|d,b|f,b|d,a|d,a|e,z|z,b|e,z|f,b|z,c|d,c|f,a|e];
|
||||
a=1<<17; b=1<<27; c=a|b; d=1<<3; e=1<<9; f=d|e;
|
||||
SP3 = [z | f, c | e, z | z, c | d, b | e, z | z, a | f, b | e, a | d, b | d, b | d, a | z, c | f, a | d, c | z, z | f, b | z, z | d, c | e, z | e, a | e, c | z, c | d, a | f, b | f, a | e, a | z, b | f, z | d, c | f, z | e, b | z, c | e, b | z, a | d, z | f, a | z, c | e, b | e, z | z, z | e, a | d, c | f, b | e, b | d, z | e, z | z, c | d, b | f, a | z, b | z, c | f, z | d, a | f, a | e, b | d, c | z, b | f, z | f, c | z, a | f, z | d, c | d, a | e];
|
||||
SP3 = [z|f,c|e,z|z,c|d,b|e,z|z,a|f,b|e,a|d,b|d,b|d,a|z,c|f,a|d,c|z,z|f,
|
||||
b|z,z|d,c|e,z|e,a|e,c|z,c|d,a|f,b|f,a|e,a|z,b|f,z|d,c|f,z|e,b|z,
|
||||
c|e,b|z,a|d,z|f,a|z,c|e,b|e,z|z,z|e,a|d,c|f,b|e,b|d,z|e,z|z,c|d,
|
||||
b|f,a|z,b|z,c|f,z|d,a|f,a|e,b|d,c|z,b|f,z|f,c|z,a|f,z|d,c|d,a|e];
|
||||
a=1<<13; b=1<<23; c=a|b; d=1<<0; e=1<<7; f=d|e;
|
||||
SP4 = [c | d, a | f, a | f, z | e, c | e, b | f, b | d, a | d, z | z, c | z, c | z, c | f, z | f, z | z, b | e, b | d, z | d, a | z, b | z, c | d, z | e, b | z, a | d, a | e, b | f, z | d, a | e, b | e, a | z, c | e, c | f, z | f, b | e, b | d, c | z, c | f, z | f, z | z, z | z, c | z, a | e, b | e, b | f, z | d, c | d, a | f, a | f, z | e, c | f, z | f, z | d, a | z, b | d, a | d, c | e, b | f, a | d, a | e, b | z, c | d, z | e, b | z, a | z, c | e];
|
||||
SP4 = [c|d,a|f,a|f,z|e,c|e,b|f,b|d,a|d,z|z,c|z,c|z,c|f,z|f,z|z,b|e,b|d,
|
||||
z|d,a|z,b|z,c|d,z|e,b|z,a|d,a|e,b|f,z|d,a|e,b|e,a|z,c|e,c|f,z|f,
|
||||
b|e,b|d,c|z,c|f,z|f,z|z,z|z,c|z,a|e,b|e,b|f,z|d,c|d,a|f,a|f,z|e,
|
||||
c|f,z|f,z|d,a|z,b|d,a|d,c|e,b|f,a|d,a|e,b|z,c|d,z|e,b|z,a|z,c|e];
|
||||
a=1<<25; b=1<<30; c=a|b; d=1<<8; e=1<<19; f=d|e;
|
||||
SP5 = [z | d, a | f, a | e, c | d, z | e, z | d, b | z, a | e, b | f, z | e, a | d, b | f, c | d, c | e, z | f, b | z, a | z, b | e, b | e, z | z, b | d, c | f, c | f, a | d, c | e, b | d, z | z, c | z, a | f, a | z, c | z, z | f, z | e, c | d, z | d, a | z, b | z, a | e, c | d, b | f, a | d, b | z, c | e, a | f, b | f, z | d, a | z, c | e, c | f, z | f, c | z, c | f, a | e, z | z, b | e, c | z, z | f, a | d, b | d, z | e, z | z, b | e, a | f, b | d];
|
||||
SP5 = [z|d,a|f,a|e,c|d,z|e,z|d,b|z,a|e,b|f,z|e,a|d,b|f,c|d,c|e,z|f,b|z,
|
||||
a|z,b|e,b|e,z|z,b|d,c|f,c|f,a|d,c|e,b|d,z|z,c|z,a|f,a|z,c|z,z|f,
|
||||
z|e,c|d,z|d,a|z,b|z,a|e,c|d,b|f,a|d,b|z,c|e,a|f,b|f,z|d,a|z,c|e,
|
||||
c|f,z|f,c|z,c|f,a|e,z|z,b|e,c|z,z|f,a|d,b|d,z|e,z|z,b|e,a|f,b|d];
|
||||
a=1<<22; b=1<<29; c=a|b; d=1<<4; e=1<<14; f=d|e;
|
||||
SP6 = [b | d, c | z, z | e, c | f, c | z, z | d, c | f, a | z, b | e, a | f, a | z, b | d, a | d, b | e, b | z, z | f, z | z, a | d, b | f, z | e, a | e, b | f, z | d, c | d, c | d, z | z, a | f, c | e, z | f, a | e, c | e, b | z, b | e, z | d, c | d, a | e, c | f, a | z, z | f, b | d, a | z, b | e, b | z, z | f, b | d, c | f, a | e, c | z, a | f, c | e, z | z, c | d, z | d, z | e, c | z, a | f, z | e, a | d, b | f, z | z, c | e, b | z, a | d, b | f];
|
||||
SP6 = [b|d,c|z,z|e,c|f,c|z,z|d,c|f,a|z,b|e,a|f,a|z,b|d,a|d,b|e,b|z,z|f,
|
||||
z|z,a|d,b|f,z|e,a|e,b|f,z|d,c|d,c|d,z|z,a|f,c|e,z|f,a|e,c|e,b|z,
|
||||
b|e,z|d,c|d,a|e,c|f,a|z,z|f,b|d,a|z,b|e,b|z,z|f,b|d,c|f,a|e,c|z,
|
||||
a|f,c|e,z|z,c|d,z|d,z|e,c|z,a|f,z|e,a|d,b|f,z|z,c|e,b|z,a|d,b|f];
|
||||
a=1<<21; b=1<<26; c=a|b; d=1<<1; e=1<<11; f=d|e;
|
||||
SP7 = [a | z, c | d, b | f, z | z, z | e, b | f, a | f, c | e, c | f, a | z, z | z, b | d, z | d, b | z, c | d, z | f, b | e, a | f, a | d, b | e, b | d, c | z, c | e, a | d, c | z, z | e, z | f, c | f, a | e, z | d, b | z, a | e, b | z, a | e, a | z, b | f, b | f, c | d, c | d, z | d, a | d, b | z, b | e, a | z, c | e, z | f, a | f, c | e, z | f, b | d, c | f, c | z, a | e, z | z, z | d, c | f, z | z, a | f, c | z, z | e, b | d, b | e, z | e, a | d];
|
||||
SP7 = [a|z,c|d,b|f,z|z,z|e,b|f,a|f,c|e,c|f,a|z,z|z,b|d,z|d,b|z,c|d,z|f,
|
||||
b|e,a|f,a|d,b|e,b|d,c|z,c|e,a|d,c|z,z|e,z|f,c|f,a|e,z|d,b|z,a|e,
|
||||
b|z,a|e,a|z,b|f,b|f,c|d,c|d,z|d,a|d,b|z,b|e,a|z,c|e,z|f,a|f,c|e,
|
||||
z|f,b|d,c|f,c|z,a|e,z|z,z|d,c|f,z|z,a|f,c|z,z|e,b|d,b|e,z|e,a|d];
|
||||
a=1<<18; b=1<<28; c=a|b; d=1<<6; e=1<<12; f=d|e;
|
||||
SP8 = [b | f, z | e, a | z, c | f, b | z, b | f, z | d, b | z, a | d, c | z, c | f, a | e, c | e, a | f, z | e, z | d, c | z, b | d, b | e, z | f, a | e, a | d, c | d, c | e, z | f, z | z, z | z, c | d, b | d, b | e, a | f, a | z, a | f, a | z, c | e, z | e, z | d, c | d, z | e, a | f, b | e, z | d, b | d, c | z, c | d, b | z, a | z, b | f, z | z, c | f, a | d, b | d, c | z, b | e, b | f, z | z, c | f, a | e, a | e, z | f, z | f, a | d, b | z, c | e];
|
||||
SP8 = [b|f,z|e,a|z,c|f,b|z,b|f,z|d,b|z,a|d,c|z,c|f,a|e,c|e,a|f,z|e,z|d,
|
||||
c|z,b|d,b|e,z|f,a|e,a|d,c|d,c|e,z|f,z|z,z|z,c|d,b|d,b|e,a|f,a|z,
|
||||
a|f,a|z,c|e,z|e,z|d,c|d,z|e,a|f,b|e,z|d,b|d,c|z,c|d,b|z,a|z,b|f,
|
||||
z|z,c|f,a|d,b|d,c|z,b|e,b|f,z|z,c|f,a|e,a|e,z|f,z|f,a|d,b|z,c|e];
|
||||
|
||||
// Set the key.
|
||||
function setKeys(keyBlock) {
|
||||
var i,
|
||||
j,
|
||||
l,
|
||||
m,
|
||||
n,
|
||||
o,
|
||||
pc1m = [],
|
||||
pcr = [],
|
||||
kn = [],
|
||||
raw0,
|
||||
raw1,
|
||||
rawi,
|
||||
KnLi;
|
||||
var i, j, l, m, n, o, pc1m = [], pcr = [], kn = [],
|
||||
raw0, raw1, rawi, KnLi;
|
||||
|
||||
for (j = 0, l = 56; j < 56; ++j, l -= 8) {
|
||||
l += l < -5 ? 65 : l < -3 ? 31 : l < -1 ? 63 : l === 27 ? 35 : 0; // PC1
|
||||
m = l & 0x7;
|
||||
pc1m[j] = (keyBlock[l >>> 3] & 1 << m) !== 0 ? 1 : 0;
|
||||
pc1m[j] = ((keyBlock[l >>> 3] & (1<<m)) !== 0) ? 1: 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; ++i) {
|
||||
|
@ -160,10 +154,10 @@ function DES(passwd) {
|
|||
}
|
||||
for (j = 0; j < 24; ++j) {
|
||||
if (pcr[PC2[j]] !== 0) {
|
||||
kn[m] |= 1 << 23 - j;
|
||||
kn[m] |= 1 << (23 - j);
|
||||
}
|
||||
if (pcr[PC2[j + 24]] !== 0) {
|
||||
kn[n] |= 1 << 23 - j;
|
||||
kn[n] |= 1 << (23 - j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,95 +174,88 @@ function DES(passwd) {
|
|||
keys[KnLi] = (raw0 & 0x0003f000) << 12;
|
||||
keys[KnLi] |= (raw0 & 0x0000003f) << 16;
|
||||
keys[KnLi] |= (raw1 & 0x0003f000) >>> 4;
|
||||
keys[KnLi] |= raw1 & 0x0000003f;
|
||||
keys[KnLi] |= (raw1 & 0x0000003f);
|
||||
++KnLi;
|
||||
}
|
||||
}
|
||||
|
||||
// Encrypt 8 bytes of text
|
||||
function enc8(text) {
|
||||
var i = 0,
|
||||
b = text.slice(),
|
||||
fval,
|
||||
keysi = 0,
|
||||
l,
|
||||
r,
|
||||
x; // left, right, accumulator
|
||||
var i = 0, b = text.slice(), fval, keysi = 0,
|
||||
l, r, x; // left, right, accumulator
|
||||
|
||||
// Squash 8 bytes to 2 ints
|
||||
l = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++];
|
||||
r = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++];
|
||||
|
||||
x = (l >>> 4 ^ r) & 0x0f0f0f0f;
|
||||
x = ((l >>> 4) ^ r) & 0x0f0f0f0f;
|
||||
r ^= x;
|
||||
l ^= x << 4;
|
||||
x = (l >>> 16 ^ r) & 0x0000ffff;
|
||||
l ^= (x << 4);
|
||||
x = ((l >>> 16) ^ r) & 0x0000ffff;
|
||||
r ^= x;
|
||||
l ^= x << 16;
|
||||
x = (r >>> 2 ^ l) & 0x33333333;
|
||||
l ^= (x << 16);
|
||||
x = ((r >>> 2) ^ l) & 0x33333333;
|
||||
l ^= x;
|
||||
r ^= x << 2;
|
||||
x = (r >>> 8 ^ l) & 0x00ff00ff;
|
||||
r ^= (x << 2);
|
||||
x = ((r >>> 8) ^ l) & 0x00ff00ff;
|
||||
l ^= x;
|
||||
r ^= x << 8;
|
||||
r = r << 1 | r >>> 31 & 1;
|
||||
r ^= (x << 8);
|
||||
r = (r << 1) | ((r >>> 31) & 1);
|
||||
x = (l ^ r) & 0xaaaaaaaa;
|
||||
l ^= x;
|
||||
r ^= x;
|
||||
l = l << 1 | l >>> 31 & 1;
|
||||
l = (l << 1) | ((l >>> 31) & 1);
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
x = r << 28 | r >>> 4;
|
||||
x = (r << 28) | (r >>> 4);
|
||||
x ^= keys[keysi++];
|
||||
fval = SP7[x & 0x3f];
|
||||
fval |= SP5[x >>> 8 & 0x3f];
|
||||
fval |= SP3[x >>> 16 & 0x3f];
|
||||
fval |= SP1[x >>> 24 & 0x3f];
|
||||
fval |= SP5[(x >>> 8) & 0x3f];
|
||||
fval |= SP3[(x >>> 16) & 0x3f];
|
||||
fval |= SP1[(x >>> 24) & 0x3f];
|
||||
x = r ^ keys[keysi++];
|
||||
fval |= SP8[x & 0x3f];
|
||||
fval |= SP6[x >>> 8 & 0x3f];
|
||||
fval |= SP4[x >>> 16 & 0x3f];
|
||||
fval |= SP2[x >>> 24 & 0x3f];
|
||||
fval |= SP6[(x >>> 8) & 0x3f];
|
||||
fval |= SP4[(x >>> 16) & 0x3f];
|
||||
fval |= SP2[(x >>> 24) & 0x3f];
|
||||
l ^= fval;
|
||||
x = l << 28 | l >>> 4;
|
||||
x = (l << 28) | (l >>> 4);
|
||||
x ^= keys[keysi++];
|
||||
fval = SP7[x & 0x3f];
|
||||
fval |= SP5[x >>> 8 & 0x3f];
|
||||
fval |= SP3[x >>> 16 & 0x3f];
|
||||
fval |= SP1[x >>> 24 & 0x3f];
|
||||
fval |= SP5[(x >>> 8) & 0x3f];
|
||||
fval |= SP3[(x >>> 16) & 0x3f];
|
||||
fval |= SP1[(x >>> 24) & 0x3f];
|
||||
x = l ^ keys[keysi++];
|
||||
fval |= SP8[x & 0x0000003f];
|
||||
fval |= SP6[x >>> 8 & 0x3f];
|
||||
fval |= SP4[x >>> 16 & 0x3f];
|
||||
fval |= SP2[x >>> 24 & 0x3f];
|
||||
fval |= SP6[(x >>> 8) & 0x3f];
|
||||
fval |= SP4[(x >>> 16) & 0x3f];
|
||||
fval |= SP2[(x >>> 24) & 0x3f];
|
||||
r ^= fval;
|
||||
}
|
||||
|
||||
r = r << 31 | r >>> 1;
|
||||
r = (r << 31) | (r >>> 1);
|
||||
x = (l ^ r) & 0xaaaaaaaa;
|
||||
l ^= x;
|
||||
r ^= x;
|
||||
l = l << 31 | l >>> 1;
|
||||
x = (l >>> 8 ^ r) & 0x00ff00ff;
|
||||
l = (l << 31) | (l >>> 1);
|
||||
x = ((l >>> 8) ^ r) & 0x00ff00ff;
|
||||
r ^= x;
|
||||
l ^= x << 8;
|
||||
x = (l >>> 2 ^ r) & 0x33333333;
|
||||
l ^= (x << 8);
|
||||
x = ((l >>> 2) ^ r) & 0x33333333;
|
||||
r ^= x;
|
||||
l ^= x << 2;
|
||||
x = (r >>> 16 ^ l) & 0x0000ffff;
|
||||
l ^= (x << 2);
|
||||
x = ((r >>> 16) ^ l) & 0x0000ffff;
|
||||
l ^= x;
|
||||
r ^= x << 16;
|
||||
x = (r >>> 4 ^ l) & 0x0f0f0f0f;
|
||||
r ^= (x << 16);
|
||||
x = ((r >>> 4) ^ l) & 0x0f0f0f0f;
|
||||
l ^= x;
|
||||
r ^= x << 4;
|
||||
r ^= (x << 4);
|
||||
|
||||
// Spread ints to bytes
|
||||
x = [r, l];
|
||||
for (i = 0; i < 8; i++) {
|
||||
b[i] = (x[i >>> 2] >>> 8 * (3 - i % 4)) % 256;
|
||||
if (b[i] < 0) {
|
||||
b[i] += 256;
|
||||
} // unsigned
|
||||
b[i] = (x[i>>>2] >>> (8 * (3 - (i % 4)))) % 256;
|
||||
if (b[i] < 0) { b[i] += 256; } // unsigned
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
@ -280,4 +267,5 @@ function DES(passwd) {
|
|||
|
||||
setKeys(passwd); // Setup keys
|
||||
return {'encrypt': encrypt}; // Public interface
|
||||
|
||||
}; // function DES
|
|
@ -1,22 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = Display;
|
||||
|
||||
var _logging = require("./util/logging.js");
|
||||
|
||||
var Log = _interopRequireWildcard(_logging);
|
||||
|
||||
var _base = require("./base64.js");
|
||||
|
||||
var _base2 = _interopRequireDefault(_base);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
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; } }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
|
@ -26,7 +7,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
function Display(target) {
|
||||
import * as Log from './util/logging.js';
|
||||
import Base64 from "./base64.js";
|
||||
|
||||
export default function Display(target) {
|
||||
this._drawCtx = null;
|
||||
this._c_forceCanvas = false;
|
||||
|
||||
|
@ -98,17 +82,13 @@ Display.prototype = {
|
|||
// ===== PROPERTIES =====
|
||||
|
||||
_scale: 1.0,
|
||||
get scale() {
|
||||
return this._scale;
|
||||
},
|
||||
get scale() { return this._scale; },
|
||||
set scale(scale) {
|
||||
this._rescale(scale);
|
||||
},
|
||||
|
||||
_clipViewport: false,
|
||||
get clipViewport() {
|
||||
return this._clipViewport;
|
||||
},
|
||||
get clipViewport() { return this._clipViewport; },
|
||||
set clipViewport(viewport) {
|
||||
this._clipViewport = viewport;
|
||||
// May need to readjust the viewport dimensions
|
||||
|
@ -158,7 +138,7 @@ Display.prototype = {
|
|||
deltaY = -vp.y;
|
||||
}
|
||||
if (vy2 + deltaY >= this._fb_height) {
|
||||
deltaY -= vy2 + deltaY - this._fb_height + 1;
|
||||
deltaY -= (vy2 + deltaY - this._fb_height + 1);
|
||||
}
|
||||
|
||||
if (deltaX === 0 && deltaY === 0) {
|
||||
|
@ -176,7 +156,9 @@ Display.prototype = {
|
|||
|
||||
viewportChangeSize: function(width, height) {
|
||||
|
||||
if (!this._clipViewport || typeof width === "undefined" || typeof height === "undefined") {
|
||||
if (!this._clipViewport ||
|
||||
typeof(width) === "undefined" ||
|
||||
typeof(height) === "undefined") {
|
||||
|
||||
Log.Debug("Setting viewport to full display region");
|
||||
width = this._fb_width;
|
||||
|
@ -260,10 +242,10 @@ Display.prototype = {
|
|||
if (y < this._damageBounds.top) {
|
||||
this._damageBounds.top = y;
|
||||
}
|
||||
if (x + w > this._damageBounds.right) {
|
||||
if ((x + w) > this._damageBounds.right) {
|
||||
this._damageBounds.right = x + w;
|
||||
}
|
||||
if (y + h > this._damageBounds.bottom) {
|
||||
if ((y + h) > this._damageBounds.bottom) {
|
||||
this._damageBounds.bottom = y + h;
|
||||
}
|
||||
},
|
||||
|
@ -297,18 +279,20 @@ Display.prototype = {
|
|||
vy = 0;
|
||||
}
|
||||
|
||||
if (vx + w > this._viewportLoc.w) {
|
||||
if ((vx + w) > this._viewportLoc.w) {
|
||||
w = this._viewportLoc.w - vx;
|
||||
}
|
||||
if (vy + h > this._viewportLoc.h) {
|
||||
if ((vy + h) > this._viewportLoc.h) {
|
||||
h = this._viewportLoc.h - vy;
|
||||
}
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
if ((w > 0) && (h > 0)) {
|
||||
// FIXME: We may need to disable image smoothing here
|
||||
// as well (see copyImage()), but we haven't
|
||||
// noticed any problem yet.
|
||||
this._targetCtx.drawImage(this._backbuffer, x, y, w, h, vx, vy, w, h);
|
||||
this._targetCtx.drawImage(this._backbuffer,
|
||||
x, y, w, h,
|
||||
vx, vy, w, h);
|
||||
}
|
||||
|
||||
this._damageBounds.left = this._damageBounds.top = 65535;
|
||||
|
@ -365,7 +349,7 @@ Display.prototype = {
|
|||
'x': new_x,
|
||||
'y': new_y,
|
||||
'width': w,
|
||||
'height': h
|
||||
'height': h,
|
||||
});
|
||||
} else {
|
||||
// Due to this bug among others [1] we need to disable the image-smoothing to
|
||||
|
@ -380,14 +364,16 @@ Display.prototype = {
|
|||
this._drawCtx.msImageSmoothingEnabled = false;
|
||||
this._drawCtx.imageSmoothingEnabled = false;
|
||||
|
||||
this._drawCtx.drawImage(this._backbuffer, old_x, old_y, w, h, new_x, new_y, w, h);
|
||||
this._drawCtx.drawImage(this._backbuffer,
|
||||
old_x, old_y, w, h,
|
||||
new_x, new_y, w, h);
|
||||
this._damage(new_x, new_y, w, h);
|
||||
}
|
||||
},
|
||||
|
||||
imageRect: function(x, y, mime, arr) {
|
||||
var img = new Image();
|
||||
img.src = "data: " + mime + ";base64," + _base2.default.encode(arr);
|
||||
img.src = "data: " + mime + ";base64," + Base64.encode(arr);
|
||||
this._renderQ_push({
|
||||
'type': 'img',
|
||||
'img': img,
|
||||
|
@ -431,7 +417,7 @@ Display.prototype = {
|
|||
var width = this._tile.width;
|
||||
for (var j = y; j < yend; j++) {
|
||||
for (var i = x; i < xend; i++) {
|
||||
var p = (i + j * width) * 4;
|
||||
var p = (i + (j * width)) * 4;
|
||||
data[p] = red;
|
||||
data[p + 1] = green;
|
||||
data[p + 2] = blue;
|
||||
|
@ -443,7 +429,8 @@ Display.prototype = {
|
|||
// draw the current tile to the screen
|
||||
finishTile: function () {
|
||||
this._drawCtx.putImageData(this._tile, this._tile_x, this._tile_y);
|
||||
this._damage(this._tile_x, this._tile_y, this._tile.width, this._tile.height);
|
||||
this._damage(this._tile_x, this._tile_y,
|
||||
this._tile.width, this._tile.height);
|
||||
},
|
||||
|
||||
blitImage: function (x, y, width, height, arr, offset, from_queue) {
|
||||
|
@ -459,7 +446,7 @@ Display.prototype = {
|
|||
'x': x,
|
||||
'y': y,
|
||||
'width': width,
|
||||
'height': height
|
||||
'height': height,
|
||||
});
|
||||
} else {
|
||||
this._bgrxImageData(x, y, width, height, arr, offset);
|
||||
|
@ -479,7 +466,7 @@ Display.prototype = {
|
|||
'x': x,
|
||||
'y': y,
|
||||
'width': width,
|
||||
'height': height
|
||||
'height': height,
|
||||
});
|
||||
} else {
|
||||
this._rgbImageData(x, y, width, height, arr, offset);
|
||||
|
@ -499,7 +486,7 @@ Display.prototype = {
|
|||
'x': x,
|
||||
'y': y,
|
||||
'width': width,
|
||||
'height': height
|
||||
'height': height,
|
||||
});
|
||||
} else {
|
||||
this._rgbxImageData(x, y, width, height, arr, offset);
|
||||
|
@ -551,7 +538,8 @@ Display.prototype = {
|
|||
var width = Math.round(factor * vp.w) + 'px';
|
||||
var height = Math.round(factor * vp.h) + 'px';
|
||||
|
||||
if (this._target.style.width !== width || this._target.style.height !== height) {
|
||||
if ((this._target.style.width !== width) ||
|
||||
(this._target.style.height !== height)) {
|
||||
this._target.style.width = width;
|
||||
this._target.style.height = height;
|
||||
}
|
||||
|
@ -665,23 +653,23 @@ Display.prototype = {
|
|||
this._flushing = false;
|
||||
this.onflush();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// Class Methods
|
||||
Display.changeCursor = function (target, pixels, mask, hotx, hoty, w, h) {
|
||||
if (w === 0 || h === 0) {
|
||||
if ((w === 0) || (h === 0)) {
|
||||
target.style.cursor = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
var cur = [];
|
||||
var cur = []
|
||||
var y, x;
|
||||
for (y = 0; y < h; y++) {
|
||||
for (x = 0; x < w; x++) {
|
||||
var idx = y * Math.ceil(w / 8) + Math.floor(x / 8);
|
||||
var alpha = mask[idx] << x % 8 & 0x80 ? 255 : 0;
|
||||
idx = (w * y + x) * 4;
|
||||
var alpha = (mask[idx] << (x % 8)) & 0x80 ? 255 : 0;
|
||||
idx = ((w * y) + x) * 4;
|
||||
cur.push(pixels[idx + 2]); // red
|
||||
cur.push(pixels[idx + 1]); // green
|
||||
cur.push(pixels[idx]); // blue
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.encodingName = encodingName;
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
||||
|
@ -12,7 +6,7 @@ exports.encodingName = encodingName;
|
|||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
var encodings = exports.encodings = {
|
||||
export var encodings = {
|
||||
encodingRaw: 0,
|
||||
encodingCopyRect: 1,
|
||||
encodingRRE: 2,
|
||||
|
@ -31,22 +25,16 @@ var encodings = exports.encodings = {
|
|||
pseudoEncodingFence: -312,
|
||||
pseudoEncodingContinuousUpdates: -313,
|
||||
pseudoEncodingCompressLevel9: -247,
|
||||
pseudoEncodingCompressLevel0: -256
|
||||
pseudoEncodingCompressLevel0: -256,
|
||||
};
|
||||
|
||||
function encodingName(num) {
|
||||
export function encodingName(num) {
|
||||
switch (num) {
|
||||
case encodings.encodingRaw:
|
||||
return "Raw";
|
||||
case encodings.encodingCopyRect:
|
||||
return "CopyRect";
|
||||
case encodings.encodingRRE:
|
||||
return "RRE";
|
||||
case encodings.encodingHextile:
|
||||
return "Hextile";
|
||||
case encodings.encodingTight:
|
||||
return "Tight";
|
||||
default:
|
||||
return "[unknown encoding " + num + "]";
|
||||
case encodings.encodingRaw: return "Raw";
|
||||
case encodings.encodingCopyRect: return "CopyRect";
|
||||
case encodings.encodingRRE: return "RRE";
|
||||
case encodings.encodingHextile: return "Hextile";
|
||||
case encodings.encodingTight: return "Tight";
|
||||
default: return "[unknown encoding " + num + "]";
|
||||
}
|
||||
}
|
|
@ -1,17 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = Inflate;
|
||||
|
||||
var _inflate = require("../vendor/pako/lib/zlib/inflate.js");
|
||||
|
||||
var _zstream = require("../vendor/pako/lib/zlib/zstream.js");
|
||||
|
||||
var _zstream2 = _interopRequireDefault(_zstream);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
import { inflateInit, inflate, inflateReset } from "../vendor/pako/lib/zlib/inflate.js";
|
||||
import ZStream from "../vendor/pako/lib/zlib/zstream.js";
|
||||
|
||||
Inflate.prototype = {
|
||||
inflate: function (data, flush, expected) {
|
||||
|
@ -30,21 +18,21 @@ Inflate.prototype = {
|
|||
|
||||
this.strm.avail_out = this.chunkSize;
|
||||
|
||||
(0, _inflate.inflate)(this.strm, flush);
|
||||
inflate(this.strm, flush);
|
||||
|
||||
return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
(0, _inflate.inflateReset)(this.strm);
|
||||
inflateReset(this.strm);
|
||||
}
|
||||
};
|
||||
|
||||
function Inflate() {
|
||||
this.strm = new _zstream2.default();
|
||||
export default function Inflate() {
|
||||
this.strm = new ZStream();
|
||||
this.chunkSize = 1024 * 10 * 10;
|
||||
this.strm.output = new Uint8Array(this.chunkSize);
|
||||
this.windowBits = 5;
|
||||
|
||||
(0, _inflate.inflateInit)(this.strm, this.windowBits);
|
||||
inflateInit(this.strm, this.windowBits);
|
||||
};
|
|
@ -1,14 +1,10 @@
|
|||
"use strict";
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
||||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _keysym = require("./keysym.js");
|
||||
|
||||
var _keysym2 = _interopRequireDefault(_keysym);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
import KeyTable from "./keysym.js";
|
||||
|
||||
/*
|
||||
* Mapping between HTML key values and VNC/X11 keysyms for "special"
|
||||
|
@ -17,26 +13,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|||
* See https://www.w3.org/TR/uievents-key/ for possible values.
|
||||
*/
|
||||
|
||||
var DOMKeyTable = {}; /*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
||||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
var DOMKeyTable = {};
|
||||
|
||||
function addStandard(key, standard) {
|
||||
function addStandard(key, standard)
|
||||
{
|
||||
if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
|
||||
DOMKeyTable[key] = [standard, standard, standard, standard];
|
||||
}
|
||||
|
||||
function addLeftRight(key, left, right) {
|
||||
function addLeftRight(key, left, right)
|
||||
{
|
||||
if (left === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||
if (right === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
|
||||
DOMKeyTable[key] = [left, left, right, left];
|
||||
}
|
||||
|
||||
function addNumpad(key, standard, numpad) {
|
||||
function addNumpad(key, standard, numpad)
|
||||
{
|
||||
if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||
if (numpad === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
|
||||
|
@ -45,177 +40,177 @@ function addNumpad(key, standard, numpad) {
|
|||
|
||||
// 2.2. Modifier Keys
|
||||
|
||||
addLeftRight("Alt", _keysym2.default.XK_Alt_L, _keysym2.default.XK_Alt_R);
|
||||
addStandard("AltGraph", _keysym2.default.XK_ISO_Level3_Shift);
|
||||
addStandard("CapsLock", _keysym2.default.XK_Caps_Lock);
|
||||
addLeftRight("Control", _keysym2.default.XK_Control_L, _keysym2.default.XK_Control_R);
|
||||
addLeftRight("Alt", KeyTable.XK_Alt_L, KeyTable.XK_Alt_R);
|
||||
addStandard("AltGraph", KeyTable.XK_ISO_Level3_Shift);
|
||||
addStandard("CapsLock", KeyTable.XK_Caps_Lock);
|
||||
addLeftRight("Control", KeyTable.XK_Control_L, KeyTable.XK_Control_R);
|
||||
// - Fn
|
||||
// - FnLock
|
||||
addLeftRight("Hyper", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R);
|
||||
addLeftRight("Meta", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R);
|
||||
addStandard("NumLock", _keysym2.default.XK_Num_Lock);
|
||||
addStandard("ScrollLock", _keysym2.default.XK_Scroll_Lock);
|
||||
addLeftRight("Shift", _keysym2.default.XK_Shift_L, _keysym2.default.XK_Shift_R);
|
||||
addLeftRight("Super", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R);
|
||||
addLeftRight("Hyper", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
|
||||
addLeftRight("Meta", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
|
||||
addStandard("NumLock", KeyTable.XK_Num_Lock);
|
||||
addStandard("ScrollLock", KeyTable.XK_Scroll_Lock);
|
||||
addLeftRight("Shift", KeyTable.XK_Shift_L, KeyTable.XK_Shift_R);
|
||||
addLeftRight("Super", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
|
||||
// - Symbol
|
||||
// - SymbolLock
|
||||
|
||||
// 2.3. Whitespace Keys
|
||||
|
||||
addNumpad("Enter", _keysym2.default.XK_Return, _keysym2.default.XK_KP_Enter);
|
||||
addStandard("Tab", _keysym2.default.XK_Tab);
|
||||
addNumpad(" ", _keysym2.default.XK_space, _keysym2.default.XK_KP_Space);
|
||||
addNumpad("Enter", KeyTable.XK_Return, KeyTable.XK_KP_Enter);
|
||||
addStandard("Tab", KeyTable.XK_Tab);
|
||||
addNumpad(" ", KeyTable.XK_space, KeyTable.XK_KP_Space);
|
||||
|
||||
// 2.4. Navigation Keys
|
||||
|
||||
addNumpad("ArrowDown", _keysym2.default.XK_Down, _keysym2.default.XK_KP_Down);
|
||||
addNumpad("ArrowUp", _keysym2.default.XK_Up, _keysym2.default.XK_KP_Up);
|
||||
addNumpad("ArrowLeft", _keysym2.default.XK_Left, _keysym2.default.XK_KP_Left);
|
||||
addNumpad("ArrowRight", _keysym2.default.XK_Right, _keysym2.default.XK_KP_Right);
|
||||
addNumpad("End", _keysym2.default.XK_End, _keysym2.default.XK_KP_End);
|
||||
addNumpad("Home", _keysym2.default.XK_Home, _keysym2.default.XK_KP_Home);
|
||||
addNumpad("PageDown", _keysym2.default.XK_Next, _keysym2.default.XK_KP_Next);
|
||||
addNumpad("PageUp", _keysym2.default.XK_Prior, _keysym2.default.XK_KP_Prior);
|
||||
addNumpad("ArrowDown", KeyTable.XK_Down, KeyTable.XK_KP_Down);
|
||||
addNumpad("ArrowUp", KeyTable.XK_Up, KeyTable.XK_KP_Up);
|
||||
addNumpad("ArrowLeft", KeyTable.XK_Left, KeyTable.XK_KP_Left);
|
||||
addNumpad("ArrowRight", KeyTable.XK_Right, KeyTable.XK_KP_Right);
|
||||
addNumpad("End", KeyTable.XK_End, KeyTable.XK_KP_End);
|
||||
addNumpad("Home", KeyTable.XK_Home, KeyTable.XK_KP_Home);
|
||||
addNumpad("PageDown", KeyTable.XK_Next, KeyTable.XK_KP_Next);
|
||||
addNumpad("PageUp", KeyTable.XK_Prior, KeyTable.XK_KP_Prior);
|
||||
|
||||
// 2.5. Editing Keys
|
||||
|
||||
addStandard("Backspace", _keysym2.default.XK_BackSpace);
|
||||
addStandard("Clear", _keysym2.default.XK_Clear);
|
||||
addStandard("Copy", _keysym2.default.XF86XK_Copy);
|
||||
addStandard("Backspace", KeyTable.XK_BackSpace);
|
||||
addStandard("Clear", KeyTable.XK_Clear);
|
||||
addStandard("Copy", KeyTable.XF86XK_Copy);
|
||||
// - CrSel
|
||||
addStandard("Cut", _keysym2.default.XF86XK_Cut);
|
||||
addNumpad("Delete", _keysym2.default.XK_Delete, _keysym2.default.XK_KP_Delete);
|
||||
addStandard("Cut", KeyTable.XF86XK_Cut);
|
||||
addNumpad("Delete", KeyTable.XK_Delete, KeyTable.XK_KP_Delete);
|
||||
// - EraseEof
|
||||
// - ExSel
|
||||
addNumpad("Insert", _keysym2.default.XK_Insert, _keysym2.default.XK_KP_Insert);
|
||||
addStandard("Paste", _keysym2.default.XF86XK_Paste);
|
||||
addStandard("Redo", _keysym2.default.XK_Redo);
|
||||
addStandard("Undo", _keysym2.default.XK_Undo);
|
||||
addNumpad("Insert", KeyTable.XK_Insert, KeyTable.XK_KP_Insert);
|
||||
addStandard("Paste", KeyTable.XF86XK_Paste);
|
||||
addStandard("Redo", KeyTable.XK_Redo);
|
||||
addStandard("Undo", KeyTable.XK_Undo);
|
||||
|
||||
// 2.6. UI Keys
|
||||
|
||||
// - Accept
|
||||
// - Again (could just be XK_Redo)
|
||||
// - Attn
|
||||
addStandard("Cancel", _keysym2.default.XK_Cancel);
|
||||
addStandard("ContextMenu", _keysym2.default.XK_Menu);
|
||||
addStandard("Escape", _keysym2.default.XK_Escape);
|
||||
addStandard("Execute", _keysym2.default.XK_Execute);
|
||||
addStandard("Find", _keysym2.default.XK_Find);
|
||||
addStandard("Help", _keysym2.default.XK_Help);
|
||||
addStandard("Pause", _keysym2.default.XK_Pause);
|
||||
addStandard("Cancel", KeyTable.XK_Cancel);
|
||||
addStandard("ContextMenu", KeyTable.XK_Menu);
|
||||
addStandard("Escape", KeyTable.XK_Escape);
|
||||
addStandard("Execute", KeyTable.XK_Execute);
|
||||
addStandard("Find", KeyTable.XK_Find);
|
||||
addStandard("Help", KeyTable.XK_Help);
|
||||
addStandard("Pause", KeyTable.XK_Pause);
|
||||
// - Play
|
||||
// - Props
|
||||
addStandard("Select", _keysym2.default.XK_Select);
|
||||
addStandard("ZoomIn", _keysym2.default.XF86XK_ZoomIn);
|
||||
addStandard("ZoomOut", _keysym2.default.XF86XK_ZoomOut);
|
||||
addStandard("Select", KeyTable.XK_Select);
|
||||
addStandard("ZoomIn", KeyTable.XF86XK_ZoomIn);
|
||||
addStandard("ZoomOut", KeyTable.XF86XK_ZoomOut);
|
||||
|
||||
// 2.7. Device Keys
|
||||
|
||||
addStandard("BrightnessDown", _keysym2.default.XF86XK_MonBrightnessDown);
|
||||
addStandard("BrightnessUp", _keysym2.default.XF86XK_MonBrightnessUp);
|
||||
addStandard("Eject", _keysym2.default.XF86XK_Eject);
|
||||
addStandard("LogOff", _keysym2.default.XF86XK_LogOff);
|
||||
addStandard("Power", _keysym2.default.XF86XK_PowerOff);
|
||||
addStandard("PowerOff", _keysym2.default.XF86XK_PowerDown);
|
||||
addStandard("PrintScreen", _keysym2.default.XK_Print);
|
||||
addStandard("Hibernate", _keysym2.default.XF86XK_Hibernate);
|
||||
addStandard("Standby", _keysym2.default.XF86XK_Standby);
|
||||
addStandard("WakeUp", _keysym2.default.XF86XK_WakeUp);
|
||||
addStandard("BrightnessDown", KeyTable.XF86XK_MonBrightnessDown);
|
||||
addStandard("BrightnessUp", KeyTable.XF86XK_MonBrightnessUp);
|
||||
addStandard("Eject", KeyTable.XF86XK_Eject);
|
||||
addStandard("LogOff", KeyTable.XF86XK_LogOff);
|
||||
addStandard("Power", KeyTable.XF86XK_PowerOff);
|
||||
addStandard("PowerOff", KeyTable.XF86XK_PowerDown);
|
||||
addStandard("PrintScreen", KeyTable.XK_Print);
|
||||
addStandard("Hibernate", KeyTable.XF86XK_Hibernate);
|
||||
addStandard("Standby", KeyTable.XF86XK_Standby);
|
||||
addStandard("WakeUp", KeyTable.XF86XK_WakeUp);
|
||||
|
||||
// 2.8. IME and Composition Keys
|
||||
|
||||
addStandard("AllCandidates", _keysym2.default.XK_MultipleCandidate);
|
||||
addStandard("Alphanumeric", _keysym2.default.XK_Eisu_Shift); // could also be _Eisu_Toggle
|
||||
addStandard("CodeInput", _keysym2.default.XK_Codeinput);
|
||||
addStandard("Compose", _keysym2.default.XK_Multi_key);
|
||||
addStandard("Convert", _keysym2.default.XK_Henkan);
|
||||
addStandard("AllCandidates", KeyTable.XK_MultipleCandidate);
|
||||
addStandard("Alphanumeric", KeyTable.XK_Eisu_Shift); // could also be _Eisu_Toggle
|
||||
addStandard("CodeInput", KeyTable.XK_Codeinput);
|
||||
addStandard("Compose", KeyTable.XK_Multi_key);
|
||||
addStandard("Convert", KeyTable.XK_Henkan);
|
||||
// - Dead
|
||||
// - FinalMode
|
||||
addStandard("GroupFirst", _keysym2.default.XK_ISO_First_Group);
|
||||
addStandard("GroupLast", _keysym2.default.XK_ISO_Last_Group);
|
||||
addStandard("GroupNext", _keysym2.default.XK_ISO_Next_Group);
|
||||
addStandard("GroupPrevious", _keysym2.default.XK_ISO_Prev_Group);
|
||||
addStandard("GroupFirst", KeyTable.XK_ISO_First_Group);
|
||||
addStandard("GroupLast", KeyTable.XK_ISO_Last_Group);
|
||||
addStandard("GroupNext", KeyTable.XK_ISO_Next_Group);
|
||||
addStandard("GroupPrevious", KeyTable.XK_ISO_Prev_Group);
|
||||
// - ModeChange (XK_Mode_switch is often used for AltGr)
|
||||
// - NextCandidate
|
||||
addStandard("NonConvert", _keysym2.default.XK_Muhenkan);
|
||||
addStandard("PreviousCandidate", _keysym2.default.XK_PreviousCandidate);
|
||||
addStandard("NonConvert", KeyTable.XK_Muhenkan);
|
||||
addStandard("PreviousCandidate", KeyTable.XK_PreviousCandidate);
|
||||
// - Process
|
||||
addStandard("SingleCandidate", _keysym2.default.XK_SingleCandidate);
|
||||
addStandard("HangulMode", _keysym2.default.XK_Hangul);
|
||||
addStandard("HanjaMode", _keysym2.default.XK_Hangul_Hanja);
|
||||
addStandard("JunjuaMode", _keysym2.default.XK_Hangul_Jeonja);
|
||||
addStandard("Eisu", _keysym2.default.XK_Eisu_toggle);
|
||||
addStandard("Hankaku", _keysym2.default.XK_Hankaku);
|
||||
addStandard("Hiragana", _keysym2.default.XK_Hiragana);
|
||||
addStandard("HiraganaKatakana", _keysym2.default.XK_Hiragana_Katakana);
|
||||
addStandard("KanaMode", _keysym2.default.XK_Kana_Shift); // could also be _Kana_Lock
|
||||
addStandard("KanjiMode", _keysym2.default.XK_Kanji);
|
||||
addStandard("Katakana", _keysym2.default.XK_Katakana);
|
||||
addStandard("Romaji", _keysym2.default.XK_Romaji);
|
||||
addStandard("Zenkaku", _keysym2.default.XK_Zenkaku);
|
||||
addStandard("ZenkakuHanaku", _keysym2.default.XK_Zenkaku_Hankaku);
|
||||
addStandard("SingleCandidate", KeyTable.XK_SingleCandidate);
|
||||
addStandard("HangulMode", KeyTable.XK_Hangul);
|
||||
addStandard("HanjaMode", KeyTable.XK_Hangul_Hanja);
|
||||
addStandard("JunjuaMode", KeyTable.XK_Hangul_Jeonja);
|
||||
addStandard("Eisu", KeyTable.XK_Eisu_toggle);
|
||||
addStandard("Hankaku", KeyTable.XK_Hankaku);
|
||||
addStandard("Hiragana", KeyTable.XK_Hiragana);
|
||||
addStandard("HiraganaKatakana", KeyTable.XK_Hiragana_Katakana);
|
||||
addStandard("KanaMode", KeyTable.XK_Kana_Shift); // could also be _Kana_Lock
|
||||
addStandard("KanjiMode", KeyTable.XK_Kanji);
|
||||
addStandard("Katakana", KeyTable.XK_Katakana);
|
||||
addStandard("Romaji", KeyTable.XK_Romaji);
|
||||
addStandard("Zenkaku", KeyTable.XK_Zenkaku);
|
||||
addStandard("ZenkakuHanaku", KeyTable.XK_Zenkaku_Hankaku);
|
||||
|
||||
// 2.9. General-Purpose Function Keys
|
||||
|
||||
addStandard("F1", _keysym2.default.XK_F1);
|
||||
addStandard("F2", _keysym2.default.XK_F2);
|
||||
addStandard("F3", _keysym2.default.XK_F3);
|
||||
addStandard("F4", _keysym2.default.XK_F4);
|
||||
addStandard("F5", _keysym2.default.XK_F5);
|
||||
addStandard("F6", _keysym2.default.XK_F6);
|
||||
addStandard("F7", _keysym2.default.XK_F7);
|
||||
addStandard("F8", _keysym2.default.XK_F8);
|
||||
addStandard("F9", _keysym2.default.XK_F9);
|
||||
addStandard("F10", _keysym2.default.XK_F10);
|
||||
addStandard("F11", _keysym2.default.XK_F11);
|
||||
addStandard("F12", _keysym2.default.XK_F12);
|
||||
addStandard("F13", _keysym2.default.XK_F13);
|
||||
addStandard("F14", _keysym2.default.XK_F14);
|
||||
addStandard("F15", _keysym2.default.XK_F15);
|
||||
addStandard("F16", _keysym2.default.XK_F16);
|
||||
addStandard("F17", _keysym2.default.XK_F17);
|
||||
addStandard("F18", _keysym2.default.XK_F18);
|
||||
addStandard("F19", _keysym2.default.XK_F19);
|
||||
addStandard("F20", _keysym2.default.XK_F20);
|
||||
addStandard("F21", _keysym2.default.XK_F21);
|
||||
addStandard("F22", _keysym2.default.XK_F22);
|
||||
addStandard("F23", _keysym2.default.XK_F23);
|
||||
addStandard("F24", _keysym2.default.XK_F24);
|
||||
addStandard("F25", _keysym2.default.XK_F25);
|
||||
addStandard("F26", _keysym2.default.XK_F26);
|
||||
addStandard("F27", _keysym2.default.XK_F27);
|
||||
addStandard("F28", _keysym2.default.XK_F28);
|
||||
addStandard("F29", _keysym2.default.XK_F29);
|
||||
addStandard("F30", _keysym2.default.XK_F30);
|
||||
addStandard("F31", _keysym2.default.XK_F31);
|
||||
addStandard("F32", _keysym2.default.XK_F32);
|
||||
addStandard("F33", _keysym2.default.XK_F33);
|
||||
addStandard("F34", _keysym2.default.XK_F34);
|
||||
addStandard("F35", _keysym2.default.XK_F35);
|
||||
addStandard("F1", KeyTable.XK_F1);
|
||||
addStandard("F2", KeyTable.XK_F2);
|
||||
addStandard("F3", KeyTable.XK_F3);
|
||||
addStandard("F4", KeyTable.XK_F4);
|
||||
addStandard("F5", KeyTable.XK_F5);
|
||||
addStandard("F6", KeyTable.XK_F6);
|
||||
addStandard("F7", KeyTable.XK_F7);
|
||||
addStandard("F8", KeyTable.XK_F8);
|
||||
addStandard("F9", KeyTable.XK_F9);
|
||||
addStandard("F10", KeyTable.XK_F10);
|
||||
addStandard("F11", KeyTable.XK_F11);
|
||||
addStandard("F12", KeyTable.XK_F12);
|
||||
addStandard("F13", KeyTable.XK_F13);
|
||||
addStandard("F14", KeyTable.XK_F14);
|
||||
addStandard("F15", KeyTable.XK_F15);
|
||||
addStandard("F16", KeyTable.XK_F16);
|
||||
addStandard("F17", KeyTable.XK_F17);
|
||||
addStandard("F18", KeyTable.XK_F18);
|
||||
addStandard("F19", KeyTable.XK_F19);
|
||||
addStandard("F20", KeyTable.XK_F20);
|
||||
addStandard("F21", KeyTable.XK_F21);
|
||||
addStandard("F22", KeyTable.XK_F22);
|
||||
addStandard("F23", KeyTable.XK_F23);
|
||||
addStandard("F24", KeyTable.XK_F24);
|
||||
addStandard("F25", KeyTable.XK_F25);
|
||||
addStandard("F26", KeyTable.XK_F26);
|
||||
addStandard("F27", KeyTable.XK_F27);
|
||||
addStandard("F28", KeyTable.XK_F28);
|
||||
addStandard("F29", KeyTable.XK_F29);
|
||||
addStandard("F30", KeyTable.XK_F30);
|
||||
addStandard("F31", KeyTable.XK_F31);
|
||||
addStandard("F32", KeyTable.XK_F32);
|
||||
addStandard("F33", KeyTable.XK_F33);
|
||||
addStandard("F34", KeyTable.XK_F34);
|
||||
addStandard("F35", KeyTable.XK_F35);
|
||||
// - Soft1...
|
||||
|
||||
// 2.10. Multimedia Keys
|
||||
|
||||
// - ChannelDown
|
||||
// - ChannelUp
|
||||
addStandard("Close", _keysym2.default.XF86XK_Close);
|
||||
addStandard("MailForward", _keysym2.default.XF86XK_MailForward);
|
||||
addStandard("MailReply", _keysym2.default.XF86XK_Reply);
|
||||
addStandard("MainSend", _keysym2.default.XF86XK_Send);
|
||||
addStandard("MediaFastForward", _keysym2.default.XF86XK_AudioForward);
|
||||
addStandard("MediaPause", _keysym2.default.XF86XK_AudioPause);
|
||||
addStandard("MediaPlay", _keysym2.default.XF86XK_AudioPlay);
|
||||
addStandard("MediaRecord", _keysym2.default.XF86XK_AudioRecord);
|
||||
addStandard("MediaRewind", _keysym2.default.XF86XK_AudioRewind);
|
||||
addStandard("MediaStop", _keysym2.default.XF86XK_AudioStop);
|
||||
addStandard("MediaTrackNext", _keysym2.default.XF86XK_AudioNext);
|
||||
addStandard("MediaTrackPrevious", _keysym2.default.XF86XK_AudioPrev);
|
||||
addStandard("New", _keysym2.default.XF86XK_New);
|
||||
addStandard("Open", _keysym2.default.XF86XK_Open);
|
||||
addStandard("Print", _keysym2.default.XK_Print);
|
||||
addStandard("Save", _keysym2.default.XF86XK_Save);
|
||||
addStandard("SpellCheck", _keysym2.default.XF86XK_Spell);
|
||||
addStandard("Close", KeyTable.XF86XK_Close);
|
||||
addStandard("MailForward", KeyTable.XF86XK_MailForward);
|
||||
addStandard("MailReply", KeyTable.XF86XK_Reply);
|
||||
addStandard("MainSend", KeyTable.XF86XK_Send);
|
||||
addStandard("MediaFastForward", KeyTable.XF86XK_AudioForward);
|
||||
addStandard("MediaPause", KeyTable.XF86XK_AudioPause);
|
||||
addStandard("MediaPlay", KeyTable.XF86XK_AudioPlay);
|
||||
addStandard("MediaRecord", KeyTable.XF86XK_AudioRecord);
|
||||
addStandard("MediaRewind", KeyTable.XF86XK_AudioRewind);
|
||||
addStandard("MediaStop", KeyTable.XF86XK_AudioStop);
|
||||
addStandard("MediaTrackNext", KeyTable.XF86XK_AudioNext);
|
||||
addStandard("MediaTrackPrevious", KeyTable.XF86XK_AudioPrev);
|
||||
addStandard("New", KeyTable.XF86XK_New);
|
||||
addStandard("Open", KeyTable.XF86XK_Open);
|
||||
addStandard("Print", KeyTable.XK_Print);
|
||||
addStandard("Save", KeyTable.XF86XK_Save);
|
||||
addStandard("SpellCheck", KeyTable.XF86XK_Spell);
|
||||
|
||||
// 2.11. Multimedia Numpad Keys
|
||||
|
||||
|
@ -236,13 +231,13 @@ addStandard("SpellCheck", _keysym2.default.XF86XK_Spell);
|
|||
// - AudioSurroundModeNext
|
||||
// - AudioTrebleDown
|
||||
// - AudioTrebleUp
|
||||
addStandard("AudioVolumeDown", _keysym2.default.XF86XK_AudioLowerVolume);
|
||||
addStandard("AudioVolumeUp", _keysym2.default.XF86XK_AudioRaiseVolume);
|
||||
addStandard("AudioVolumeMute", _keysym2.default.XF86XK_AudioMute);
|
||||
addStandard("AudioVolumeDown", KeyTable.XF86XK_AudioLowerVolume);
|
||||
addStandard("AudioVolumeUp", KeyTable.XF86XK_AudioRaiseVolume);
|
||||
addStandard("AudioVolumeMute", KeyTable.XF86XK_AudioMute);
|
||||
// - MicrophoneToggle
|
||||
// - MicrophoneVolumeDown
|
||||
// - MicrophoneVolumeUp
|
||||
addStandard("MicrophoneVolumeMute", _keysym2.default.XF86XK_AudioMicMute);
|
||||
addStandard("MicrophoneVolumeMute", KeyTable.XF86XK_AudioMicMute);
|
||||
|
||||
// 2.13. Speech Keys
|
||||
|
||||
|
@ -251,28 +246,28 @@ addStandard("MicrophoneVolumeMute", _keysym2.default.XF86XK_AudioMicMute);
|
|||
|
||||
// 2.14. Application Keys
|
||||
|
||||
addStandard("LaunchCalculator", _keysym2.default.XF86XK_Calculator);
|
||||
addStandard("LaunchCalendar", _keysym2.default.XF86XK_Calendar);
|
||||
addStandard("LaunchMail", _keysym2.default.XF86XK_Mail);
|
||||
addStandard("LaunchMediaPlayer", _keysym2.default.XF86XK_AudioMedia);
|
||||
addStandard("LaunchMusicPlayer", _keysym2.default.XF86XK_Music);
|
||||
addStandard("LaunchMyComputer", _keysym2.default.XF86XK_MyComputer);
|
||||
addStandard("LaunchPhone", _keysym2.default.XF86XK_Phone);
|
||||
addStandard("LaunchScreenSaver", _keysym2.default.XF86XK_ScreenSaver);
|
||||
addStandard("LaunchSpreadsheet", _keysym2.default.XF86XK_Excel);
|
||||
addStandard("LaunchWebBrowser", _keysym2.default.XF86XK_WWW);
|
||||
addStandard("LaunchWebCam", _keysym2.default.XF86XK_WebCam);
|
||||
addStandard("LaunchWordProcessor", _keysym2.default.XF86XK_Word);
|
||||
addStandard("LaunchCalculator", KeyTable.XF86XK_Calculator);
|
||||
addStandard("LaunchCalendar", KeyTable.XF86XK_Calendar);
|
||||
addStandard("LaunchMail", KeyTable.XF86XK_Mail);
|
||||
addStandard("LaunchMediaPlayer", KeyTable.XF86XK_AudioMedia);
|
||||
addStandard("LaunchMusicPlayer", KeyTable.XF86XK_Music);
|
||||
addStandard("LaunchMyComputer", KeyTable.XF86XK_MyComputer);
|
||||
addStandard("LaunchPhone", KeyTable.XF86XK_Phone);
|
||||
addStandard("LaunchScreenSaver", KeyTable.XF86XK_ScreenSaver);
|
||||
addStandard("LaunchSpreadsheet", KeyTable.XF86XK_Excel);
|
||||
addStandard("LaunchWebBrowser", KeyTable.XF86XK_WWW);
|
||||
addStandard("LaunchWebCam", KeyTable.XF86XK_WebCam);
|
||||
addStandard("LaunchWordProcessor", KeyTable.XF86XK_Word);
|
||||
|
||||
// 2.15. Browser Keys
|
||||
|
||||
addStandard("BrowserBack", _keysym2.default.XF86XK_Back);
|
||||
addStandard("BrowserFavorites", _keysym2.default.XF86XK_Favorites);
|
||||
addStandard("BrowserForward", _keysym2.default.XF86XK_Forward);
|
||||
addStandard("BrowserHome", _keysym2.default.XF86XK_HomePage);
|
||||
addStandard("BrowserRefresh", _keysym2.default.XF86XK_Refresh);
|
||||
addStandard("BrowserSearch", _keysym2.default.XF86XK_Search);
|
||||
addStandard("BrowserStop", _keysym2.default.XF86XK_Stop);
|
||||
addStandard("BrowserBack", KeyTable.XF86XK_Back);
|
||||
addStandard("BrowserFavorites", KeyTable.XF86XK_Favorites);
|
||||
addStandard("BrowserForward", KeyTable.XF86XK_Forward);
|
||||
addStandard("BrowserHome", KeyTable.XF86XK_HomePage);
|
||||
addStandard("BrowserRefresh", KeyTable.XF86XK_Refresh);
|
||||
addStandard("BrowserSearch", KeyTable.XF86XK_Search);
|
||||
addStandard("BrowserStop", KeyTable.XF86XK_Stop);
|
||||
|
||||
// 2.16. Mobile Phone Keys
|
||||
|
||||
|
@ -285,31 +280,31 @@ addStandard("BrowserStop", _keysym2.default.XF86XK_Stop);
|
|||
// 2.18. Media Controller Keys
|
||||
|
||||
// - A whole bunch...
|
||||
addStandard("Dimmer", _keysym2.default.XF86XK_BrightnessAdjust);
|
||||
addStandard("MediaAudioTrack", _keysym2.default.XF86XK_AudioCycleTrack);
|
||||
addStandard("RandomToggle", _keysym2.default.XF86XK_AudioRandomPlay);
|
||||
addStandard("SplitScreenToggle", _keysym2.default.XF86XK_SplitScreen);
|
||||
addStandard("Subtitle", _keysym2.default.XF86XK_Subtitle);
|
||||
addStandard("VideoModeNext", _keysym2.default.XF86XK_Next_VMode);
|
||||
addStandard("Dimmer", KeyTable.XF86XK_BrightnessAdjust);
|
||||
addStandard("MediaAudioTrack", KeyTable.XF86XK_AudioCycleTrack);
|
||||
addStandard("RandomToggle", KeyTable.XF86XK_AudioRandomPlay);
|
||||
addStandard("SplitScreenToggle", KeyTable.XF86XK_SplitScreen);
|
||||
addStandard("Subtitle", KeyTable.XF86XK_Subtitle);
|
||||
addStandard("VideoModeNext", KeyTable.XF86XK_Next_VMode);
|
||||
|
||||
// Extra: Numpad
|
||||
|
||||
addNumpad("=", _keysym2.default.XK_equal, _keysym2.default.XK_KP_Equal);
|
||||
addNumpad("+", _keysym2.default.XK_plus, _keysym2.default.XK_KP_Add);
|
||||
addNumpad("-", _keysym2.default.XK_minus, _keysym2.default.XK_KP_Subtract);
|
||||
addNumpad("*", _keysym2.default.XK_asterisk, _keysym2.default.XK_KP_Multiply);
|
||||
addNumpad("/", _keysym2.default.XK_slash, _keysym2.default.XK_KP_Divide);
|
||||
addNumpad(".", _keysym2.default.XK_period, _keysym2.default.XK_KP_Decimal);
|
||||
addNumpad(",", _keysym2.default.XK_comma, _keysym2.default.XK_KP_Separator);
|
||||
addNumpad("0", _keysym2.default.XK_0, _keysym2.default.XK_KP_0);
|
||||
addNumpad("1", _keysym2.default.XK_1, _keysym2.default.XK_KP_1);
|
||||
addNumpad("2", _keysym2.default.XK_2, _keysym2.default.XK_KP_2);
|
||||
addNumpad("3", _keysym2.default.XK_3, _keysym2.default.XK_KP_3);
|
||||
addNumpad("4", _keysym2.default.XK_4, _keysym2.default.XK_KP_4);
|
||||
addNumpad("5", _keysym2.default.XK_5, _keysym2.default.XK_KP_5);
|
||||
addNumpad("6", _keysym2.default.XK_6, _keysym2.default.XK_KP_6);
|
||||
addNumpad("7", _keysym2.default.XK_7, _keysym2.default.XK_KP_7);
|
||||
addNumpad("8", _keysym2.default.XK_8, _keysym2.default.XK_KP_8);
|
||||
addNumpad("9", _keysym2.default.XK_9, _keysym2.default.XK_KP_9);
|
||||
addNumpad("=", KeyTable.XK_equal, KeyTable.XK_KP_Equal);
|
||||
addNumpad("+", KeyTable.XK_plus, KeyTable.XK_KP_Add);
|
||||
addNumpad("-", KeyTable.XK_minus, KeyTable.XK_KP_Subtract);
|
||||
addNumpad("*", KeyTable.XK_asterisk, KeyTable.XK_KP_Multiply);
|
||||
addNumpad("/", KeyTable.XK_slash, KeyTable.XK_KP_Divide);
|
||||
addNumpad(".", KeyTable.XK_period, KeyTable.XK_KP_Decimal);
|
||||
addNumpad(",", KeyTable.XK_comma, KeyTable.XK_KP_Separator);
|
||||
addNumpad("0", KeyTable.XK_0, KeyTable.XK_KP_0);
|
||||
addNumpad("1", KeyTable.XK_1, KeyTable.XK_KP_1);
|
||||
addNumpad("2", KeyTable.XK_2, KeyTable.XK_KP_2);
|
||||
addNumpad("3", KeyTable.XK_3, KeyTable.XK_KP_3);
|
||||
addNumpad("4", KeyTable.XK_4, KeyTable.XK_KP_4);
|
||||
addNumpad("5", KeyTable.XK_5, KeyTable.XK_KP_5);
|
||||
addNumpad("6", KeyTable.XK_6, KeyTable.XK_KP_6);
|
||||
addNumpad("7", KeyTable.XK_7, KeyTable.XK_KP_7);
|
||||
addNumpad("8", KeyTable.XK_8, KeyTable.XK_KP_8);
|
||||
addNumpad("9", KeyTable.XK_9, KeyTable.XK_KP_9);
|
||||
|
||||
exports.default = DOMKeyTable;
|
||||
export default DOMKeyTable;
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
||||
|
@ -19,7 +14,7 @@ Object.defineProperty(exports, "__esModule", {
|
|||
* See https://www.w3.org/TR/uievents-key/ for possible values.
|
||||
*/
|
||||
|
||||
exports.default = {
|
||||
export default {
|
||||
|
||||
// 3.1.1.1. Writing System Keys
|
||||
|
||||
|
@ -128,5 +123,5 @@ exports.default = {
|
|||
'AudioVolumeDown': 'AudioVolumeDown',
|
||||
'AudioVolumeMute': 'AudioVolumeMute',
|
||||
'AudioVolumeUp': 'AudioVolumeUp',
|
||||
'WakeUp': 'WakeUp'
|
||||
'WakeUp': 'WakeUp',
|
||||
};
|
|
@ -1,37 +1,21 @@
|
|||
'use strict';
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
|
||||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = Keyboard;
|
||||
|
||||
var _logging = require('../util/logging.js');
|
||||
|
||||
var Log = _interopRequireWildcard(_logging);
|
||||
|
||||
var _events = require('../util/events.js');
|
||||
|
||||
var _util = require('./util.js');
|
||||
|
||||
var KeyboardUtil = _interopRequireWildcard(_util);
|
||||
|
||||
var _keysym = require('./keysym.js');
|
||||
|
||||
var _keysym2 = _interopRequireDefault(_keysym);
|
||||
|
||||
var _browser = require('../util/browser.js');
|
||||
|
||||
var browser = _interopRequireWildcard(_browser);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
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 '../util/logging.js';
|
||||
import { stopEvent } from '../util/events.js';
|
||||
import * as KeyboardUtil from "./util.js";
|
||||
import KeyTable from "./keysym.js";
|
||||
import * as browser from "../util/browser.js";
|
||||
|
||||
//
|
||||
// Keyboard event handler
|
||||
//
|
||||
|
||||
function Keyboard(target) {
|
||||
export default function Keyboard(target) {
|
||||
this._target = target || null;
|
||||
|
||||
this._keyDownList = {}; // List of depressed keys
|
||||
|
@ -45,14 +29,7 @@ function Keyboard(target) {
|
|||
'keypress': this._handleKeyPress.bind(this),
|
||||
'blur': this._allKeysUp.bind(this)
|
||||
};
|
||||
} /*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
|
||||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
Keyboard.prototype = {
|
||||
// ===== EVENT HANDLERS =====
|
||||
|
@ -62,7 +39,8 @@ Keyboard.prototype = {
|
|||
// ===== PRIVATE METHODS =====
|
||||
|
||||
_sendKeyEvent: function (keysym, code, down) {
|
||||
Log.Debug("onkeyevent " + (down ? "down" : "up") + ", keysym: " + keysym, ", code: " + code);
|
||||
Log.Debug("onkeyevent " + (down ? "down" : "up") +
|
||||
", keysym: " + keysym, ", code: " + code);
|
||||
|
||||
// Windows sends CtrlLeft+AltRight when you press
|
||||
// AltGraph, which tends to confuse the hell out of
|
||||
|
@ -70,18 +48,25 @@ Keyboard.prototype = {
|
|||
// there is a way to detect AltGraph properly.
|
||||
var fakeAltGraph = false;
|
||||
if (down && browser.isWindows()) {
|
||||
if (code !== 'ControlLeft' && code !== 'AltRight' && 'ControlLeft' in this._keyDownList && 'AltRight' in this._keyDownList) {
|
||||
if ((code !== 'ControlLeft') &&
|
||||
(code !== 'AltRight') &&
|
||||
('ControlLeft' in this._keyDownList) &&
|
||||
('AltRight' in this._keyDownList)) {
|
||||
fakeAltGraph = true;
|
||||
this.onkeyevent(this._keyDownList['AltRight'], 'AltRight', false);
|
||||
this.onkeyevent(this._keyDownList['ControlLeft'], 'ControlLeft', false);
|
||||
this.onkeyevent(this._keyDownList['AltRight'],
|
||||
'AltRight', false);
|
||||
this.onkeyevent(this._keyDownList['ControlLeft'],
|
||||
'ControlLeft', false);
|
||||
}
|
||||
}
|
||||
|
||||
this.onkeyevent(keysym, code, down);
|
||||
|
||||
if (fakeAltGraph) {
|
||||
this.onkeyevent(this._keyDownList['ControlLeft'], 'ControlLeft', true);
|
||||
this.onkeyevent(this._keyDownList['AltRight'], 'AltRight', true);
|
||||
this.onkeyevent(this._keyDownList['ControlLeft'],
|
||||
'ControlLeft', true);
|
||||
this.onkeyevent(this._keyDownList['AltRight'],
|
||||
'AltRight', true);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -94,7 +79,7 @@ Keyboard.prototype = {
|
|||
// Unstable, but we don't have anything else to go on
|
||||
// (don't use it for 'keypress' events thought since
|
||||
// WebKit sets it to the same as charCode)
|
||||
if (e.keyCode && e.type !== 'keypress') {
|
||||
if (e.keyCode && (e.type !== 'keypress')) {
|
||||
// 229 is used for composition events
|
||||
if (e.keyCode !== 229) {
|
||||
return 'Platform' + e.keyCode;
|
||||
|
@ -128,7 +113,7 @@ Keyboard.prototype = {
|
|||
// to deal with virtual keyboards which omit key info
|
||||
// (iOS omits tracking info on keyup events, which forces us to
|
||||
// special treat that platform here)
|
||||
if (code === 'Unidentified' || browser.isIOS()) {
|
||||
if ((code === 'Unidentified') || browser.isIOS()) {
|
||||
if (keysym) {
|
||||
// If it's a virtual keyboard then it should be
|
||||
// sufficient to just send press and release right
|
||||
|
@ -137,7 +122,7 @@ Keyboard.prototype = {
|
|||
this._sendKeyEvent(keysym, code, false);
|
||||
}
|
||||
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -147,17 +132,17 @@ Keyboard.prototype = {
|
|||
// possibly others).
|
||||
if (browser.isMac()) {
|
||||
switch (keysym) {
|
||||
case _keysym2.default.XK_Super_L:
|
||||
keysym = _keysym2.default.XK_Alt_L;
|
||||
case KeyTable.XK_Super_L:
|
||||
keysym = KeyTable.XK_Alt_L;
|
||||
break;
|
||||
case _keysym2.default.XK_Super_R:
|
||||
keysym = _keysym2.default.XK_Super_L;
|
||||
case KeyTable.XK_Super_R:
|
||||
keysym = KeyTable.XK_Super_L;
|
||||
break;
|
||||
case _keysym2.default.XK_Alt_L:
|
||||
keysym = _keysym2.default.XK_Mode_switch;
|
||||
case KeyTable.XK_Alt_L:
|
||||
keysym = KeyTable.XK_Mode_switch;
|
||||
break;
|
||||
case _keysym2.default.XK_Alt_R:
|
||||
keysym = _keysym2.default.XK_ISO_Level3_Shift;
|
||||
case KeyTable.XK_Alt_R:
|
||||
keysym = KeyTable.XK_ISO_Level3_Shift;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -172,10 +157,10 @@ Keyboard.prototype = {
|
|||
// state change events. That gets extra confusing for CapsLock
|
||||
// which toggles on each press, but not on release. So pretend
|
||||
// it was a quick press and release of the button.
|
||||
if (browser.isMac() && code === 'CapsLock') {
|
||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', true);
|
||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', false);
|
||||
(0, _events.stopEvent)(e);
|
||||
if (browser.isMac() && (code === 'CapsLock')) {
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
|
||||
stopEvent(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -193,7 +178,7 @@ Keyboard.prototype = {
|
|||
}
|
||||
|
||||
this._pendingKey = null;
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
|
||||
this._keyDownList[code] = keysym;
|
||||
|
||||
|
@ -202,7 +187,7 @@ Keyboard.prototype = {
|
|||
|
||||
// Legacy event for browsers without code/key
|
||||
_handleKeyPress: function (e) {
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
|
||||
// Are we expecting a keypress?
|
||||
if (this._pendingKey === null) {
|
||||
|
@ -213,7 +198,7 @@ Keyboard.prototype = {
|
|||
var keysym = KeyboardUtil.getKeysym(e);
|
||||
|
||||
// The key we were waiting for?
|
||||
if (code !== 'Unidentified' && code != this._pendingKey) {
|
||||
if ((code !== 'Unidentified') && (code != this._pendingKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -243,14 +228,17 @@ Keyboard.prototype = {
|
|||
// We have no way of knowing the proper keysym with the
|
||||
// information given, but the following are true for most
|
||||
// layouts
|
||||
if (e.keyCode >= 0x30 && e.keyCode <= 0x39) {
|
||||
if ((e.keyCode >= 0x30) && (e.keyCode <= 0x39)) {
|
||||
// Digit
|
||||
keysym = e.keyCode;
|
||||
} else if (e.keyCode >= 0x41 && e.keyCode <= 0x5a) {
|
||||
} else if ((e.keyCode >= 0x41) && (e.keyCode <= 0x5a)) {
|
||||
// Character (A-Z)
|
||||
var char = String.fromCharCode(e.keyCode);
|
||||
// A feeble attempt at the correct case
|
||||
if (e.shiftKey) char = char.toUpperCase();else char = char.toLowerCase();
|
||||
if (e.shiftKey)
|
||||
char = char.toUpperCase();
|
||||
else
|
||||
char = char.toLowerCase();
|
||||
keysym = char.charCodeAt();
|
||||
} else {
|
||||
// Unknown, give up
|
||||
|
@ -263,14 +251,14 @@ Keyboard.prototype = {
|
|||
},
|
||||
|
||||
_handleKeyUp: function (e) {
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
|
||||
var code = this._getKeyCode(e);
|
||||
|
||||
// See comment in _handleKeyDown()
|
||||
if (browser.isMac() && code === 'CapsLock') {
|
||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', true);
|
||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', false);
|
||||
if (browser.isMac() && (code === 'CapsLock')) {
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -322,5 +310,5 @@ Keyboard.prototype = {
|
|||
this._allKeysUp();
|
||||
|
||||
//Log.Debug(">> Keyboard.ungrab");
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,9 +1,4 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = {
|
||||
export default {
|
||||
XK_VoidSymbol: 0xffffff, /* Void symbol */
|
||||
|
||||
XK_BackSpace: 0xff08, /* Back space, back char */
|
||||
|
@ -62,6 +57,7 @@ exports.default = {
|
|||
XK_End: 0xff57, /* EOL */
|
||||
XK_Begin: 0xff58, /* BOL */
|
||||
|
||||
|
||||
/* Misc functions */
|
||||
|
||||
XK_Select: 0xff60, /* Select, mark */
|
||||
|
@ -614,5 +610,5 @@ exports.default = {
|
|||
XF86XK_Next_VMode: 0x1008FE22,
|
||||
XF86XK_Prev_VMode: 0x1008FE23,
|
||||
XF86XK_LogWindowTree: 0x1008FE24,
|
||||
XF86XK_LogGrabInfo: 0x1008FE25
|
||||
XF86XK_LogGrabInfo: 0x1008FE25,
|
||||
};
|
|
@ -1,8 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
/*
|
||||
* Mapping from Unicode codepoints to X11/RFB keysyms
|
||||
*
|
||||
|
@ -671,13 +666,13 @@ var codepoints = {
|
|||
0x30f2: 0x04a6, // XK_kana_WO
|
||||
0x30f3: 0x04dd, // XK_kana_N
|
||||
0x30fb: 0x04a5, // XK_kana_conjunctive
|
||||
0x30fc: 0x04b0 // XK_prolongedsound
|
||||
0x30fc: 0x04b0, // XK_prolongedsound
|
||||
};
|
||||
|
||||
exports.default = {
|
||||
export default {
|
||||
lookup : function(u) {
|
||||
// Latin-1 is one-to-one mapping
|
||||
if (u >= 0x20 && u <= 0xff) {
|
||||
if ((u >= 0x20) && (u <= 0xff)) {
|
||||
return u;
|
||||
}
|
||||
|
||||
|
@ -689,5 +684,5 @@ exports.default = {
|
|||
|
||||
// General mapping as final fallback
|
||||
return 0x01000000 | u;
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,21 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = Mouse;
|
||||
|
||||
var _logging = require('../util/logging.js');
|
||||
|
||||
var Log = _interopRequireWildcard(_logging);
|
||||
|
||||
var _browser = require('../util/browser.js');
|
||||
|
||||
var _events = require('../util/events.js');
|
||||
|
||||
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; } }
|
||||
|
||||
var WHEEL_STEP = 10; // Delta threshold for a mouse wheel step
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
|
@ -23,10 +5,15 @@ var WHEEL_STEP = 10; // Delta threshold for a mouse wheel step
|
|||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
import * as Log from '../util/logging.js';
|
||||
import { isTouchDevice } from '../util/browser.js';
|
||||
import { setCapture, stopEvent, getPointerEvent } from '../util/events.js';
|
||||
|
||||
var WHEEL_STEP = 10; // Delta threshold for a mouse wheel step
|
||||
var WHEEL_STEP_TIMEOUT = 50; // ms
|
||||
var WHEEL_LINE_HEIGHT = 19;
|
||||
|
||||
function Mouse(target) {
|
||||
export default function Mouse(target) {
|
||||
this._target = target || document;
|
||||
|
||||
this._doubleClickTimer = null;
|
||||
|
@ -85,7 +72,7 @@ Mouse.prototype = {
|
|||
|
||||
var xs = this._lastTouchPos.x - pos.x;
|
||||
var ys = this._lastTouchPos.y - pos.y;
|
||||
var d = Math.sqrt(xs * xs + ys * ys);
|
||||
var d = Math.sqrt((xs * xs) + (ys * ys));
|
||||
|
||||
// The goal is to trigger on a certain physical width, the
|
||||
// devicePixelRatio brings us a bit closer but is not optimal.
|
||||
|
@ -108,16 +95,17 @@ Mouse.prototype = {
|
|||
(e.button & 0x4) / 2; // Middle
|
||||
}
|
||||
|
||||
Log.Debug("onmousebutton " + (down ? "down" : "up") + ", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask);
|
||||
Log.Debug("onmousebutton " + (down ? "down" : "up") +
|
||||
", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask);
|
||||
this.onmousebutton(pos.x, pos.y, down, bmask);
|
||||
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
},
|
||||
|
||||
_handleMouseDown: function (e) {
|
||||
// Touch events have implicit capture
|
||||
if (e.type === "mousedown") {
|
||||
(0, _events.setCapture)(this._target);
|
||||
setCapture(this._target);
|
||||
}
|
||||
|
||||
this._handleMouseButton(e, 1);
|
||||
|
@ -191,21 +179,25 @@ Mouse.prototype = {
|
|||
if (Math.abs(this._accumulatedWheelDeltaX) > WHEEL_STEP) {
|
||||
this._generateWheelStepX();
|
||||
} else {
|
||||
this._wheelStepXTimer = window.setTimeout(this._generateWheelStepX.bind(this), WHEEL_STEP_TIMEOUT);
|
||||
this._wheelStepXTimer =
|
||||
window.setTimeout(this._generateWheelStepX.bind(this),
|
||||
WHEEL_STEP_TIMEOUT);
|
||||
}
|
||||
if (Math.abs(this._accumulatedWheelDeltaY) > WHEEL_STEP) {
|
||||
this._generateWheelStepY();
|
||||
} else {
|
||||
this._wheelStepYTimer = window.setTimeout(this._generateWheelStepY.bind(this), WHEEL_STEP_TIMEOUT);
|
||||
this._wheelStepYTimer =
|
||||
window.setTimeout(this._generateWheelStepY.bind(this),
|
||||
WHEEL_STEP_TIMEOUT);
|
||||
}
|
||||
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
},
|
||||
|
||||
_handleMouseMove: function (e) {
|
||||
this._updateMousePosition(e);
|
||||
this.onmousemove(this._pos.x, this._pos.y);
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
},
|
||||
|
||||
_handleMouseDisable: function (e) {
|
||||
|
@ -216,13 +208,13 @@ Mouse.prototype = {
|
|||
* to listen on the document element instead.
|
||||
*/
|
||||
if (e.target == this._target) {
|
||||
(0, _events.stopEvent)(e);
|
||||
stopEvent(e);
|
||||
}
|
||||
},
|
||||
|
||||
// Update coordinates relative to target
|
||||
_updateMousePosition: function(e) {
|
||||
e = (0, _events.getPointerEvent)(e);
|
||||
e = getPointerEvent(e);
|
||||
var bounds = this._target.getBoundingClientRect();
|
||||
var x, y;
|
||||
// Clip to target bounds
|
||||
|
@ -248,7 +240,7 @@ Mouse.prototype = {
|
|||
grab: function () {
|
||||
var c = this._target;
|
||||
|
||||
if (_browser.isTouchDevice) {
|
||||
if (isTouchDevice) {
|
||||
c.addEventListener('touchstart', this._eventHandlers.mousedown);
|
||||
c.addEventListener('touchend', this._eventHandlers.mouseup);
|
||||
c.addEventListener('touchmove', this._eventHandlers.mousemove);
|
||||
|
@ -271,7 +263,7 @@ Mouse.prototype = {
|
|||
|
||||
this._resetWheelStepTimers();
|
||||
|
||||
if (_browser.isTouchDevice) {
|
||||
if (isTouchDevice) {
|
||||
c.removeEventListener('touchstart', this._eventHandlers.mousedown);
|
||||
c.removeEventListener('touchend', this._eventHandlers.mouseup);
|
||||
c.removeEventListener('touchmove', this._eventHandlers.mousemove);
|
||||
|
|
|
@ -1,42 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getKeycode = getKeycode;
|
||||
exports.getKey = getKey;
|
||||
exports.getKeysym = getKeysym;
|
||||
|
||||
var _keysym = require("./keysym.js");
|
||||
|
||||
var _keysym2 = _interopRequireDefault(_keysym);
|
||||
|
||||
var _keysymdef = require("./keysymdef.js");
|
||||
|
||||
var _keysymdef2 = _interopRequireDefault(_keysymdef);
|
||||
|
||||
var _vkeys = require("./vkeys.js");
|
||||
|
||||
var _vkeys2 = _interopRequireDefault(_vkeys);
|
||||
|
||||
var _fixedkeys = require("./fixedkeys.js");
|
||||
|
||||
var _fixedkeys2 = _interopRequireDefault(_fixedkeys);
|
||||
|
||||
var _domkeytable = require("./domkeytable.js");
|
||||
|
||||
var _domkeytable2 = _interopRequireDefault(_domkeytable);
|
||||
|
||||
var _browser = require("../util/browser.js");
|
||||
|
||||
var browser = _interopRequireWildcard(_browser);
|
||||
|
||||
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; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
import KeyTable from "./keysym.js";
|
||||
import keysyms from "./keysymdef.js";
|
||||
import vkeys from "./vkeys.js";
|
||||
import fixedkeys from "./fixedkeys.js";
|
||||
import DOMKeyTable from "./domkeytable.js";
|
||||
import * as browser from "../util/browser.js";
|
||||
|
||||
// Get 'KeyboardEvent.code', handling legacy browsers
|
||||
function getKeycode(evt) {
|
||||
export function getKeycode(evt){
|
||||
// Are we getting proper key identifiers?
|
||||
// (unfortunately Firefox and Chrome are crappy here and gives
|
||||
// us an empty string on some platforms, rather than leaving it
|
||||
|
@ -44,10 +14,8 @@ function getKeycode(evt) {
|
|||
if (evt.code) {
|
||||
// Mozilla isn't fully in sync with the spec yet
|
||||
switch (evt.code) {
|
||||
case 'OSLeft':
|
||||
return 'MetaLeft';
|
||||
case 'OSRight':
|
||||
return 'MetaRight';
|
||||
case 'OSLeft': return 'MetaLeft';
|
||||
case 'OSRight': return 'MetaRight';
|
||||
}
|
||||
|
||||
return evt.code;
|
||||
|
@ -56,11 +24,11 @@ function getKeycode(evt) {
|
|||
// The de-facto standard is to use Windows Virtual-Key codes
|
||||
// in the 'keyCode' field for non-printable characters. However
|
||||
// Webkit sets it to the same as charCode in 'keypress' events.
|
||||
if (evt.type !== 'keypress' && evt.keyCode in _vkeys2.default) {
|
||||
var code = _vkeys2.default[evt.keyCode];
|
||||
if ((evt.type !== 'keypress') && (evt.keyCode in vkeys)) {
|
||||
var code = vkeys[evt.keyCode];
|
||||
|
||||
// macOS has messed up this code for some reason
|
||||
if (browser.isMac() && code === 'ContextMenu') {
|
||||
if (browser.isMac() && (code === 'ContextMenu')) {
|
||||
code = 'MetaRight';
|
||||
}
|
||||
|
||||
|
@ -68,40 +36,26 @@ function getKeycode(evt) {
|
|||
// for the standard modifiers
|
||||
if (evt.location === 2) {
|
||||
switch (code) {
|
||||
case 'ShiftLeft':
|
||||
return 'ShiftRight';
|
||||
case 'ControlLeft':
|
||||
return 'ControlRight';
|
||||
case 'AltLeft':
|
||||
return 'AltRight';
|
||||
case 'ShiftLeft': return 'ShiftRight';
|
||||
case 'ControlLeft': return 'ControlRight';
|
||||
case 'AltLeft': return 'AltRight';
|
||||
}
|
||||
}
|
||||
|
||||
// Nor a bunch of the numpad keys
|
||||
if (evt.location === 3) {
|
||||
switch (code) {
|
||||
case 'Delete':
|
||||
return 'NumpadDecimal';
|
||||
case 'Insert':
|
||||
return 'Numpad0';
|
||||
case 'End':
|
||||
return 'Numpad1';
|
||||
case 'ArrowDown':
|
||||
return 'Numpad2';
|
||||
case 'PageDown':
|
||||
return 'Numpad3';
|
||||
case 'ArrowLeft':
|
||||
return 'Numpad4';
|
||||
case 'ArrowRight':
|
||||
return 'Numpad6';
|
||||
case 'Home':
|
||||
return 'Numpad7';
|
||||
case 'ArrowUp':
|
||||
return 'Numpad8';
|
||||
case 'PageUp':
|
||||
return 'Numpad9';
|
||||
case 'Enter':
|
||||
return 'NumpadEnter';
|
||||
case 'Delete': return 'NumpadDecimal';
|
||||
case 'Insert': return 'Numpad0';
|
||||
case 'End': return 'Numpad1';
|
||||
case 'ArrowDown': return 'Numpad2';
|
||||
case 'PageDown': return 'Numpad3';
|
||||
case 'ArrowLeft': return 'Numpad4';
|
||||
case 'ArrowRight': return 'Numpad6';
|
||||
case 'Home': return 'Numpad7';
|
||||
case 'ArrowUp': return 'Numpad8';
|
||||
case 'PageUp': return 'Numpad9';
|
||||
case 'Enter': return 'NumpadEnter';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,75 +66,54 @@ function getKeycode(evt) {
|
|||
}
|
||||
|
||||
// Get 'KeyboardEvent.key', handling legacy browsers
|
||||
function getKey(evt) {
|
||||
export function getKey(evt) {
|
||||
// Are we getting a proper key value?
|
||||
if (evt.key !== undefined) {
|
||||
// IE and Edge use some ancient version of the spec
|
||||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
|
||||
switch (evt.key) {
|
||||
case 'Spacebar':
|
||||
return ' ';
|
||||
case 'Esc':
|
||||
return 'Escape';
|
||||
case 'Scroll':
|
||||
return 'ScrollLock';
|
||||
case 'Win':
|
||||
return 'Meta';
|
||||
case 'Apps':
|
||||
return 'ContextMenu';
|
||||
case 'Up':
|
||||
return 'ArrowUp';
|
||||
case 'Left':
|
||||
return 'ArrowLeft';
|
||||
case 'Right':
|
||||
return 'ArrowRight';
|
||||
case 'Down':
|
||||
return 'ArrowDown';
|
||||
case 'Del':
|
||||
return 'Delete';
|
||||
case 'Divide':
|
||||
return '/';
|
||||
case 'Multiply':
|
||||
return '*';
|
||||
case 'Subtract':
|
||||
return '-';
|
||||
case 'Add':
|
||||
return '+';
|
||||
case 'Decimal':
|
||||
return evt.char;
|
||||
case 'Spacebar': return ' ';
|
||||
case 'Esc': return 'Escape';
|
||||
case 'Scroll': return 'ScrollLock';
|
||||
case 'Win': return 'Meta';
|
||||
case 'Apps': return 'ContextMenu';
|
||||
case 'Up': return 'ArrowUp';
|
||||
case 'Left': return 'ArrowLeft';
|
||||
case 'Right': return 'ArrowRight';
|
||||
case 'Down': return 'ArrowDown';
|
||||
case 'Del': return 'Delete';
|
||||
case 'Divide': return '/';
|
||||
case 'Multiply': return '*';
|
||||
case 'Subtract': return '-';
|
||||
case 'Add': return '+';
|
||||
case 'Decimal': return evt.char;
|
||||
}
|
||||
|
||||
// Mozilla isn't fully in sync with the spec yet
|
||||
switch (evt.key) {
|
||||
case 'OS':
|
||||
return 'Meta';
|
||||
case 'OS': return 'Meta';
|
||||
}
|
||||
|
||||
// iOS leaks some OS names
|
||||
switch (evt.key) {
|
||||
case 'UIKeyInputUpArrow':
|
||||
return 'ArrowUp';
|
||||
case 'UIKeyInputDownArrow':
|
||||
return 'ArrowDown';
|
||||
case 'UIKeyInputLeftArrow':
|
||||
return 'ArrowLeft';
|
||||
case 'UIKeyInputRightArrow':
|
||||
return 'ArrowRight';
|
||||
case 'UIKeyInputEscape':
|
||||
return 'Escape';
|
||||
case 'UIKeyInputUpArrow': return 'ArrowUp';
|
||||
case 'UIKeyInputDownArrow': return 'ArrowDown';
|
||||
case 'UIKeyInputLeftArrow': return 'ArrowLeft';
|
||||
case 'UIKeyInputRightArrow': return 'ArrowRight';
|
||||
case 'UIKeyInputEscape': return 'Escape';
|
||||
}
|
||||
|
||||
// IE and Edge have broken handling of AltGraph so we cannot
|
||||
// trust them for printable characters
|
||||
if (evt.key.length !== 1 || !browser.isIE() && !browser.isEdge()) {
|
||||
if ((evt.key.length !== 1) || (!browser.isIE() && !browser.isEdge())) {
|
||||
return evt.key;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to deduce it based on the physical key
|
||||
var code = getKeycode(evt);
|
||||
if (code in _fixedkeys2.default) {
|
||||
return _fixedkeys2.default[code];
|
||||
if (code in fixedkeys) {
|
||||
return fixedkeys[code];
|
||||
}
|
||||
|
||||
// If that failed, then see if we have a printable character
|
||||
|
@ -193,7 +126,7 @@ function getKey(evt) {
|
|||
}
|
||||
|
||||
// Get the most reliable keysym value we can get from a key event
|
||||
function getKeysym(evt) {
|
||||
export function getKeysym(evt){
|
||||
var key = getKey(evt);
|
||||
|
||||
if (key === 'Unidentified') {
|
||||
|
@ -201,19 +134,19 @@ function getKeysym(evt) {
|
|||
}
|
||||
|
||||
// First look up special keys
|
||||
if (key in _domkeytable2.default) {
|
||||
if (key in DOMKeyTable) {
|
||||
var location = evt.location;
|
||||
|
||||
// Safari screws up location for the right cmd key
|
||||
if (key === 'Meta' && location === 0) {
|
||||
if ((key === 'Meta') && (location === 0)) {
|
||||
location = 2;
|
||||
}
|
||||
|
||||
if (location === undefined || location > 3) {
|
||||
if ((location === undefined) || (location > 3)) {
|
||||
location = 0;
|
||||
}
|
||||
|
||||
return _domkeytable2.default[key][location];
|
||||
return DOMKeyTable[key][location];
|
||||
}
|
||||
|
||||
// Now we need to look at the Unicode symbol instead
|
||||
|
@ -227,7 +160,7 @@ function getKeysym(evt) {
|
|||
|
||||
codepoint = key.charCodeAt();
|
||||
if (codepoint) {
|
||||
return _keysymdef2.default.lookup(codepoint);
|
||||
return keysyms.lookup(codepoint);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
||||
|
@ -14,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|||
* HTML key codes.
|
||||
*/
|
||||
|
||||
exports.default = {
|
||||
export default {
|
||||
0x08: 'Backspace',
|
||||
0x09: 'Tab',
|
||||
0x0a: 'NumpadClear',
|
||||
|
@ -117,5 +112,5 @@ exports.default = {
|
|||
0xb5: 'MediaSelect',
|
||||
0xb6: 'LaunchApp1',
|
||||
0xb7: 'LaunchApp2',
|
||||
0xe1: 'AltRight' // Only when it is AltGraph
|
||||
0xe1: 'AltRight', // Only when it is AltGraph
|
||||
};
|
|
@ -1,15 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
/*
|
||||
* This file is auto-generated from keymaps.csv on 2017-05-31 16:20
|
||||
* Database checksum sha256(92fd165507f2a3b8c5b3fa56e425d45788dbcb98cf067a307527d91ce22cab94)
|
||||
* To re-generate, run:
|
||||
* keymap-gen --lang=js code-map keymaps.csv html atset1
|
||||
*/
|
||||
exports.default = {
|
||||
export default {
|
||||
"Again": 0xe005, /* html:Again (Again) -> linux:129 (KEY_AGAIN) -> atset1:57349 */
|
||||
"AltLeft": 0x38, /* html:AltLeft (AltLeft) -> linux:56 (KEY_LEFTALT) -> atset1:56 */
|
||||
"AltRight": 0xe038, /* html:AltRight (AltRight) -> linux:100 (KEY_RIGHTALT) -> atset1:57400 */
|
||||
|
@ -172,5 +167,5 @@ exports.default = {
|
|||
"Suspend": 0xe025, /* html:Suspend (Suspend) -> linux:205 (KEY_SUSPEND) -> atset1:57381 */
|
||||
"Tab": 0xf, /* html:Tab (Tab) -> linux:15 (KEY_TAB) -> atset1:15 */
|
||||
"Undo": 0xe007, /* html:Undo (Undo) -> linux:131 (KEY_UNDO) -> atset1:57351 */
|
||||
"WakeUp": 0xe063 /* html:WakeUp (WakeUp) -> linux:143 (KEY_WAKEUP) -> atset1:57443 */
|
||||
"WakeUp": 0xe063, /* html:WakeUp (WakeUp) -> linux:143 (KEY_WAKEUP) -> atset1:57443 */
|
||||
};
|
File diff suppressed because it is too large
Load diff
|
@ -1,28 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
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; } }
|
||||
|
||||
// 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)
|
||||
|
@ -30,14 +6,23 @@ navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; /*
|
|||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
import * as Log from './logging.js';
|
||||
|
||||
// Touch detection
|
||||
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);
|
||||
}
|
||||
|
||||
function isIOS() {
|
||||
return navigator && (!!/ipad/i.exec(navigator.platform) || !!/iphone/i.exec(navigator.platform) || !!/ipod/i.exec(navigator.platform));
|
||||
export 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
|
||||
|
@ -115,10 +107,11 @@ function setCapture(elem) {
|
|||
}
|
||||
};
|
||||
|
||||
function releaseCapture() {
|
||||
export function releaseCapture () {
|
||||
if (document.releaseCapture) {
|
||||
|
||||
document.releaseCapture();
|
||||
|
||||
} else {
|
||||
if (!_captureElem) {
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright 2017 Pierre Ossman for Cendio AB
|
||||
|
@ -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();
|
|
@ -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)) {
|
||||
|
|
|
@ -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) {
|
||||
export function decodeUTF8 (utf8string) {
|
||||
"use strict";
|
||||
|
||||
return decodeURIComponent(escape(utf8string));
|
||||
};
|
|
@ -1,17 +1,20 @@
|
|||
'use strict';
|
||||
/*
|
||||
* Websock: high-performance binary WebSockets
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* Websock is similar to the standard WebSocket object but with extra
|
||||
* buffer handling.
|
||||
*
|
||||
* Websock has built-in receive queue buffering; the message event
|
||||
* does not contain actual data but is simply a notification that
|
||||
* there is new data available. Several rQ* methods are available to
|
||||
* read binary data off of the receive queue.
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = Websock;
|
||||
import * as Log from './util/logging.js';
|
||||
|
||||
var _logging = require('./util/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; } }
|
||||
|
||||
function Websock() {
|
||||
export default function Websock() {
|
||||
"use strict";
|
||||
|
||||
this._websocket = null; // WebSocket object
|
||||
|
@ -34,21 +37,7 @@ function Websock() {
|
|||
'close': function () {},
|
||||
'error': function () {}
|
||||
};
|
||||
} /*
|
||||
* Websock: high-performance binary WebSockets
|
||||
* Copyright (C) 2012 Joel Martin
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* Websock is similar to the standard WebSocket object but with extra
|
||||
* buffer handling.
|
||||
*
|
||||
* Websock has built-in receive queue buffering; the message event
|
||||
* does not contain actual data but is simply a notification that
|
||||
* there is new data available. Several rQ* methods are available to
|
||||
* read binary data off of the receive queue.
|
||||
*/
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
// this has performance issues in some versions Chromium, and
|
||||
// doesn't gain a tremendous amount of performance increase in Firefox
|
||||
|
@ -57,21 +46,20 @@ var ENABLE_COPYWITHIN = false;
|
|||
|
||||
var MAX_RQ_GROW_SIZE = 40 * 1024 * 1024; // 40 MiB
|
||||
|
||||
var typedArrayToString = function () {
|
||||
var typedArrayToString = (function () {
|
||||
// This is only for PhantomJS, which doesn't like apply-ing
|
||||
// with Typed Arrays
|
||||
try {
|
||||
var arr = new Uint8Array([1, 2, 3]);
|
||||
String.fromCharCode.apply(null, arr);
|
||||
return function (a) {
|
||||
return String.fromCharCode.apply(null, a);
|
||||
};
|
||||
return function (a) { return String.fromCharCode.apply(null, a); };
|
||||
} catch (ex) {
|
||||
return function (a) {
|
||||
return String.fromCharCode.apply(null, Array.prototype.slice.call(a));
|
||||
return String.fromCharCode.apply(
|
||||
null, Array.prototype.slice.call(a));
|
||||
};
|
||||
}
|
||||
}();
|
||||
})();
|
||||
|
||||
Websock.prototype = {
|
||||
// Getters and Setters
|
||||
|
@ -114,34 +102,32 @@ Websock.prototype = {
|
|||
|
||||
// TODO(directxman12): test performance with these vs a DataView
|
||||
rQshift16: function () {
|
||||
return (this._rQ[this._rQi++] << 8) + this._rQ[this._rQi++];
|
||||
return (this._rQ[this._rQi++] << 8) +
|
||||
this._rQ[this._rQi++];
|
||||
},
|
||||
|
||||
rQshift32: function () {
|
||||
return (this._rQ[this._rQi++] << 24) + (this._rQ[this._rQi++] << 16) + (this._rQ[this._rQi++] << 8) + this._rQ[this._rQi++];
|
||||
return (this._rQ[this._rQi++] << 24) +
|
||||
(this._rQ[this._rQi++] << 16) +
|
||||
(this._rQ[this._rQi++] << 8) +
|
||||
this._rQ[this._rQi++];
|
||||
},
|
||||
|
||||
rQshiftStr: function (len) {
|
||||
if (typeof len === 'undefined') {
|
||||
len = this.rQlen();
|
||||
}
|
||||
if (typeof(len) === 'undefined') { len = this.rQlen(); }
|
||||
var arr = new Uint8Array(this._rQ.buffer, this._rQi, len);
|
||||
this._rQi += len;
|
||||
return typedArrayToString(arr);
|
||||
},
|
||||
|
||||
rQshiftBytes: function (len) {
|
||||
if (typeof len === 'undefined') {
|
||||
len = this.rQlen();
|
||||
}
|
||||
if (typeof(len) === 'undefined') { len = this.rQlen(); }
|
||||
this._rQi += len;
|
||||
return new Uint8Array(this._rQ.buffer, this._rQi - len, len);
|
||||
},
|
||||
|
||||
rQshiftTo: function (target, len) {
|
||||
if (len === undefined) {
|
||||
len = this.rQlen();
|
||||
}
|
||||
if (len === undefined) { len = this.rQlen(); }
|
||||
// TODO: make this just use set with views when using a ArrayBuffer to store the rQ
|
||||
target.set(new Uint8Array(this._rQ.buffer, this._rQi, len));
|
||||
this._rQi += len;
|
||||
|
@ -225,7 +211,7 @@ Websock.prototype = {
|
|||
this._websocket.binaryType = 'arraybuffer';
|
||||
|
||||
this._websocket.onmessage = this._recv_message.bind(this);
|
||||
this._websocket.onopen = function () {
|
||||
this._websocket.onopen = (function () {
|
||||
Log.Debug('>> WebSock.onopen');
|
||||
if (this._websocket.protocol) {
|
||||
Log.Info("Server choose sub-protocol: " + this._websocket.protocol);
|
||||
|
@ -233,29 +219,28 @@ Websock.prototype = {
|
|||
|
||||
this._eventHandlers.open();
|
||||
Log.Debug("<< WebSock.onopen");
|
||||
}.bind(this);
|
||||
this._websocket.onclose = function (e) {
|
||||
}).bind(this);
|
||||
this._websocket.onclose = (function (e) {
|
||||
Log.Debug(">> WebSock.onclose");
|
||||
this._eventHandlers.close(e);
|
||||
Log.Debug("<< WebSock.onclose");
|
||||
}.bind(this);
|
||||
this._websocket.onerror = function (e) {
|
||||
}).bind(this);
|
||||
this._websocket.onerror = (function (e) {
|
||||
Log.Debug(">> WebSock.onerror: " + e);
|
||||
this._eventHandlers.error(e);
|
||||
Log.Debug("<< WebSock.onerror: " + e);
|
||||
}.bind(this);
|
||||
}).bind(this);
|
||||
},
|
||||
|
||||
close: function () {
|
||||
if (this._websocket) {
|
||||
if (this._websocket.readyState === WebSocket.OPEN || this._websocket.readyState === WebSocket.CONNECTING) {
|
||||
if ((this._websocket.readyState === WebSocket.OPEN) ||
|
||||
(this._websocket.readyState === WebSocket.CONNECTING)) {
|
||||
Log.Info("Closing WebSocket connection");
|
||||
this._websocket.close();
|
||||
}
|
||||
|
||||
this._websocket.onmessage = function (e) {
|
||||
return;
|
||||
};
|
||||
this._websocket.onmessage = function (e) { return; };
|
||||
}
|
||||
},
|
||||
|
||||
|
|
0
static/js/novnc/vendor/browser-es-module-loader/.npmignore
vendored
Executable file
0
static/js/novnc/vendor/browser-es-module-loader/.npmignore
vendored
Executable file
15
static/js/novnc/vendor/browser-es-module-loader/README.md
vendored
Executable file
15
static/js/novnc/vendor/browser-es-module-loader/README.md
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
Custom Browser ES Module Loader
|
||||
===============================
|
||||
|
||||
This is a module loader using babel and the ES Module Loader polyfill.
|
||||
It's based heavily on
|
||||
https://github.com/ModuleLoader/browser-es-module-loader, but uses
|
||||
WebWorkers to compile the modules in the background.
|
||||
|
||||
To generate, run `rollup -c` in this directory, and then run `browserify
|
||||
src/babel-worker.js > dist/babel-worker.js`.
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
|
||||
MIT
|
23
static/js/novnc/vendor/browser-es-module-loader/src/babel-worker.js
vendored
Executable file
23
static/js/novnc/vendor/browser-es-module-loader/src/babel-worker.js
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
/*import { transform as babelTransform } from 'babel-core';
|
||||
import babelTransformDynamicImport from 'babel-plugin-syntax-dynamic-import';
|
||||
import babelTransformES2015ModulesSystemJS from 'babel-plugin-transform-es2015-modules-systemjs';*/
|
||||
|
||||
// sadly, due to how rollup works, we can't use es6 imports here
|
||||
var babelTransform = require('babel-core').transform;
|
||||
var babelTransformDynamicImport = require('babel-plugin-syntax-dynamic-import');
|
||||
var babelTransformES2015ModulesSystemJS = require('babel-plugin-transform-es2015-modules-systemjs');
|
||||
|
||||
self.onmessage = function (evt) {
|
||||
// transform source with Babel
|
||||
var output = babelTransform(evt.data.source, {
|
||||
compact: false,
|
||||
filename: evt.data.key + '!transpiled',
|
||||
sourceFileName: evt.data.key,
|
||||
moduleIds: false,
|
||||
sourceMaps: 'inline',
|
||||
babelrc: false,
|
||||
plugins: [babelTransformDynamicImport, babelTransformES2015ModulesSystemJS],
|
||||
});
|
||||
|
||||
self.postMessage({key: evt.data.key, code: output.code, source: evt.data.source});
|
||||
};
|
273
static/js/novnc/vendor/browser-es-module-loader/src/browser-es-module-loader.js
vendored
Executable file
273
static/js/novnc/vendor/browser-es-module-loader/src/browser-es-module-loader.js
vendored
Executable file
|
@ -0,0 +1,273 @@
|
|||
import RegisterLoader from 'es-module-loader/core/register-loader.js';
|
||||
import { InternalModuleNamespace as ModuleNamespace } from 'es-module-loader/core/loader-polyfill.js';
|
||||
|
||||
import { baseURI, global, isBrowser } from 'es-module-loader/core/common.js';
|
||||
import { resolveIfNotPlain } from 'es-module-loader/core/resolve.js';
|
||||
|
||||
var loader;
|
||||
|
||||
// <script type="module"> support
|
||||
var anonSources = {};
|
||||
if (typeof document != 'undefined' && document.getElementsByTagName) {
|
||||
var handleError = function(err) {
|
||||
// dispatch an error event so that we can display in errors in browsers
|
||||
// that don't yet support unhandledrejection
|
||||
if (window.onunhandledrejection === undefined) {
|
||||
try {
|
||||
var evt = new Event('error');
|
||||
} catch (_eventError) {
|
||||
var evt = document.createEvent('Event');
|
||||
evt.initEvent('error', true, true);
|
||||
}
|
||||
evt.message = err.message;
|
||||
if (err.fileName) {
|
||||
evt.filename = err.fileName;
|
||||
evt.lineno = err.lineNumber;
|
||||
evt.colno = err.columnNumber;
|
||||
} else if (err.sourceURL) {
|
||||
evt.filename = err.sourceURL;
|
||||
evt.lineno = err.line;
|
||||
evt.colno = err.column;
|
||||
}
|
||||
evt.error = err;
|
||||
window.dispatchEvent(evt);
|
||||
}
|
||||
|
||||
// throw so it still shows up in the console
|
||||
throw err;
|
||||
}
|
||||
|
||||
var ready = function() {
|
||||
document.removeEventListener('DOMContentLoaded', ready, false );
|
||||
|
||||
var anonCnt = 0;
|
||||
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var script = scripts[i];
|
||||
if (script.type == 'module' && !script.loaded) {
|
||||
script.loaded = true;
|
||||
if (script.src) {
|
||||
loader.import(script.src).catch(handleError);
|
||||
}
|
||||
// anonymous modules supported via a custom naming scheme and registry
|
||||
else {
|
||||
var uri = './<anon' + ++anonCnt + '>.js';
|
||||
if (script.id !== ""){
|
||||
uri = "./" + script.id;
|
||||
}
|
||||
|
||||
var anonName = resolveIfNotPlain(uri, baseURI);
|
||||
anonSources[anonName] = script.innerHTML;
|
||||
loader.import(anonName).catch(handleError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// simple DOM ready
|
||||
if (document.readyState === 'complete')
|
||||
setTimeout(ready);
|
||||
else
|
||||
document.addEventListener('DOMContentLoaded', ready, false);
|
||||
}
|
||||
|
||||
function BrowserESModuleLoader(baseKey) {
|
||||
if (baseKey)
|
||||
this.baseKey = resolveIfNotPlain(baseKey, baseURI) || resolveIfNotPlain('./' + baseKey, baseURI);
|
||||
|
||||
RegisterLoader.call(this);
|
||||
|
||||
var loader = this;
|
||||
|
||||
// ensure System.register is available
|
||||
global.System = global.System || {};
|
||||
if (typeof global.System.register == 'function')
|
||||
var prevRegister = global.System.register;
|
||||
global.System.register = function() {
|
||||
loader.register.apply(loader, arguments);
|
||||
if (prevRegister)
|
||||
prevRegister.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
BrowserESModuleLoader.prototype = Object.create(RegisterLoader.prototype);
|
||||
|
||||
// normalize is never given a relative name like "./x", that part is already handled
|
||||
BrowserESModuleLoader.prototype[RegisterLoader.resolve] = function(key, parent) {
|
||||
var resolved = RegisterLoader.prototype[RegisterLoader.resolve].call(this, key, parent || this.baseKey) || key;
|
||||
if (!resolved)
|
||||
throw new RangeError('ES module loader does not resolve plain module names, resolving "' + key + '" to ' + parent);
|
||||
|
||||
return resolved;
|
||||
};
|
||||
|
||||
function xhrFetch(url, resolve, reject) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
var load = function(source) {
|
||||
resolve(xhr.responseText);
|
||||
}
|
||||
var error = function() {
|
||||
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
|
||||
}
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4) {
|
||||
// in Chrome on file:/// URLs, status is 0
|
||||
if (xhr.status == 0) {
|
||||
if (xhr.responseText) {
|
||||
load();
|
||||
}
|
||||
else {
|
||||
// when responseText is empty, wait for load or error event
|
||||
// to inform if it is a 404 or empty file
|
||||
xhr.addEventListener('error', error);
|
||||
xhr.addEventListener('load', load);
|
||||
}
|
||||
}
|
||||
else if (xhr.status === 200) {
|
||||
load();
|
||||
}
|
||||
else {
|
||||
error();
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.open("GET", url, true);
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
var WorkerPool = function (script, size) {
|
||||
var current = document.currentScript;
|
||||
// IE doesn't support currentScript
|
||||
if (!current) {
|
||||
// We should be the last loaded script
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
current = scripts[scripts.length - 1];
|
||||
}
|
||||
script = current.src.substr(0, current.src.lastIndexOf("/")) + "/" + script;
|
||||
this._workers = new Array(size);
|
||||
this._ind = 0;
|
||||
this._size = size;
|
||||
this._jobs = 0;
|
||||
this.onmessage = undefined;
|
||||
this._stopTimeout = undefined;
|
||||
for (var i = 0; i < size; i++) {
|
||||
var wrkr = new Worker(script);
|
||||
wrkr._count = 0;
|
||||
wrkr._ind = i;
|
||||
wrkr.onmessage = this._onmessage.bind(this, wrkr);
|
||||
wrkr.onerror = this._onerror.bind(this);
|
||||
this._workers[i] = wrkr;
|
||||
}
|
||||
|
||||
this._checkJobs();
|
||||
};
|
||||
WorkerPool.prototype = {
|
||||
postMessage: function (msg) {
|
||||
if (this._stopTimeout !== undefined) {
|
||||
clearTimeout(this._stopTimeout);
|
||||
this._stopTimeout = undefined;
|
||||
}
|
||||
var wrkr = this._workers[this._ind % this._size];
|
||||
wrkr._count++;
|
||||
this._jobs++;
|
||||
wrkr.postMessage(msg);
|
||||
this._ind++;
|
||||
},
|
||||
|
||||
_onmessage: function (wrkr, evt) {
|
||||
wrkr._count--;
|
||||
this._jobs--;
|
||||
this.onmessage(evt, wrkr);
|
||||
this._checkJobs();
|
||||
},
|
||||
|
||||
_onerror: function(err) {
|
||||
try {
|
||||
var evt = new Event('error');
|
||||
} catch (_eventError) {
|
||||
var evt = document.createEvent('Event');
|
||||
evt.initEvent('error', true, true);
|
||||
}
|
||||
evt.message = err.message;
|
||||
evt.filename = err.filename;
|
||||
evt.lineno = err.lineno;
|
||||
evt.colno = err.colno;
|
||||
evt.error = err.error;
|
||||
window.dispatchEvent(evt);
|
||||
},
|
||||
|
||||
_checkJobs: function () {
|
||||
if (this._jobs === 0 && this._stopTimeout === undefined) {
|
||||
// wait for 2s of inactivity before stopping (that should be enough for local loading)
|
||||
this._stopTimeout = setTimeout(this._stop.bind(this), 2000);
|
||||
}
|
||||
},
|
||||
|
||||
_stop: function () {
|
||||
this._workers.forEach(function(wrkr) {
|
||||
wrkr.terminate();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var promiseMap = new Map();
|
||||
var babelWorker = new WorkerPool('babel-worker.js', 3);
|
||||
babelWorker.onmessage = function (evt) {
|
||||
var promFuncs = promiseMap.get(evt.data.key);
|
||||
promFuncs.resolve(evt.data);
|
||||
promiseMap.delete(evt.data.key);
|
||||
};
|
||||
|
||||
// instantiate just needs to run System.register
|
||||
// so we fetch the source, convert into the Babel System module format, then evaluate it
|
||||
BrowserESModuleLoader.prototype[RegisterLoader.instantiate] = function(key, processAnonRegister) {
|
||||
var loader = this;
|
||||
|
||||
// load as ES with Babel converting into System.register
|
||||
return new Promise(function(resolve, reject) {
|
||||
// anonymous module
|
||||
if (anonSources[key]) {
|
||||
resolve(anonSources[key])
|
||||
anonSources[key] = undefined;
|
||||
}
|
||||
// otherwise we fetch
|
||||
else {
|
||||
xhrFetch(key, resolve, reject);
|
||||
}
|
||||
})
|
||||
.then(function(source) {
|
||||
// check our cache first
|
||||
var cacheEntry = localStorage.getItem(key);
|
||||
if (cacheEntry) {
|
||||
cacheEntry = JSON.parse(cacheEntry);
|
||||
// TODO: store a hash instead
|
||||
if (cacheEntry.source === source) {
|
||||
return Promise.resolve({key: key, code: cacheEntry.code, source: cacheEntry.source});
|
||||
}
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
promiseMap.set(key, {resolve: resolve, reject: reject});
|
||||
babelWorker.postMessage({key: key, source: source});
|
||||
});
|
||||
}).then(function (data) {
|
||||
// evaluate without require, exports and module variables
|
||||
// we leave module in for now to allow module.require access
|
||||
try {
|
||||
var cacheEntry = JSON.stringify({source: data.source, code: data.code});
|
||||
localStorage.setItem(key, cacheEntry);
|
||||
} catch (e) {
|
||||
if (window.console) {
|
||||
window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
|
||||
}
|
||||
}
|
||||
(0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
|
||||
processAnonRegister();
|
||||
});
|
||||
};
|
||||
|
||||
// create a default loader instance in the browser
|
||||
if (isBrowser)
|
||||
loader = new BrowserESModuleLoader();
|
||||
|
||||
export default BrowserESModuleLoader;
|
21
static/js/novnc/vendor/pako/LICENSE
vendored
Executable file
21
static/js/novnc/vendor/pako/LICENSE
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (C) 2014-2016 by Vitaly Puzrin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
6
static/js/novnc/vendor/pako/README.md
vendored
Executable file
6
static/js/novnc/vendor/pako/README.md
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
This is an ES6-modules-compatible version of
|
||||
https://github.com/nodeca/pako, based on pako version 1.0.3.
|
||||
|
||||
It's more-or-less a direct translation of the original, with unused parts
|
||||
removed, and the dynamic support for non-typed arrays removed (since ES6
|
||||
modules don't work well with dynamic exports).
|
29
static/js/novnc/vendor/pako/lib/utils/common.js
vendored
29
static/js/novnc/vendor/pako/lib/utils/common.js
vendored
|
@ -1,24 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.shrinkBuf = shrinkBuf;
|
||||
exports.arraySet = arraySet;
|
||||
exports.flattenChunks = flattenChunks;
|
||||
// reduce buffer size, avoiding mem copy
|
||||
function shrinkBuf(buf, size) {
|
||||
if (buf.length === size) {
|
||||
return buf;
|
||||
}
|
||||
if (buf.subarray) {
|
||||
return buf.subarray(0, size);
|
||||
}
|
||||
export function shrinkBuf (buf, size) {
|
||||
if (buf.length === size) { return buf; }
|
||||
if (buf.subarray) { return buf.subarray(0, size); }
|
||||
buf.length = size;
|
||||
return buf;
|
||||
};
|
||||
|
||||
function arraySet(dest, src, src_offs, len, dest_offs) {
|
||||
|
||||
export function arraySet (dest, src, src_offs, len, dest_offs) {
|
||||
if (src.subarray && dest.subarray) {
|
||||
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
|
||||
return;
|
||||
|
@ -30,7 +19,7 @@ function arraySet(dest, src, src_offs, len, dest_offs) {
|
|||
}
|
||||
|
||||
// Join array of chunks to single array.
|
||||
function flattenChunks(chunks) {
|
||||
export function flattenChunks (chunks) {
|
||||
var i, l, len, pos, chunk, result;
|
||||
|
||||
// calculate data length
|
||||
|
@ -51,6 +40,6 @@ function flattenChunks(chunks) {
|
|||
return result;
|
||||
}
|
||||
|
||||
var Buf8 = exports.Buf8 = Uint8Array;
|
||||
var Buf16 = exports.Buf16 = Uint16Array;
|
||||
var Buf32 = exports.Buf32 = Int32Array;
|
||||
export var Buf8 = Uint8Array;
|
||||
export var Buf16 = Uint16Array;
|
||||
export var Buf32 = Int32Array;
|
||||
|
|
18
static/js/novnc/vendor/pako/lib/zlib/adler32.js
vendored
18
static/js/novnc/vendor/pako/lib/zlib/adler32.js
vendored
|
@ -1,16 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = adler32;
|
||||
// Note: adler32 takes 12% for level 0 and 2% for level 6.
|
||||
// It doesn't worth to make additional optimizationa as in original.
|
||||
// Small size is preferable.
|
||||
|
||||
function adler32(adler, buf, len, pos) {
|
||||
var s1 = adler & 0xffff | 0,
|
||||
s2 = adler >>> 16 & 0xffff | 0,
|
||||
export default function adler32(adler, buf, len, pos) {
|
||||
var s1 = (adler & 0xffff) |0,
|
||||
s2 = ((adler >>> 16) & 0xffff) |0,
|
||||
n = 0;
|
||||
|
||||
while (len !== 0) {
|
||||
|
@ -21,13 +15,13 @@ function adler32(adler, buf, len, pos) {
|
|||
len -= n;
|
||||
|
||||
do {
|
||||
s1 = s1 + buf[pos++] | 0;
|
||||
s2 = s2 + s1 | 0;
|
||||
s1 = (s1 + buf[pos++]) |0;
|
||||
s2 = (s2 + s1) |0;
|
||||
} while (--n);
|
||||
|
||||
s1 %= 65521;
|
||||
s2 %= 65521;
|
||||
}
|
||||
|
||||
return s1 | s2 << 16 | 0;
|
||||
return (s1 | (s2 << 16)) |0;
|
||||
}
|
|
@ -1,9 +1,4 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = {
|
||||
export default {
|
||||
|
||||
/* Allowed flush values; see deflate() and inflate() below for details */
|
||||
Z_NO_FLUSH: 0,
|
||||
|
@ -33,6 +28,7 @@ exports.default = {
|
|||
Z_BEST_COMPRESSION: 9,
|
||||
Z_DEFAULT_COMPRESSION: -1,
|
||||
|
||||
|
||||
Z_FILTERED: 1,
|
||||
Z_HUFFMAN_ONLY: 2,
|
||||
Z_RLE: 3,
|
||||
|
|
18
static/js/novnc/vendor/pako/lib/zlib/crc32.js
vendored
18
static/js/novnc/vendor/pako/lib/zlib/crc32.js
vendored
|
@ -1,23 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeTable;
|
||||
// Note: we can't get significant speed boost here.
|
||||
// So write code to minimize size - no pregenerated tables
|
||||
// and array tools dependencies.
|
||||
|
||||
|
||||
// Use ordinary array, since untyped makes no boost here
|
||||
function makeTable() {
|
||||
var c,
|
||||
table = [];
|
||||
export default function makeTable() {
|
||||
var c, table = [];
|
||||
|
||||
for (var n = 0; n < 256; n++) {
|
||||
c = n;
|
||||
for (var k = 0; k < 8; k++) {
|
||||
c = c & 1 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;
|
||||
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
||||
}
|
||||
table[n] = c;
|
||||
}
|
||||
|
@ -28,6 +21,7 @@ function makeTable() {
|
|||
// Create table on load. Just 255 signed longs. Not a problem.
|
||||
var crcTable = makeTable();
|
||||
|
||||
|
||||
function crc32(crc, buf, len, pos) {
|
||||
var t = crcTable,
|
||||
end = pos + len;
|
||||
|
@ -35,8 +29,8 @@ function crc32(crc, buf, len, pos) {
|
|||
crc ^= -1;
|
||||
|
||||
for (var i = pos; i < end; i++) {
|
||||
crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 0xFF];
|
||||
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
|
||||
}
|
||||
|
||||
return crc ^ -1; // >>> 0;
|
||||
return (crc ^ (-1)); // >>> 0;
|
||||
}
|
350
static/js/novnc/vendor/pako/lib/zlib/deflate.js
vendored
350
static/js/novnc/vendor/pako/lib/zlib/deflate.js
vendored
|
@ -1,37 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.deflateInfo = exports.deflateSetDictionary = exports.deflateEnd = exports.deflate = exports.deflateSetHeader = exports.deflateResetKeep = exports.deflateReset = exports.deflateInit2 = exports.deflateInit = undefined;
|
||||
|
||||
var _common = require("../utils/common.js");
|
||||
|
||||
var utils = _interopRequireWildcard(_common);
|
||||
|
||||
var _trees = require("./trees.js");
|
||||
|
||||
var trees = _interopRequireWildcard(_trees);
|
||||
|
||||
var _adler = require("./adler32.js");
|
||||
|
||||
var _adler2 = _interopRequireDefault(_adler);
|
||||
|
||||
var _crc = require("./crc32.js");
|
||||
|
||||
var _crc2 = _interopRequireDefault(_crc);
|
||||
|
||||
var _messages = require("./messages.js");
|
||||
|
||||
var _messages2 = _interopRequireDefault(_messages);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
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 utils from "../utils/common.js";
|
||||
import * as trees from "./trees.js";
|
||||
import adler32 from "./adler32.js";
|
||||
import crc32 from "./crc32.js";
|
||||
import msg from "./messages.js";
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
||||
|
||||
/* Allowed flush values; see deflate() and inflate() below for details */
|
||||
var Z_NO_FLUSH = 0;
|
||||
var Z_PARTIAL_FLUSH = 1;
|
||||
|
@ -62,6 +38,7 @@ var Z_BUF_ERROR = -5;
|
|||
//var Z_BEST_COMPRESSION = 9;
|
||||
var Z_DEFAULT_COMPRESSION = -1;
|
||||
|
||||
|
||||
var Z_FILTERED = 1;
|
||||
var Z_HUFFMAN_ONLY = 2;
|
||||
var Z_RLE = 3;
|
||||
|
@ -74,17 +51,20 @@ var Z_DEFAULT_STRATEGY = 0;
|
|||
//var Z_ASCII = 1; // = Z_TEXT
|
||||
var Z_UNKNOWN = 2;
|
||||
|
||||
|
||||
/* The deflate compression method */
|
||||
var Z_DEFLATED = 8;
|
||||
|
||||
/*============================================================================*/
|
||||
|
||||
|
||||
var MAX_MEM_LEVEL = 9;
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
var MAX_WBITS = 15;
|
||||
/* 32K LZ77 window */
|
||||
var DEF_MEM_LEVEL = 8;
|
||||
|
||||
|
||||
var LENGTH_CODES = 29;
|
||||
/* number of length codes, not counting the special END_BLOCK code */
|
||||
var LITERALS = 256;
|
||||
|
@ -102,7 +82,7 @@ var MAX_BITS = 15;
|
|||
|
||||
var MIN_MATCH = 3;
|
||||
var MAX_MATCH = 258;
|
||||
var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;
|
||||
var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
|
||||
|
||||
var PRESET_DICT = 0x20;
|
||||
|
||||
|
@ -122,19 +102,16 @@ var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
|
|||
var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
||||
|
||||
function err(strm, errorCode) {
|
||||
strm.msg = _messages2.default[errorCode];
|
||||
strm.msg = msg[errorCode];
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
function rank(f) {
|
||||
return (f << 1) - (f > 4 ? 9 : 0);
|
||||
return ((f) << 1) - ((f) > 4 ? 9 : 0);
|
||||
}
|
||||
|
||||
function zero(buf) {
|
||||
var len = buf.length;while (--len >= 0) {
|
||||
buf[len] = 0;
|
||||
}
|
||||
}
|
||||
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
||||
|
||||
|
||||
/* =========================================================================
|
||||
* Flush as much pending output as possible. All deflate() output goes
|
||||
|
@ -150,9 +127,7 @@ function flush_pending(strm) {
|
|||
if (len > strm.avail_out) {
|
||||
len = strm.avail_out;
|
||||
}
|
||||
if (len === 0) {
|
||||
return;
|
||||
}
|
||||
if (len === 0) { return; }
|
||||
|
||||
utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
|
||||
strm.next_out += len;
|
||||
|
@ -165,16 +140,19 @@ function flush_pending(strm) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function flush_block_only(s, last) {
|
||||
trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last);
|
||||
trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
|
||||
s.block_start = s.strstart;
|
||||
flush_pending(s.strm);
|
||||
}
|
||||
|
||||
|
||||
function put_byte(s, b) {
|
||||
s.pending_buf[s.pending++] = b;
|
||||
}
|
||||
|
||||
|
||||
/* =========================================================================
|
||||
* Put a short in the pending buffer. The 16-bit value is put in MSB order.
|
||||
* IN assertion: the stream state is correct and there is enough room in
|
||||
|
@ -183,10 +161,11 @@ function put_byte(s, b) {
|
|||
function putShortMSB(s, b) {
|
||||
// put_byte(s, (Byte)(b >> 8));
|
||||
// put_byte(s, (Byte)(b & 0xff));
|
||||
s.pending_buf[s.pending++] = b >>> 8 & 0xff;
|
||||
s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
|
||||
s.pending_buf[s.pending++] = b & 0xff;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Read a new buffer from the current input stream, update the adler32
|
||||
* and total number of bytes read. All deflate() input goes through
|
||||
|
@ -197,21 +176,19 @@ function putShortMSB(s, b) {
|
|||
function read_buf(strm, buf, start, size) {
|
||||
var len = strm.avail_in;
|
||||
|
||||
if (len > size) {
|
||||
len = size;
|
||||
}
|
||||
if (len === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (len > size) { len = size; }
|
||||
if (len === 0) { return 0; }
|
||||
|
||||
strm.avail_in -= len;
|
||||
|
||||
// zmemcpy(buf, strm->next_in, len);
|
||||
utils.arraySet(buf, strm.input, strm.next_in, len, start);
|
||||
if (strm.state.wrap === 1) {
|
||||
strm.adler = (0, _adler2.default)(strm.adler, buf, len, start);
|
||||
} else if (strm.state.wrap === 2) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, buf, len, start);
|
||||
strm.adler = adler32(strm.adler, buf, len, start);
|
||||
}
|
||||
|
||||
else if (strm.state.wrap === 2) {
|
||||
strm.adler = crc32(strm.adler, buf, len, start);
|
||||
}
|
||||
|
||||
strm.next_in += len;
|
||||
|
@ -220,6 +197,7 @@ function read_buf(strm, buf, start, size) {
|
|||
return len;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Set match_start to the longest match starting at the given string and
|
||||
* return its length. Matches shorter or equal to prev_length are discarded,
|
||||
|
@ -236,7 +214,8 @@ function longest_match(s, cur_match) {
|
|||
var len; /* length of current match */
|
||||
var best_len = s.prev_length; /* best match length so far */
|
||||
var nice_match = s.nice_match; /* stop if match long enough */
|
||||
var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0 /*NIL*/;
|
||||
var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
|
||||
s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;
|
||||
|
||||
var _win = s.window; // shortcut
|
||||
|
||||
|
@ -263,9 +242,7 @@ function longest_match(s, cur_match) {
|
|||
/* Do not look for matches beyond the end of the input. This is necessary
|
||||
* to make deflate deterministic.
|
||||
*/
|
||||
if (nice_match > s.lookahead) {
|
||||
nice_match = s.lookahead;
|
||||
}
|
||||
if (nice_match > s.lookahead) { nice_match = s.lookahead; }
|
||||
|
||||
// Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
|
||||
|
||||
|
@ -282,7 +259,10 @@ function longest_match(s, cur_match) {
|
|||
* the output of deflate is not affected by the uninitialized values.
|
||||
*/
|
||||
|
||||
if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) {
|
||||
if (_win[match + best_len] !== scan_end ||
|
||||
_win[match + best_len - 1] !== scan_end1 ||
|
||||
_win[match] !== _win[scan] ||
|
||||
_win[++match] !== _win[scan + 1]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -301,7 +281,11 @@ function longest_match(s, cur_match) {
|
|||
*/
|
||||
do {
|
||||
// Do nothing
|
||||
} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);
|
||||
} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
||||
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
||||
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
||||
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
||||
scan < strend);
|
||||
|
||||
// Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
||||
|
||||
|
@ -325,6 +309,7 @@ function longest_match(s, cur_match) {
|
|||
return s.lookahead;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Fill the window when the lookahead becomes insufficient.
|
||||
* Updates strstart and lookahead.
|
||||
|
@ -381,14 +366,14 @@ function fill_window(s) {
|
|||
p = n;
|
||||
do {
|
||||
m = s.head[--p];
|
||||
s.head[p] = m >= _w_size ? m - _w_size : 0;
|
||||
s.head[p] = (m >= _w_size ? m - _w_size : 0);
|
||||
} while (--n);
|
||||
|
||||
n = _w_size;
|
||||
p = n;
|
||||
do {
|
||||
m = s.prev[--p];
|
||||
s.prev[p] = m >= _w_size ? m - _w_size : 0;
|
||||
s.prev[p] = (m >= _w_size ? m - _w_size : 0);
|
||||
/* If n is not on any hash chain, prev[n] is garbage but
|
||||
* its value will never be used.
|
||||
*/
|
||||
|
@ -421,13 +406,13 @@ function fill_window(s) {
|
|||
s.ins_h = s.window[str];
|
||||
|
||||
/* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
|
||||
//#if MIN_MATCH != 3
|
||||
// Call update_hash() MIN_MATCH-3 more times
|
||||
//#endif
|
||||
while (s.insert) {
|
||||
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
||||
|
||||
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
||||
s.head[s.ins_h] = str;
|
||||
|
@ -441,6 +426,7 @@ function fill_window(s) {
|
|||
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
||||
* but this is not important since only literal bytes will be emitted.
|
||||
*/
|
||||
|
||||
} while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
|
||||
|
||||
/* If the WIN_INIT bytes after the end of the current data have never been
|
||||
|
@ -541,11 +527,13 @@ function deflate_stored(s, flush) {
|
|||
return BS_NEED_MORE;
|
||||
}
|
||||
/***/
|
||||
|
||||
|
||||
}
|
||||
/* Flush if we may have to slide, otherwise block_start may become
|
||||
* negative and the data will be gone:
|
||||
*/
|
||||
if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {
|
||||
if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {
|
||||
/*** FLUSH_BLOCK(s, 0); ***/
|
||||
flush_block_only(s, false);
|
||||
if (s.strm.avail_out === 0) {
|
||||
|
@ -612,7 +600,7 @@ function deflate_fast(s, flush) {
|
|||
hash_head = 0/*NIL*/;
|
||||
if (s.lookahead >= MIN_MATCH) {
|
||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||
s.head[s.ins_h] = s.strstart;
|
||||
/***/
|
||||
|
@ -621,7 +609,7 @@ function deflate_fast(s, flush) {
|
|||
/* Find the longest match, discarding those <= prev_length.
|
||||
* At this point we have always match_length < MIN_MATCH
|
||||
*/
|
||||
if (hash_head !== 0 /*NIL*/ && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {
|
||||
if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
|
||||
/* To simplify the code, we prevent matches with the string
|
||||
* of window index 0 (in particular we have to avoid a match
|
||||
* of the string with itself at the start of the input file).
|
||||
|
@ -646,7 +634,7 @@ function deflate_fast(s, flush) {
|
|||
do {
|
||||
s.strstart++;
|
||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||
s.head[s.ins_h] = s.strstart;
|
||||
/***/
|
||||
|
@ -655,12 +643,13 @@ function deflate_fast(s, flush) {
|
|||
*/
|
||||
} while (--s.match_length !== 0);
|
||||
s.strstart++;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
s.strstart += s.match_length;
|
||||
s.match_length = 0;
|
||||
s.ins_h = s.window[s.strstart];
|
||||
/* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
|
||||
|
||||
//#if MIN_MATCH != 3
|
||||
// Call UPDATE_HASH() MIN_MATCH-3 more times
|
||||
|
@ -687,7 +676,7 @@ function deflate_fast(s, flush) {
|
|||
/***/
|
||||
}
|
||||
}
|
||||
s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
|
||||
s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
|
||||
if (flush === Z_FINISH) {
|
||||
/*** FLUSH_BLOCK(s, 1); ***/
|
||||
flush_block_only(s, true);
|
||||
|
@ -731,9 +720,7 @@ function deflate_slow(s, flush) {
|
|||
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
||||
return BS_NEED_MORE;
|
||||
}
|
||||
if (s.lookahead === 0) {
|
||||
break;
|
||||
} /* flush the current block */
|
||||
if (s.lookahead === 0) { break; } /* flush the current block */
|
||||
}
|
||||
|
||||
/* Insert the string window[strstart .. strstart+2] in the
|
||||
|
@ -742,7 +729,7 @@ function deflate_slow(s, flush) {
|
|||
hash_head = 0/*NIL*/;
|
||||
if (s.lookahead >= MIN_MATCH) {
|
||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||
s.head[s.ins_h] = s.strstart;
|
||||
/***/
|
||||
|
@ -754,7 +741,8 @@ function deflate_slow(s, flush) {
|
|||
s.prev_match = s.match_start;
|
||||
s.match_length = MIN_MATCH - 1;
|
||||
|
||||
if (hash_head !== 0 /*NIL*/ && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD /*MAX_DIST(s)*/) {
|
||||
if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&
|
||||
s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {
|
||||
/* To simplify the code, we prevent matches with the string
|
||||
* of window index 0 (in particular we have to avoid a match
|
||||
* of the string with itself at the start of the input file).
|
||||
|
@ -762,7 +750,8 @@ function deflate_slow(s, flush) {
|
|||
s.match_length = longest_match(s, hash_head);
|
||||
/* longest_match() sets match_start */
|
||||
|
||||
if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096 /*TOO_FAR*/)) {
|
||||
if (s.match_length <= 5 &&
|
||||
(s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {
|
||||
|
||||
/* If prev_match is also MIN_MATCH, match_start is garbage
|
||||
* but we will ignore the current match anyway.
|
||||
|
@ -792,7 +781,7 @@ function deflate_slow(s, flush) {
|
|||
do {
|
||||
if (++s.strstart <= max_insert) {
|
||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
||||
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||
s.head[s.ins_h] = s.strstart;
|
||||
/***/
|
||||
|
@ -810,6 +799,7 @@ function deflate_slow(s, flush) {
|
|||
}
|
||||
/***/
|
||||
}
|
||||
|
||||
} else if (s.match_available) {
|
||||
/* If there was no match at the previous position, output a
|
||||
* single literal. If there was a match but the current match
|
||||
|
@ -868,6 +858,7 @@ function deflate_slow(s, flush) {
|
|||
return BS_BLOCK_DONE;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
|
||||
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
||||
|
@ -890,9 +881,7 @@ function deflate_rle(s, flush) {
|
|||
if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
|
||||
return BS_NEED_MORE;
|
||||
}
|
||||
if (s.lookahead === 0) {
|
||||
break;
|
||||
} /* flush the current block */
|
||||
if (s.lookahead === 0) { break; } /* flush the current block */
|
||||
}
|
||||
|
||||
/* See how many times the previous byte repeats */
|
||||
|
@ -904,7 +893,11 @@ function deflate_rle(s, flush) {
|
|||
strend = s.strstart + MAX_MATCH;
|
||||
do {
|
||||
// Do nothing
|
||||
} while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);
|
||||
} while (prev === _win[++scan] && prev === _win[++scan] &&
|
||||
prev === _win[++scan] && prev === _win[++scan] &&
|
||||
prev === _win[++scan] && prev === _win[++scan] &&
|
||||
prev === _win[++scan] && prev === _win[++scan] &&
|
||||
scan < strend);
|
||||
s.match_length = MAX_MATCH - (strend - scan);
|
||||
if (s.match_length > s.lookahead) {
|
||||
s.match_length = s.lookahead;
|
||||
|
@ -1048,6 +1041,7 @@ new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
|
|||
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
|
||||
];
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Initialize the "longest match" routines for a new zlib stream
|
||||
*/
|
||||
|
@ -1073,6 +1067,7 @@ function lm_init(s) {
|
|||
s.ins_h = 0;
|
||||
}
|
||||
|
||||
|
||||
function DeflateState() {
|
||||
this.strm = null; /* pointer back to this zlib stream */
|
||||
this.status = 0; /* as the name implies */
|
||||
|
@ -1241,6 +1236,7 @@ function DeflateState() {
|
|||
this.matches = 0; /* number of string matches in current block */
|
||||
this.insert = 0; /* bytes at end of window left to insert */
|
||||
|
||||
|
||||
this.bi_buf = 0;
|
||||
/* Output buffer. bits are inserted starting at the bottom (least
|
||||
* significant bits).
|
||||
|
@ -1260,6 +1256,7 @@ function DeflateState() {
|
|||
*/
|
||||
}
|
||||
|
||||
|
||||
function deflateResetKeep(strm) {
|
||||
var s;
|
||||
|
||||
|
@ -1278,14 +1275,17 @@ function deflateResetKeep(strm) {
|
|||
s.wrap = -s.wrap;
|
||||
/* was made negative by deflate(..., Z_FINISH); */
|
||||
}
|
||||
s.status = s.wrap ? INIT_STATE : BUSY_STATE;
|
||||
strm.adler = s.wrap === 2 ? 0 // crc32(0, Z_NULL, 0)
|
||||
: 1; // adler32(0, Z_NULL, 0)
|
||||
s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
|
||||
strm.adler = (s.wrap === 2) ?
|
||||
0 // crc32(0, Z_NULL, 0)
|
||||
:
|
||||
1; // adler32(0, Z_NULL, 0)
|
||||
s.last_flush = Z_NO_FLUSH;
|
||||
trees._tr_init(s);
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
|
||||
function deflateReset(strm) {
|
||||
var ret = deflateResetKeep(strm);
|
||||
if (ret === Z_OK) {
|
||||
|
@ -1294,20 +1294,17 @@ function deflateReset(strm) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
function deflateSetHeader(strm, head) {
|
||||
if (!strm || !strm.state) {
|
||||
return Z_STREAM_ERROR;
|
||||
}
|
||||
if (strm.state.wrap !== 2) {
|
||||
return Z_STREAM_ERROR;
|
||||
}
|
||||
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
||||
if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
|
||||
strm.state.gzhead = head;
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
|
||||
function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
||||
if (!strm) {
|
||||
// === Z_NULL
|
||||
if (!strm) { // === Z_NULL
|
||||
return Z_STREAM_ERROR;
|
||||
}
|
||||
var wrap = 1;
|
||||
|
@ -1316,19 +1313,24 @@ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
|||
level = 6;
|
||||
}
|
||||
|
||||
if (windowBits < 0) {
|
||||
/* suppress zlib wrapper */
|
||||
if (windowBits < 0) { /* suppress zlib wrapper */
|
||||
wrap = 0;
|
||||
windowBits = -windowBits;
|
||||
} else if (windowBits > 15) {
|
||||
}
|
||||
|
||||
else if (windowBits > 15) {
|
||||
wrap = 2; /* write gzip wrapper instead */
|
||||
windowBits -= 16;
|
||||
}
|
||||
|
||||
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
|
||||
|
||||
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
|
||||
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
|
||||
strategy < 0 || strategy > Z_FIXED) {
|
||||
return err(strm, Z_STREAM_ERROR);
|
||||
}
|
||||
|
||||
|
||||
if (windowBits === 8) {
|
||||
windowBits = 9;
|
||||
}
|
||||
|
@ -1357,7 +1359,7 @@ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
|||
// Don't need mem init magic for JS.
|
||||
//s.high_water = 0; /* nothing written to s->window yet */
|
||||
|
||||
s.lit_bufsize = 1 << memLevel + 6; /* 16K elements by default */
|
||||
s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
||||
|
||||
s.pending_buf_size = s.lit_bufsize * 4;
|
||||
|
||||
|
@ -1383,18 +1385,22 @@ function deflateInit(strm, level) {
|
|||
return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
||||
}
|
||||
|
||||
|
||||
function deflate(strm, flush) {
|
||||
var old_flush, s;
|
||||
var beg, val; // for gzip header write only
|
||||
|
||||
if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) {
|
||||
if (!strm || !strm.state ||
|
||||
flush > Z_BLOCK || flush < 0) {
|
||||
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
|
||||
}
|
||||
|
||||
s = strm.state;
|
||||
|
||||
if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH) {
|
||||
return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR);
|
||||
if (!strm.output ||
|
||||
(!strm.input && strm.avail_in !== 0) ||
|
||||
(s.status === FINISH_STATE && flush !== Z_FINISH)) {
|
||||
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
|
||||
}
|
||||
|
||||
s.strm = strm; /* just in case */
|
||||
|
@ -1404,43 +1410,52 @@ function deflate(strm, flush) {
|
|||
/* Write the header */
|
||||
if (s.status === INIT_STATE) {
|
||||
|
||||
if (s.wrap === 2) {
|
||||
// GZIP header
|
||||
if (s.wrap === 2) { // GZIP header
|
||||
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
||||
put_byte(s, 31);
|
||||
put_byte(s, 139);
|
||||
put_byte(s, 8);
|
||||
if (!s.gzhead) {
|
||||
// s->gzhead == Z_NULL
|
||||
if (!s.gzhead) { // s->gzhead == Z_NULL
|
||||
put_byte(s, 0);
|
||||
put_byte(s, 0);
|
||||
put_byte(s, 0);
|
||||
put_byte(s, 0);
|
||||
put_byte(s, 0);
|
||||
put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
|
||||
put_byte(s, s.level === 9 ? 2 :
|
||||
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
||||
4 : 0));
|
||||
put_byte(s, OS_CODE);
|
||||
s.status = BUSY_STATE;
|
||||
} else {
|
||||
put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16));
|
||||
}
|
||||
else {
|
||||
put_byte(s, (s.gzhead.text ? 1 : 0) +
|
||||
(s.gzhead.hcrc ? 2 : 0) +
|
||||
(!s.gzhead.extra ? 0 : 4) +
|
||||
(!s.gzhead.name ? 0 : 8) +
|
||||
(!s.gzhead.comment ? 0 : 16)
|
||||
);
|
||||
put_byte(s, s.gzhead.time & 0xff);
|
||||
put_byte(s, s.gzhead.time >> 8 & 0xff);
|
||||
put_byte(s, s.gzhead.time >> 16 & 0xff);
|
||||
put_byte(s, s.gzhead.time >> 24 & 0xff);
|
||||
put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
|
||||
put_byte(s, (s.gzhead.time >> 8) & 0xff);
|
||||
put_byte(s, (s.gzhead.time >> 16) & 0xff);
|
||||
put_byte(s, (s.gzhead.time >> 24) & 0xff);
|
||||
put_byte(s, s.level === 9 ? 2 :
|
||||
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
||||
4 : 0));
|
||||
put_byte(s, s.gzhead.os & 0xff);
|
||||
if (s.gzhead.extra && s.gzhead.extra.length) {
|
||||
put_byte(s, s.gzhead.extra.length & 0xff);
|
||||
put_byte(s, s.gzhead.extra.length >> 8 & 0xff);
|
||||
put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
|
||||
}
|
||||
if (s.gzhead.hcrc) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, s.pending_buf, s.pending, 0);
|
||||
strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
|
||||
}
|
||||
s.gzindex = 0;
|
||||
s.status = EXTRA_STATE;
|
||||
}
|
||||
} else // DEFLATE header
|
||||
}
|
||||
else // DEFLATE header
|
||||
{
|
||||
var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8;
|
||||
var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
|
||||
var level_flags = -1;
|
||||
|
||||
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
||||
|
@ -1452,11 +1467,9 @@ function deflate(strm, flush) {
|
|||
} else {
|
||||
level_flags = 3;
|
||||
}
|
||||
header |= level_flags << 6;
|
||||
if (s.strstart !== 0) {
|
||||
header |= PRESET_DICT;
|
||||
}
|
||||
header += 31 - header % 31;
|
||||
header |= (level_flags << 6);
|
||||
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
||||
header += 31 - (header % 31);
|
||||
|
||||
s.status = BUSY_STATE;
|
||||
putShortMSB(s, header);
|
||||
|
@ -1478,7 +1491,7 @@ function deflate(strm, flush) {
|
|||
while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
|
||||
if (s.pending === s.pending_buf_size) {
|
||||
if (s.gzhead.hcrc && s.pending > beg) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
}
|
||||
flush_pending(strm);
|
||||
beg = s.pending;
|
||||
|
@ -1490,13 +1503,14 @@ function deflate(strm, flush) {
|
|||
s.gzindex++;
|
||||
}
|
||||
if (s.gzhead.hcrc && s.pending > beg) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
}
|
||||
if (s.gzindex === s.gzhead.extra.length) {
|
||||
s.gzindex = 0;
|
||||
s.status = NAME_STATE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
s.status = NAME_STATE;
|
||||
}
|
||||
}
|
||||
|
@ -1508,7 +1522,7 @@ function deflate(strm, flush) {
|
|||
do {
|
||||
if (s.pending === s.pending_buf_size) {
|
||||
if (s.gzhead.hcrc && s.pending > beg) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
}
|
||||
flush_pending(strm);
|
||||
beg = s.pending;
|
||||
|
@ -1527,13 +1541,14 @@ function deflate(strm, flush) {
|
|||
} while (val !== 0);
|
||||
|
||||
if (s.gzhead.hcrc && s.pending > beg) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
}
|
||||
if (val === 0) {
|
||||
s.gzindex = 0;
|
||||
s.status = COMMENT_STATE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
s.status = COMMENT_STATE;
|
||||
}
|
||||
}
|
||||
|
@ -1545,7 +1560,7 @@ function deflate(strm, flush) {
|
|||
do {
|
||||
if (s.pending === s.pending_buf_size) {
|
||||
if (s.gzhead.hcrc && s.pending > beg) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
}
|
||||
flush_pending(strm);
|
||||
beg = s.pending;
|
||||
|
@ -1564,12 +1579,13 @@ function deflate(strm, flush) {
|
|||
} while (val !== 0);
|
||||
|
||||
if (s.gzhead.hcrc && s.pending > beg) {
|
||||
strm.adler = (0, _crc2.default)(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
||||
}
|
||||
if (val === 0) {
|
||||
s.status = HCRC_STATE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
s.status = HCRC_STATE;
|
||||
}
|
||||
}
|
||||
|
@ -1580,11 +1596,12 @@ function deflate(strm, flush) {
|
|||
}
|
||||
if (s.pending + 2 <= s.pending_buf_size) {
|
||||
put_byte(s, strm.adler & 0xff);
|
||||
put_byte(s, strm.adler >> 8 & 0xff);
|
||||
put_byte(s, (strm.adler >> 8) & 0xff);
|
||||
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
||||
s.status = BUSY_STATE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
s.status = BUSY_STATE;
|
||||
}
|
||||
}
|
||||
|
@ -1608,7 +1625,8 @@ function deflate(strm, flush) {
|
|||
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
||||
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
||||
*/
|
||||
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) {
|
||||
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
|
||||
flush !== Z_FINISH) {
|
||||
return err(strm, Z_BUF_ERROR);
|
||||
}
|
||||
|
||||
|
@ -1619,8 +1637,11 @@ function deflate(strm, flush) {
|
|||
|
||||
/* Start a new block or continue the current one.
|
||||
*/
|
||||
if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {
|
||||
var bstate = s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);
|
||||
if (strm.avail_in !== 0 || s.lookahead !== 0 ||
|
||||
(flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
|
||||
var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :
|
||||
(s.strategy === Z_RLE ? deflate_rle(s, flush) :
|
||||
configuration_table[s.level].func(s, flush));
|
||||
|
||||
if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
|
||||
s.status = FINISH_STATE;
|
||||
|
@ -1642,8 +1663,8 @@ function deflate(strm, flush) {
|
|||
if (bstate === BS_BLOCK_DONE) {
|
||||
if (flush === Z_PARTIAL_FLUSH) {
|
||||
trees._tr_align(s);
|
||||
} else if (flush !== Z_BLOCK) {
|
||||
/* FULL_FLUSH or SYNC_FLUSH */
|
||||
}
|
||||
else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
|
||||
|
||||
trees._tr_stored_block(s, 0, 0, false);
|
||||
/* For a full flush, this empty block will be recognized
|
||||
|
@ -1670,24 +1691,22 @@ function deflate(strm, flush) {
|
|||
//Assert(strm->avail_out > 0, "bug2");
|
||||
//if (strm.avail_out <= 0) { throw new Error("bug2");}
|
||||
|
||||
if (flush !== Z_FINISH) {
|
||||
return Z_OK;
|
||||
}
|
||||
if (s.wrap <= 0) {
|
||||
return Z_STREAM_END;
|
||||
}
|
||||
if (flush !== Z_FINISH) { return Z_OK; }
|
||||
if (s.wrap <= 0) { return Z_STREAM_END; }
|
||||
|
||||
/* Write the trailer */
|
||||
if (s.wrap === 2) {
|
||||
put_byte(s, strm.adler & 0xff);
|
||||
put_byte(s, strm.adler >> 8 & 0xff);
|
||||
put_byte(s, strm.adler >> 16 & 0xff);
|
||||
put_byte(s, strm.adler >> 24 & 0xff);
|
||||
put_byte(s, (strm.adler >> 8) & 0xff);
|
||||
put_byte(s, (strm.adler >> 16) & 0xff);
|
||||
put_byte(s, (strm.adler >> 24) & 0xff);
|
||||
put_byte(s, strm.total_in & 0xff);
|
||||
put_byte(s, strm.total_in >> 8 & 0xff);
|
||||
put_byte(s, strm.total_in >> 16 & 0xff);
|
||||
put_byte(s, strm.total_in >> 24 & 0xff);
|
||||
} else {
|
||||
put_byte(s, (strm.total_in >> 8) & 0xff);
|
||||
put_byte(s, (strm.total_in >> 16) & 0xff);
|
||||
put_byte(s, (strm.total_in >> 24) & 0xff);
|
||||
}
|
||||
else
|
||||
{
|
||||
putShortMSB(s, strm.adler >>> 16);
|
||||
putShortMSB(s, strm.adler & 0xffff);
|
||||
}
|
||||
|
@ -1696,9 +1715,7 @@ function deflate(strm, flush) {
|
|||
/* If avail_out is zero, the application will call deflate again
|
||||
* to flush the rest.
|
||||
*/
|
||||
if (s.wrap > 0) {
|
||||
s.wrap = -s.wrap;
|
||||
}
|
||||
if (s.wrap > 0) { s.wrap = -s.wrap; }
|
||||
/* write the trailer only once! */
|
||||
return s.pending !== 0 ? Z_OK : Z_STREAM_END;
|
||||
}
|
||||
|
@ -1711,7 +1728,14 @@ function deflateEnd(strm) {
|
|||
}
|
||||
|
||||
status = strm.state.status;
|
||||
if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE) {
|
||||
if (status !== INIT_STATE &&
|
||||
status !== EXTRA_STATE &&
|
||||
status !== NAME_STATE &&
|
||||
status !== COMMENT_STATE &&
|
||||
status !== HCRC_STATE &&
|
||||
status !== BUSY_STATE &&
|
||||
status !== FINISH_STATE
|
||||
) {
|
||||
return err(strm, Z_STREAM_ERROR);
|
||||
}
|
||||
|
||||
|
@ -1720,6 +1744,7 @@ function deflateEnd(strm) {
|
|||
return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
|
||||
}
|
||||
|
||||
|
||||
/* =========================================================================
|
||||
* Initializes the compression dictionary from the given byte
|
||||
* sequence without producing any compressed output.
|
||||
|
@ -1742,22 +1767,21 @@ function deflateSetDictionary(strm, dictionary) {
|
|||
s = strm.state;
|
||||
wrap = s.wrap;
|
||||
|
||||
if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) {
|
||||
if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
|
||||
return Z_STREAM_ERROR;
|
||||
}
|
||||
|
||||
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
|
||||
if (wrap === 1) {
|
||||
/* adler32(strm->adler, dictionary, dictLength); */
|
||||
strm.adler = (0, _adler2.default)(strm.adler, dictionary, dictLength, 0);
|
||||
strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
|
||||
}
|
||||
|
||||
s.wrap = 0; /* avoid computing Adler-32 in read_buf */
|
||||
|
||||
/* if dictionary would fill window, just replace the history */
|
||||
if (dictLength >= s.w_size) {
|
||||
if (wrap === 0) {
|
||||
/* already empty otherwise */
|
||||
if (wrap === 0) { /* already empty otherwise */
|
||||
/*** CLEAR_HASH(s); ***/
|
||||
zero(s.head); // Fill with NIL (= 0);
|
||||
s.strstart = 0;
|
||||
|
@ -1784,7 +1808,7 @@ function deflateSetDictionary(strm, dictionary) {
|
|||
n = s.lookahead - (MIN_MATCH - 1);
|
||||
do {
|
||||
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
||||
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
||||
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
||||
|
||||
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
||||
|
||||
|
@ -1808,15 +1832,9 @@ function deflateSetDictionary(strm, dictionary) {
|
|||
return Z_OK;
|
||||
}
|
||||
|
||||
exports.deflateInit = deflateInit;
|
||||
exports.deflateInit2 = deflateInit2;
|
||||
exports.deflateReset = deflateReset;
|
||||
exports.deflateResetKeep = deflateResetKeep;
|
||||
exports.deflateSetHeader = deflateSetHeader;
|
||||
exports.deflate = deflate;
|
||||
exports.deflateEnd = deflateEnd;
|
||||
exports.deflateSetDictionary = deflateSetDictionary;
|
||||
var deflateInfo = exports.deflateInfo = 'pako deflate (from Nodeca project)';
|
||||
|
||||
export { deflateInit, deflateInit2, deflateReset, deflateResetKeep, deflateSetHeader, deflate, deflateEnd, deflateSetDictionary };
|
||||
export var deflateInfo = 'pako deflate (from Nodeca project)';
|
||||
|
||||
/* Not implemented
|
||||
exports.deflateBound = deflateBound;
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = GZheader;
|
||||
function GZheader() {
|
||||
export default function GZheader() {
|
||||
/* true if compressed data believed to be text */
|
||||
this.text = 0;
|
||||
/* modification time */
|
||||
|
|
97
static/js/novnc/vendor/pako/lib/zlib/inffast.js
vendored
97
static/js/novnc/vendor/pako/lib/zlib/inffast.js
vendored
|
@ -1,9 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inflate_fast;
|
||||
// See state defs from inflate.js
|
||||
var BAD = 30; /* got a data error -- remain here until reset */
|
||||
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
|
||||
|
@ -43,7 +37,7 @@ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
|
|||
requires strm.avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
function inflate_fast(strm, start) {
|
||||
export default function inflate_fast(strm, start) {
|
||||
var state;
|
||||
var _in; /* local strm.input */
|
||||
var last; /* have enough input while in < last */
|
||||
|
@ -72,6 +66,7 @@ function inflate_fast(strm, start) {
|
|||
var from; /* where to copy match from */
|
||||
var from_source;
|
||||
|
||||
|
||||
var input, output; // JS specific, because we have no pointers
|
||||
|
||||
/* copy state to local variables */
|
||||
|
@ -98,10 +93,12 @@ function inflate_fast(strm, start) {
|
|||
lmask = (1 << state.lenbits) - 1;
|
||||
dmask = (1 << state.distbits) - 1;
|
||||
|
||||
|
||||
/* decode literals and length/distances until end-of-block or not enough
|
||||
input data or output space */
|
||||
|
||||
top: do {
|
||||
top:
|
||||
do {
|
||||
if (bits < 15) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
|
@ -111,20 +108,19 @@ function inflate_fast(strm, start) {
|
|||
|
||||
here = lcode[hold & lmask];
|
||||
|
||||
dolen: for (;;) {
|
||||
// Goto emulation
|
||||
dolen:
|
||||
for (;;) { // Goto emulation
|
||||
op = here >>> 24/*here.bits*/;
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
op = here >>> 16 & 0xff /*here.op*/;
|
||||
if (op === 0) {
|
||||
/* literal */
|
||||
op = (here >>> 16) & 0xff/*here.op*/;
|
||||
if (op === 0) { /* literal */
|
||||
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
// "inflate: literal '%c'\n" :
|
||||
// "inflate: literal 0x%02x\n", here.val));
|
||||
output[_out++] = here & 0xffff/*here.val*/;
|
||||
} else if (op & 16) {
|
||||
/* length base */
|
||||
}
|
||||
else if (op & 16) { /* length base */
|
||||
len = here & 0xffff/*here.val*/;
|
||||
op &= 15; /* number of extra bits */
|
||||
if (op) {
|
||||
|
@ -132,7 +128,7 @@ function inflate_fast(strm, start) {
|
|||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
len += hold & (1 << op) - 1;
|
||||
len += hold & ((1 << op) - 1);
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
}
|
||||
|
@ -145,15 +141,14 @@ function inflate_fast(strm, start) {
|
|||
}
|
||||
here = dcode[hold & dmask];
|
||||
|
||||
dodist: for (;;) {
|
||||
// goto emulation
|
||||
dodist:
|
||||
for (;;) { // goto emulation
|
||||
op = here >>> 24/*here.bits*/;
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
op = here >>> 16 & 0xff /*here.op*/;
|
||||
op = (here >>> 16) & 0xff/*here.op*/;
|
||||
|
||||
if (op & 16) {
|
||||
/* distance base */
|
||||
if (op & 16) { /* distance base */
|
||||
dist = here & 0xffff/*here.val*/;
|
||||
op &= 15; /* number of extra bits */
|
||||
if (bits < op) {
|
||||
|
@ -164,7 +159,7 @@ function inflate_fast(strm, start) {
|
|||
bits += 8;
|
||||
}
|
||||
}
|
||||
dist += hold & (1 << op) - 1;
|
||||
dist += hold & ((1 << op) - 1);
|
||||
//#ifdef INFLATE_STRICT
|
||||
if (dist > dmax) {
|
||||
strm.msg = 'invalid distance too far back';
|
||||
|
@ -176,8 +171,7 @@ function inflate_fast(strm, start) {
|
|||
bits -= op;
|
||||
//Tracevv((stderr, "inflate: distance %u\n", dist));
|
||||
op = _out - beg; /* max distance in output */
|
||||
if (dist > op) {
|
||||
/* see if copy from window */
|
||||
if (dist > op) { /* see if copy from window */
|
||||
op = dist - op; /* distance back in window */
|
||||
if (op > whave) {
|
||||
if (state.sane) {
|
||||
|
@ -210,11 +204,9 @@ function inflate_fast(strm, start) {
|
|||
}
|
||||
from = 0; // window index
|
||||
from_source = s_window;
|
||||
if (wnext === 0) {
|
||||
/* very common case */
|
||||
if (wnext === 0) { /* very common case */
|
||||
from += wsize - op;
|
||||
if (op < len) {
|
||||
/* some from window */
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
|
@ -222,19 +214,17 @@ function inflate_fast(strm, start) {
|
|||
from = _out - dist; /* rest from output */
|
||||
from_source = output;
|
||||
}
|
||||
} else if (wnext < op) {
|
||||
/* wrap around window */
|
||||
}
|
||||
else if (wnext < op) { /* wrap around window */
|
||||
from += wsize + wnext - op;
|
||||
op -= wnext;
|
||||
if (op < len) {
|
||||
/* some from end of window */
|
||||
if (op < len) { /* some from end of window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = 0;
|
||||
if (wnext < len) {
|
||||
/* some from start of window */
|
||||
if (wnext < len) { /* some from start of window */
|
||||
op = wnext;
|
||||
len -= op;
|
||||
do {
|
||||
|
@ -244,11 +234,10 @@ function inflate_fast(strm, start) {
|
|||
from_source = output;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* contiguous in window */
|
||||
}
|
||||
else { /* contiguous in window */
|
||||
from += wnext - op;
|
||||
if (op < len) {
|
||||
/* some from window */
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
|
@ -269,10 +258,10 @@ function inflate_fast(strm, start) {
|
|||
output[_out++] = from_source[from++];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
from = _out - dist; /* copy direct from output */
|
||||
do {
|
||||
/* minimum length is three */
|
||||
do { /* minimum length is three */
|
||||
output[_out++] = output[from++];
|
||||
output[_out++] = output[from++];
|
||||
output[_out++] = output[from++];
|
||||
|
@ -285,11 +274,12 @@ function inflate_fast(strm, start) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if ((op & 64) === 0) {
|
||||
/* 2nd level distance code */
|
||||
here = dcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)];
|
||||
}
|
||||
else if ((op & 64) === 0) { /* 2nd level distance code */
|
||||
here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||
continue dodist;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
strm.msg = 'invalid distance code';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
|
@ -297,16 +287,17 @@ function inflate_fast(strm, start) {
|
|||
|
||||
break; // need to emulate goto via "continue"
|
||||
}
|
||||
} else if ((op & 64) === 0) {
|
||||
/* 2nd level length code */
|
||||
here = lcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)];
|
||||
}
|
||||
else if ((op & 64) === 0) { /* 2nd level length code */
|
||||
here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||
continue dolen;
|
||||
} else if (op & 32) {
|
||||
/* end-of-block */
|
||||
}
|
||||
else if (op & 32) { /* end-of-block */
|
||||
//Tracevv((stderr, "inflate: end of block\n"));
|
||||
state.mode = TYPE;
|
||||
break top;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
strm.msg = 'invalid literal/length code';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
|
@ -325,8 +316,8 @@ function inflate_fast(strm, start) {
|
|||
/* update state and return */
|
||||
strm.next_in = _in;
|
||||
strm.next_out = _out;
|
||||
strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
|
||||
strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
|
||||
strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
|
||||
strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
|
||||
state.hold = hold;
|
||||
state.bits = bits;
|
||||
return;
|
||||
|
|
490
static/js/novnc/vendor/pako/lib/zlib/inflate.js
vendored
490
static/js/novnc/vendor/pako/lib/zlib/inflate.js
vendored
File diff suppressed because it is too large
Load diff
95
static/js/novnc/vendor/pako/lib/zlib/inftrees.js
vendored
95
static/js/novnc/vendor/pako/lib/zlib/inftrees.js
vendored
|
@ -1,15 +1,4 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inflate_table;
|
||||
|
||||
var _common = require("../utils/common.js");
|
||||
|
||||
var utils = _interopRequireWildcard(_common);
|
||||
|
||||
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 utils from "../utils/common.js";
|
||||
|
||||
var MAXBITS = 15;
|
||||
var ENOUGH_LENS = 852;
|
||||
|
@ -21,25 +10,35 @@ var LENS = 1;
|
|||
var DISTS = 2;
|
||||
|
||||
var lbase = [ /* Length codes 257..285 base */
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0];
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
||||
];
|
||||
|
||||
var lext = [ /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78];
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
|
||||
];
|
||||
|
||||
var dbase = [ /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0];
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
8193, 12289, 16385, 24577, 0, 0
|
||||
];
|
||||
|
||||
var dext = [ /* Distance codes 0..29 extra */
|
||||
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
|
||||
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
|
||||
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
|
||||
28, 28, 29, 29, 64, 64
|
||||
];
|
||||
|
||||
function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {
|
||||
export default function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
|
||||
{
|
||||
var bits = opts.bits;
|
||||
//here = opts.here; /* table entry for duplication */
|
||||
|
||||
var len = 0; /* a code's length in bits */
|
||||
var sym = 0; /* index of code symbols */
|
||||
var min = 0,
|
||||
max = 0; /* minimum and maximum code lengths */
|
||||
var min = 0, max = 0; /* minimum and maximum code lengths */
|
||||
var root = 0; /* number of index bits for root table */
|
||||
var curr = 0; /* number of index bits for current table */
|
||||
var drop = 0; /* code bits to drop for sub-table */
|
||||
|
@ -74,15 +73,18 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
from their more natural integer increment ordering, and so when the
|
||||
decoding tables are built in the large loop below, the integer codes
|
||||
are incremented backwards.
|
||||
|
||||
This routine assumes, but does not check, that all of the entries in
|
||||
lens[] are in the range 0..MAXBITS. The caller must assure this.
|
||||
1..MAXBITS is interpreted as that code length. zero means that that
|
||||
symbol does not occur in this code.
|
||||
|
||||
The codes are sorted by computing a count of codes for each length,
|
||||
creating from that a table of starting indices for each length in the
|
||||
sorted table, and then entering the symbols in order in the sorted
|
||||
table. The sorted table is work[], with that space being provided by
|
||||
the caller.
|
||||
|
||||
The length counts are used for other purposes as well, i.e. finding
|
||||
the minimum and maximum length codes, determining if there are any
|
||||
codes at all, checking for a valid set of lengths, and looking ahead
|
||||
|
@ -101,32 +103,28 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
/* bound code lengths, force root to be within code lengths */
|
||||
root = bits;
|
||||
for (max = MAXBITS; max >= 1; max--) {
|
||||
if (count[max] !== 0) {
|
||||
break;
|
||||
}
|
||||
if (count[max] !== 0) { break; }
|
||||
}
|
||||
if (root > max) {
|
||||
root = max;
|
||||
}
|
||||
if (max === 0) {
|
||||
/* no symbols to code at all */
|
||||
if (max === 0) { /* no symbols to code at all */
|
||||
//table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
|
||||
//table.bits[opts.table_index] = 1; //here.bits = (var char)1;
|
||||
//table.val[opts.table_index++] = 0; //here.val = (var short)0;
|
||||
table[table_index++] = 1 << 24 | 64 << 16 | 0;
|
||||
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
||||
|
||||
|
||||
//table.op[opts.table_index] = 64;
|
||||
//table.bits[opts.table_index] = 1;
|
||||
//table.val[opts.table_index++] = 0;
|
||||
table[table_index++] = 1 << 24 | 64 << 16 | 0;
|
||||
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
||||
|
||||
opts.bits = 1;
|
||||
return 0; /* no symbols, but wait for decoding to report error */
|
||||
}
|
||||
for (min = 1; min < max; min++) {
|
||||
if (count[min] !== 0) {
|
||||
break;
|
||||
}
|
||||
if (count[min] !== 0) { break; }
|
||||
}
|
||||
if (root < min) {
|
||||
root = min;
|
||||
|
@ -165,20 +163,24 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
bits off of the bottom. For codes where len is less than drop + curr,
|
||||
those top drop + curr - len bits are incremented through all values to
|
||||
fill the table with replicated entries.
|
||||
|
||||
root is the number of index bits for the root table. When len exceeds
|
||||
root, sub-tables are created pointed to by the root entry with an index
|
||||
of the low root bits of huff. This is saved in low to check for when a
|
||||
new sub-table should be started. drop is zero when the root table is
|
||||
being filled, and drop is root when sub-tables are being filled.
|
||||
|
||||
When a new sub-table is needed, it is necessary to look ahead in the
|
||||
code lengths to determine what size sub-table is needed. The length
|
||||
counts are used for this, and so count[] is decremented as codes are
|
||||
entered in the tables.
|
||||
|
||||
used keeps track of how many table entries have been allocated from the
|
||||
provided *table space. It is checked for LENS and DIST tables against
|
||||
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
|
||||
the initial root table size constants. See the comments in inftrees.h
|
||||
for more information.
|
||||
|
||||
sym increments through all symbols, and the loop terminates when
|
||||
all codes of length max, i.e. all codes, have been processed. This
|
||||
routine permits incomplete codes, so another loop after this one fills
|
||||
|
@ -191,14 +193,15 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
if (type === CODES) {
|
||||
base = extra = work; /* dummy value--not used */
|
||||
end = 19;
|
||||
|
||||
} else if (type === LENS) {
|
||||
base = lbase;
|
||||
base_index -= 257;
|
||||
extra = lext;
|
||||
extra_index -= 257;
|
||||
end = 256;
|
||||
} else {
|
||||
/* DISTS */
|
||||
|
||||
} else { /* DISTS */
|
||||
base = dbase;
|
||||
extra = dext;
|
||||
end = -1;
|
||||
|
@ -216,7 +219,8 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
mask = used - 1; /* mask for comparing low */
|
||||
|
||||
/* check available table space */
|
||||
if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
|
||||
if ((type === LENS && used > ENOUGH_LENS) ||
|
||||
(type === DISTS && used > ENOUGH_DISTS)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -227,25 +231,27 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
if (work[sym] < end) {
|
||||
here_op = 0;
|
||||
here_val = work[sym];
|
||||
} else if (work[sym] > end) {
|
||||
}
|
||||
else if (work[sym] > end) {
|
||||
here_op = extra[extra_index + work[sym]];
|
||||
here_val = base[base_index + work[sym]];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
here_op = 32 + 64; /* end of block */
|
||||
here_val = 0;
|
||||
}
|
||||
|
||||
/* replicate for those indices with low len bits equal to huff */
|
||||
incr = 1 << len - drop;
|
||||
incr = 1 << (len - drop);
|
||||
fill = 1 << curr;
|
||||
min = fill; /* save offset to next table */
|
||||
do {
|
||||
fill -= incr;
|
||||
table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
|
||||
table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
|
||||
} while (fill !== 0);
|
||||
|
||||
/* backwards increment the len-bit code huff */
|
||||
incr = 1 << len - 1;
|
||||
incr = 1 << (len - 1);
|
||||
while (huff & incr) {
|
||||
incr >>= 1;
|
||||
}
|
||||
|
@ -259,9 +265,7 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
/* go to next symbol, update count, len */
|
||||
sym++;
|
||||
if (--count[len] === 0) {
|
||||
if (len === max) {
|
||||
break;
|
||||
}
|
||||
if (len === max) { break; }
|
||||
len = lens[lens_index + work[sym]];
|
||||
}
|
||||
|
||||
|
@ -280,16 +284,15 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
left = 1 << curr;
|
||||
while (curr + drop < max) {
|
||||
left -= count[curr + drop];
|
||||
if (left <= 0) {
|
||||
break;
|
||||
}
|
||||
if (left <= 0) { break; }
|
||||
curr++;
|
||||
left <<= 1;
|
||||
}
|
||||
|
||||
/* check for enough space */
|
||||
used += 1 << curr;
|
||||
if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
|
||||
if ((type === LENS && used > ENOUGH_LENS) ||
|
||||
(type === DISTS && used > ENOUGH_DISTS)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -298,7 +301,7 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
/*table.op[low] = curr;
|
||||
table.bits[low] = root;
|
||||
table.val[low] = next - opts.table_index;*/
|
||||
table[low] = root << 24 | curr << 16 | next - table_index | 0;
|
||||
table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,7 +312,7 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
|||
//table.op[next + huff] = 64; /* invalid code marker */
|
||||
//table.bits[next + huff] = len - drop;
|
||||
//table.val[next + huff] = 0;
|
||||
table[next + huff] = len - drop << 24 | 64 << 16 | 0;
|
||||
table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
|
||||
}
|
||||
|
||||
/* set return parameters */
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = {
|
||||
export default {
|
||||
2: 'need dictionary', /* Z_NEED_DICT 2 */
|
||||
1: 'stream end', /* Z_STREAM_END 1 */
|
||||
0: '', /* Z_OK 0 */
|
||||
|
|
179
static/js/novnc/vendor/pako/lib/zlib/trees.js
vendored
179
static/js/novnc/vendor/pako/lib/zlib/trees.js
vendored
|
@ -1,19 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports._tr_align = exports._tr_tally = exports._tr_flush_block = exports._tr_stored_block = exports._tr_init = undefined;
|
||||
|
||||
var _common = require("../utils/common.js");
|
||||
|
||||
var utils = _interopRequireWildcard(_common);
|
||||
|
||||
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 utils from "../utils/common.js";
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
||||
|
||||
//var Z_FILTERED = 1;
|
||||
//var Z_HUFFMAN_ONLY = 2;
|
||||
//var Z_RLE = 3;
|
||||
|
@ -28,11 +18,8 @@ var Z_UNKNOWN = 2;
|
|||
|
||||
/*============================================================================*/
|
||||
|
||||
function zero(buf) {
|
||||
var len = buf.length;while (--len >= 0) {
|
||||
buf[len] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
||||
|
||||
// From zutil.h
|
||||
|
||||
|
@ -74,6 +61,7 @@ var MAX_BITS = 15;
|
|||
var Buf_size = 16;
|
||||
/* size of bit buffer in bi_buf */
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Constants
|
||||
*/
|
||||
|
@ -103,7 +91,8 @@ var extra_dbits = /* extra bits for each distance code */
|
|||
var extra_blbits = /* extra bits for each bit length code */
|
||||
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];
|
||||
|
||||
var bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
|
||||
var bl_order =
|
||||
[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];
|
||||
/* eslint-enable comma-spacing,array-bracket-spacing */
|
||||
|
||||
/* The lengths of the bit length codes are sent in order of decreasing
|
||||
|
@ -152,6 +141,7 @@ var base_dist = new Array(D_CODES);
|
|||
zero(base_dist);
|
||||
/* First normalized distance for each code (0 = distance of 1) */
|
||||
|
||||
|
||||
function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
|
||||
|
||||
this.static_tree = static_tree; /* static tree or NULL */
|
||||
|
@ -164,20 +154,25 @@ function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length)
|
|||
this.has_stree = static_tree && static_tree.length;
|
||||
}
|
||||
|
||||
|
||||
var static_l_desc;
|
||||
var static_d_desc;
|
||||
var static_bl_desc;
|
||||
|
||||
|
||||
function TreeDesc(dyn_tree, stat_desc) {
|
||||
this.dyn_tree = dyn_tree; /* the dynamic tree */
|
||||
this.max_code = 0; /* largest code with non zero frequency */
|
||||
this.stat_desc = stat_desc; /* the corresponding static tree */
|
||||
}
|
||||
|
||||
|
||||
|
||||
function d_code(dist) {
|
||||
return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Output a short LSB first on the stream.
|
||||
* IN assertion: there is enough room in pendingBuf.
|
||||
|
@ -185,30 +180,33 @@ function d_code(dist) {
|
|||
function put_short(s, w) {
|
||||
// put_byte(s, (uch)((w) & 0xff));
|
||||
// put_byte(s, (uch)((ush)(w) >> 8));
|
||||
s.pending_buf[s.pending++] = w & 0xff;
|
||||
s.pending_buf[s.pending++] = w >>> 8 & 0xff;
|
||||
s.pending_buf[s.pending++] = (w) & 0xff;
|
||||
s.pending_buf[s.pending++] = (w >>> 8) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Send a value on a given number of bits.
|
||||
* IN assertion: length <= 16 and value fits in length bits.
|
||||
*/
|
||||
function send_bits(s, value, length) {
|
||||
if (s.bi_valid > Buf_size - length) {
|
||||
s.bi_buf |= value << s.bi_valid & 0xffff;
|
||||
if (s.bi_valid > (Buf_size - length)) {
|
||||
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
||||
put_short(s, s.bi_buf);
|
||||
s.bi_buf = value >> Buf_size - s.bi_valid;
|
||||
s.bi_buf = value >> (Buf_size - s.bi_valid);
|
||||
s.bi_valid += length - Buf_size;
|
||||
} else {
|
||||
s.bi_buf |= value << s.bi_valid & 0xffff;
|
||||
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
||||
s.bi_valid += length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function send_code(s, c, tree) {
|
||||
send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Reverse the first len bits of a code, using straightforward code (a faster
|
||||
* method would use a table)
|
||||
|
@ -224,6 +222,7 @@ function bi_reverse(code, len) {
|
|||
return res >>> 1;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Flush the bit buffer, keeping at most 7 bits in it.
|
||||
*/
|
||||
|
@ -232,6 +231,7 @@ function bi_flush(s) {
|
|||
put_short(s, s.bi_buf);
|
||||
s.bi_buf = 0;
|
||||
s.bi_valid = 0;
|
||||
|
||||
} else if (s.bi_valid >= 8) {
|
||||
s.pending_buf[s.pending++] = s.bi_buf & 0xff;
|
||||
s.bi_buf >>= 8;
|
||||
|
@ -239,6 +239,7 @@ function bi_flush(s) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Compute the optimal bit lengths for a tree and update the total bit length
|
||||
* for the current block.
|
||||
|
@ -286,9 +287,7 @@ function gen_bitlen(s, desc)
|
|||
tree[n * 2 + 1]/*.Len*/ = bits;
|
||||
/* We overwrite tree[n].Dad which is no longer needed */
|
||||
|
||||
if (n > max_code) {
|
||||
continue;
|
||||
} /* not a leaf node */
|
||||
if (n > max_code) { continue; } /* not a leaf node */
|
||||
|
||||
s.bl_count[bits]++;
|
||||
xbits = 0;
|
||||
|
@ -301,9 +300,7 @@ function gen_bitlen(s, desc)
|
|||
s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);
|
||||
}
|
||||
}
|
||||
if (overflow === 0) {
|
||||
return;
|
||||
}
|
||||
if (overflow === 0) { return; }
|
||||
|
||||
// Trace((stderr,"\nbit length overflow\n"));
|
||||
/* This happens for example on obj2 and pic of the Calgary corpus */
|
||||
|
@ -311,9 +308,7 @@ function gen_bitlen(s, desc)
|
|||
/* Find the first bit length which could increase: */
|
||||
do {
|
||||
bits = max_length - 1;
|
||||
while (s.bl_count[bits] === 0) {
|
||||
bits--;
|
||||
}
|
||||
while (s.bl_count[bits] === 0) { bits--; }
|
||||
s.bl_count[bits]--; /* move one leaf down the tree */
|
||||
s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */
|
||||
s.bl_count[max_length]--;
|
||||
|
@ -332,9 +327,7 @@ function gen_bitlen(s, desc)
|
|||
n = s.bl_count[bits];
|
||||
while (n !== 0) {
|
||||
m = s.heap[--h];
|
||||
if (m > max_code) {
|
||||
continue;
|
||||
}
|
||||
if (m > max_code) { continue; }
|
||||
if (tree[m * 2 + 1]/*.Len*/ !== bits) {
|
||||
// Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
|
||||
s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;
|
||||
|
@ -345,6 +338,7 @@ function gen_bitlen(s, desc)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Generate the codes for a given tree and bit counts (which need not be
|
||||
* optimal).
|
||||
|
@ -367,7 +361,7 @@ function gen_codes(tree, max_code, bl_count)
|
|||
* without bit reversal.
|
||||
*/
|
||||
for (bits = 1; bits <= MAX_BITS; bits++) {
|
||||
next_code[bits] = code = code + bl_count[bits - 1] << 1;
|
||||
next_code[bits] = code = (code + bl_count[bits - 1]) << 1;
|
||||
}
|
||||
/* Check that the bit counts in bl_count are consistent. The last code
|
||||
* must be all ones.
|
||||
|
@ -378,9 +372,7 @@ function gen_codes(tree, max_code, bl_count)
|
|||
|
||||
for (n = 0; n <= max_code; n++) {
|
||||
var len = tree[n * 2 + 1]/*.Len*/;
|
||||
if (len === 0) {
|
||||
continue;
|
||||
}
|
||||
if (len === 0) { continue; }
|
||||
/* Now reverse the bits */
|
||||
tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);
|
||||
|
||||
|
@ -389,6 +381,7 @@ function gen_codes(tree, max_code, bl_count)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Initialize the various 'constant' tables.
|
||||
*/
|
||||
|
@ -417,7 +410,7 @@ function tr_static_init() {
|
|||
length = 0;
|
||||
for (code = 0; code < LENGTH_CODES - 1; code++) {
|
||||
base_length[code] = length;
|
||||
for (n = 0; n < 1 << extra_lbits[code]; n++) {
|
||||
for (n = 0; n < (1 << extra_lbits[code]); n++) {
|
||||
_length_code[length++] = code;
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +425,7 @@ function tr_static_init() {
|
|||
dist = 0;
|
||||
for (code = 0; code < 16; code++) {
|
||||
base_dist[code] = dist;
|
||||
for (n = 0; n < 1 << extra_dbits[code]; n++) {
|
||||
for (n = 0; n < (1 << extra_dbits[code]); n++) {
|
||||
_dist_code[dist++] = code;
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +433,7 @@ function tr_static_init() {
|
|||
dist >>= 7; /* from now on, all distances are divided by 128 */
|
||||
for (; code < D_CODES; code++) {
|
||||
base_dist[code] = dist << 7;
|
||||
for (n = 0; n < 1 << extra_dbits[code] - 7; n++) {
|
||||
for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
|
||||
_dist_code[256 + dist++] = code;
|
||||
}
|
||||
}
|
||||
|
@ -492,6 +485,7 @@ function tr_static_init() {
|
|||
//static_init_done = true;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Initialize a new block.
|
||||
*/
|
||||
|
@ -499,25 +493,21 @@ function init_block(s) {
|
|||
var n; /* iterates over tree elements */
|
||||
|
||||
/* Initialize the trees. */
|
||||
for (n = 0; n < L_CODES; n++) {
|
||||
s.dyn_ltree[n * 2] /*.Freq*/ = 0;
|
||||
}
|
||||
for (n = 0; n < D_CODES; n++) {
|
||||
s.dyn_dtree[n * 2] /*.Freq*/ = 0;
|
||||
}
|
||||
for (n = 0; n < BL_CODES; n++) {
|
||||
s.bl_tree[n * 2] /*.Freq*/ = 0;
|
||||
}
|
||||
for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }
|
||||
for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }
|
||||
for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }
|
||||
|
||||
s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;
|
||||
s.opt_len = s.static_len = 0;
|
||||
s.last_lit = s.matches = 0;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Flush the bit buffer and align the output on a byte boundary
|
||||
*/
|
||||
function bi_windup(s) {
|
||||
function bi_windup(s)
|
||||
{
|
||||
if (s.bi_valid > 8) {
|
||||
put_short(s, s.bi_buf);
|
||||
} else if (s.bi_valid > 0) {
|
||||
|
@ -558,7 +548,8 @@ function copy_block(s, buf, len, header)
|
|||
function smaller(tree, n, m, depth) {
|
||||
var _n2 = n * 2;
|
||||
var _m2 = m * 2;
|
||||
return tree[_n2] /*.Freq*/ < tree[_m2] /*.Freq*/ || tree[_n2] /*.Freq*/ === tree[_m2] /*.Freq*/ && depth[n] <= depth[m];
|
||||
return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||
|
||||
(tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
|
@ -576,13 +567,12 @@ function pqdownheap(s, tree, k)
|
|||
var j = k << 1; /* left son of k */
|
||||
while (j <= s.heap_len) {
|
||||
/* Set j to the smallest of the two sons: */
|
||||
if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
|
||||
if (j < s.heap_len &&
|
||||
smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
|
||||
j++;
|
||||
}
|
||||
/* Exit if v is smaller than both sons */
|
||||
if (smaller(tree, v, s.heap[j], s.depth)) {
|
||||
break;
|
||||
}
|
||||
if (smaller(tree, v, s.heap[j], s.depth)) { break; }
|
||||
|
||||
/* Exchange v with the smallest son */
|
||||
s.heap[k] = s.heap[j];
|
||||
|
@ -594,6 +584,7 @@ function pqdownheap(s, tree, k)
|
|||
s.heap[k] = v;
|
||||
}
|
||||
|
||||
|
||||
// inlined manually
|
||||
// var SMALLEST = 1;
|
||||
|
||||
|
@ -613,7 +604,7 @@ function compress_block(s, ltree, dtree)
|
|||
|
||||
if (s.last_lit !== 0) {
|
||||
do {
|
||||
dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1];
|
||||
dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);
|
||||
lc = s.pending_buf[s.l_buf + lx];
|
||||
lx++;
|
||||
|
||||
|
@ -644,12 +635,14 @@ function compress_block(s, ltree, dtree)
|
|||
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
||||
//Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
||||
// "pendingBuf overflow");
|
||||
|
||||
} while (lx < s.last_lit);
|
||||
}
|
||||
|
||||
send_code(s, END_BLOCK, ltree);
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
||||
* Update the total bit length for the current block.
|
||||
|
@ -681,6 +674,7 @@ function build_tree(s, desc)
|
|||
if (tree[n * 2]/*.Freq*/ !== 0) {
|
||||
s.heap[++s.heap_len] = max_code = n;
|
||||
s.depth[n] = 0;
|
||||
|
||||
} else {
|
||||
tree[n * 2 + 1]/*.Len*/ = 0;
|
||||
}
|
||||
|
@ -692,7 +686,7 @@ function build_tree(s, desc)
|
|||
* two codes of non zero frequency.
|
||||
*/
|
||||
while (s.heap_len < 2) {
|
||||
node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0;
|
||||
node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);
|
||||
tree[node * 2]/*.Freq*/ = 1;
|
||||
s.depth[node] = 0;
|
||||
s.opt_len--;
|
||||
|
@ -707,9 +701,7 @@ function build_tree(s, desc)
|
|||
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
|
||||
* establish sub-heaps of increasing lengths:
|
||||
*/
|
||||
for (n = s.heap_len >> 1 /*int /2*/; n >= 1; n--) {
|
||||
pqdownheap(s, tree, n);
|
||||
}
|
||||
for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }
|
||||
|
||||
/* Construct the Huffman tree by repeatedly combining the least two
|
||||
* frequent nodes.
|
||||
|
@ -736,6 +728,7 @@ function build_tree(s, desc)
|
|||
/* and insert the new node in the heap */
|
||||
s.heap[1/*SMALLEST*/] = node++;
|
||||
pqdownheap(s, tree, 1/*SMALLEST*/);
|
||||
|
||||
} while (s.heap_len >= 2);
|
||||
|
||||
s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];
|
||||
|
@ -749,6 +742,7 @@ function build_tree(s, desc)
|
|||
gen_codes(tree, max_code, s.bl_count);
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Scan a literal or distance tree to determine the frequencies of the codes
|
||||
* in the bit length tree.
|
||||
|
@ -780,16 +774,18 @@ function scan_tree(s, tree, max_code)
|
|||
|
||||
if (++count < max_count && curlen === nextlen) {
|
||||
continue;
|
||||
|
||||
} else if (count < min_count) {
|
||||
s.bl_tree[curlen * 2]/*.Freq*/ += count;
|
||||
|
||||
} else if (curlen !== 0) {
|
||||
|
||||
if (curlen !== prevlen) {
|
||||
s.bl_tree[curlen * 2] /*.Freq*/++;
|
||||
}
|
||||
if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }
|
||||
s.bl_tree[REP_3_6 * 2]/*.Freq*/++;
|
||||
|
||||
} else if (count <= 10) {
|
||||
s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;
|
||||
|
||||
} else {
|
||||
s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;
|
||||
}
|
||||
|
@ -800,9 +796,11 @@ function scan_tree(s, tree, max_code)
|
|||
if (nextlen === 0) {
|
||||
max_count = 138;
|
||||
min_count = 3;
|
||||
|
||||
} else if (curlen === nextlen) {
|
||||
max_count = 6;
|
||||
min_count = 3;
|
||||
|
||||
} else {
|
||||
max_count = 7;
|
||||
min_count = 4;
|
||||
|
@ -810,6 +808,7 @@ function scan_tree(s, tree, max_code)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Send a literal or distance tree in compressed form, using the codes in
|
||||
* bl_tree.
|
||||
|
@ -841,10 +840,10 @@ function send_tree(s, tree, max_code)
|
|||
|
||||
if (++count < max_count && curlen === nextlen) {
|
||||
continue;
|
||||
|
||||
} else if (count < min_count) {
|
||||
do {
|
||||
send_code(s, curlen, s.bl_tree);
|
||||
} while (--count !== 0);
|
||||
do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);
|
||||
|
||||
} else if (curlen !== 0) {
|
||||
if (curlen !== prevlen) {
|
||||
send_code(s, curlen, s.bl_tree);
|
||||
|
@ -853,9 +852,11 @@ function send_tree(s, tree, max_code)
|
|||
//Assert(count >= 3 && count <= 6, " 3_6?");
|
||||
send_code(s, REP_3_6, s.bl_tree);
|
||||
send_bits(s, count - 3, 2);
|
||||
|
||||
} else if (count <= 10) {
|
||||
send_code(s, REPZ_3_10, s.bl_tree);
|
||||
send_bits(s, count - 3, 3);
|
||||
|
||||
} else {
|
||||
send_code(s, REPZ_11_138, s.bl_tree);
|
||||
send_bits(s, count - 11, 7);
|
||||
|
@ -866,9 +867,11 @@ function send_tree(s, tree, max_code)
|
|||
if (nextlen === 0) {
|
||||
max_count = 138;
|
||||
min_count = 3;
|
||||
|
||||
} else if (curlen === nextlen) {
|
||||
max_count = 6;
|
||||
min_count = 3;
|
||||
|
||||
} else {
|
||||
max_count = 7;
|
||||
min_count = 4;
|
||||
|
@ -876,6 +879,7 @@ function send_tree(s, tree, max_code)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Construct the Huffman tree for the bit lengths and return the index in
|
||||
* bl_order of the last bit length code to send.
|
||||
|
@ -910,6 +914,7 @@ function build_bl_tree(s) {
|
|||
return max_blindex;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Send the header for a block using dynamic Huffman trees: the counts, the
|
||||
* lengths of the bit length codes, the literal tree and the distance tree.
|
||||
|
@ -941,6 +946,7 @@ function send_all_trees(s, lcodes, dcodes, blcodes)
|
|||
//Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
||||
* - TEXT if the two conditions below are satisfied:
|
||||
|
@ -964,13 +970,14 @@ function detect_data_type(s) {
|
|||
|
||||
/* Check for non-textual ("black-listed") bytes. */
|
||||
for (n = 0; n <= 31; n++, black_mask >>>= 1) {
|
||||
if (black_mask & 1 && s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {
|
||||
if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {
|
||||
return Z_BINARY;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for textual ("white-listed") bytes. */
|
||||
if (s.dyn_ltree[9 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[10 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[13 * 2] /*.Freq*/ !== 0) {
|
||||
if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||
|
||||
s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {
|
||||
return Z_TEXT;
|
||||
}
|
||||
for (n = 32; n < LITERALS; n++) {
|
||||
|
@ -985,12 +992,14 @@ function detect_data_type(s) {
|
|||
return Z_BINARY;
|
||||
}
|
||||
|
||||
|
||||
var static_init_done = false;
|
||||
|
||||
/* ===========================================================================
|
||||
* Initialize the tree data structures for a new zlib stream.
|
||||
*/
|
||||
function _tr_init(s) {
|
||||
function _tr_init(s)
|
||||
{
|
||||
|
||||
if (!static_init_done) {
|
||||
tr_static_init();
|
||||
|
@ -1008,6 +1017,7 @@ function _tr_init(s) {
|
|||
init_block(s);
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Send a stored block
|
||||
*/
|
||||
|
@ -1021,6 +1031,7 @@ function _tr_stored_block(s, buf, stored_len, last)
|
|||
copy_block(s, buf, stored_len, true); /* with header */
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Send one empty static block to give enough lookahead for inflate.
|
||||
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
||||
|
@ -1031,6 +1042,7 @@ function _tr_align(s) {
|
|||
bi_flush(s);
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Determine the best encoding for the current block: dynamic trees, static
|
||||
* trees or store, and output the encoded block to the zip file.
|
||||
|
@ -1070,22 +1082,21 @@ function _tr_flush_block(s, buf, stored_len, last)
|
|||
max_blindex = build_bl_tree(s);
|
||||
|
||||
/* Determine the best encoding. Compute the block lengths in bytes. */
|
||||
opt_lenb = s.opt_len + 3 + 7 >>> 3;
|
||||
static_lenb = s.static_len + 3 + 7 >>> 3;
|
||||
opt_lenb = (s.opt_len + 3 + 7) >>> 3;
|
||||
static_lenb = (s.static_len + 3 + 7) >>> 3;
|
||||
|
||||
// Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
||||
// opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||
// s->last_lit));
|
||||
|
||||
if (static_lenb <= opt_lenb) {
|
||||
opt_lenb = static_lenb;
|
||||
}
|
||||
if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }
|
||||
|
||||
} else {
|
||||
// Assert(buf != (char*)0, "lost buf");
|
||||
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
|
||||
}
|
||||
|
||||
if (stored_len + 4 <= opt_lenb && buf !== -1) {
|
||||
if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {
|
||||
/* 4: two words for the lengths */
|
||||
|
||||
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
|
||||
|
@ -1095,10 +1106,12 @@ function _tr_flush_block(s, buf, stored_len, last)
|
|||
* transform a block into a stored block.
|
||||
*/
|
||||
_tr_stored_block(s, buf, stored_len, last);
|
||||
|
||||
} else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
|
||||
|
||||
send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
|
||||
compress_block(s, static_ltree, static_dtree);
|
||||
|
||||
} else {
|
||||
send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
|
||||
send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
|
||||
|
@ -1128,7 +1141,7 @@ function _tr_tally(s, dist, lc)
|
|||
{
|
||||
//var out_length, in_length, dcode;
|
||||
|
||||
s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 0xff;
|
||||
s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;
|
||||
s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;
|
||||
|
||||
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
|
||||
|
@ -1172,15 +1185,11 @@ function _tr_tally(s, dist, lc)
|
|||
// }
|
||||
//#endif
|
||||
|
||||
return s.last_lit === s.lit_bufsize - 1;
|
||||
return (s.last_lit === s.lit_bufsize - 1);
|
||||
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
||||
* on 16 bit machines and because stored blocks are restricted to
|
||||
* 64K-1 bytes.
|
||||
*/
|
||||
}
|
||||
|
||||
exports._tr_init = _tr_init;
|
||||
exports._tr_stored_block = _tr_stored_block;
|
||||
exports._tr_flush_block = _tr_flush_block;
|
||||
exports._tr_tally = _tr_tally;
|
||||
exports._tr_align = _tr_align;
|
||||
export { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align };
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = ZStream;
|
||||
function ZStream() {
|
||||
export default function ZStream() {
|
||||
/* next input byte */
|
||||
this.input = null; // JS specific, because we have no pointers
|
||||
this.next_in = 0;
|
||||
|
|
14043
static/js/novnc/vendor/sinon.js
vendored
Executable file
14043
static/js/novnc/vendor/sinon.js
vendored
Executable file
File diff suppressed because one or more lines are too long
|
@ -1,323 +0,0 @@
|
|||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block head %}
|
||||
<!--
|
||||
noVNC example: simple example using default UI
|
||||
Copyright (C) 2012 Joel Martin
|
||||
Copyright (C) 2016 Samuel Mannehed for Cendio AB
|
||||
Copyright (C) 2016 Pierre Ossman for Cendio AB
|
||||
noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
|
||||
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
|
||||
|
||||
Connect parameters are provided in query string:
|
||||
http://example.com/?host=HOST&port=PORT&encrypt=1
|
||||
or the fragment:
|
||||
http://example.com/#host=HOST&port=PORT&encrypt=1
|
||||
-->
|
||||
<title xmlns="http://www.w3.org/1999/html">noVNC</title>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||
Remove this if you use the .htaccess -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
|
||||
<!-- Icons (see Makefile for what the sizes are for) -->
|
||||
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
|
||||
<link rel="icon" sizes="24x24" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-24x24.png" %}">
|
||||
<link rel="icon" sizes="32x32" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-32x32.png" %}">
|
||||
<link rel="icon" sizes="48x48" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-48x48.png" %}">
|
||||
<link rel="icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
|
||||
<link rel="icon" sizes="64x64" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-64x64.png" %}">
|
||||
<link rel="icon" sizes="72x72" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-72x72.png" %}">
|
||||
<link rel="icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
|
||||
<link rel="icon" sizes="96x96" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-96x96.png" %}">
|
||||
<link rel="icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
|
||||
<link rel="icon" sizes="144x144" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-144x144.png" %}">
|
||||
<link rel="icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
|
||||
<link rel="icon" sizes="192x192" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-192x192.png" %}">
|
||||
<!-- Firefox currently mishandles SVG, see #1419039
|
||||
<link rel="icon" sizes="any" type="image/svg+xml" href="{% static "js/novnc/app/images/icons/novnc-icon.svg" %}">
|
||||
-->
|
||||
<!-- Repeated last so that legacy handling will pick this -->
|
||||
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
|
||||
|
||||
<!-- Apple iOS Safari settings -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<!-- Home Screen Icons (favourites and bookmarks use the normal icons) -->
|
||||
<link rel="apple-touch-icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
|
||||
|
||||
<!-- Stylesheets -->
|
||||
<link rel="stylesheet" href="{% static "js/novnc/app/styles/base.css" %}"/>
|
||||
|
||||
<!--
|
||||
<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
|
||||
-->
|
||||
|
||||
<!-- this is included as a normal file in order to catch script-loading errors as well -->
|
||||
<script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script>
|
||||
|
||||
<!-- begin scripts -->
|
||||
<script src="{% static "js/novnc/app.js" %}"></script>
|
||||
<!-- end scripts -->
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="noVNC_fallback_error" class="noVNC_center">
|
||||
<div>
|
||||
<div>noVNC encountered an error:</div>
|
||||
<br>
|
||||
<div id="noVNC_fallback_errormsg"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- noVNC Control Bar -->
|
||||
<div id="noVNC_control_bar_anchor" class="noVNC_vcenter">
|
||||
|
||||
<div id="noVNC_control_bar">
|
||||
<div id="noVNC_control_bar_handle" title="Hide/Show the control bar"><div></div></div>
|
||||
|
||||
<div class="noVNC_scroll">
|
||||
|
||||
<h1 class="noVNC_logo" translate="no"><span>no</span><br />VNC</h1>
|
||||
|
||||
<!-- Drag/Pan the viewport -->
|
||||
<input type="image" alt="viewport drag" src="{% static "js/novnc/app/images/drag.svg" %}"
|
||||
id="noVNC_view_drag_button" class="noVNC_button noVNC_hidden"
|
||||
title="Move/Drag Viewport" />
|
||||
|
||||
<!--noVNC Touch Device only buttons-->
|
||||
<div id="noVNC_mobile_buttons">
|
||||
<input type="image" alt="No mousebutton" src="{% static "js/novnc/app/images/mouse_none.svg" %}"
|
||||
id="noVNC_mouse_button0" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Left mousebutton" src="{% static "js/novnc/app/images/mouse_left.svg" %}"
|
||||
id="noVNC_mouse_button1" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Middle mousebutton" src="{% static "js/novnc/app/images/mouse_middle.svg" %}"
|
||||
id="noVNC_mouse_button2" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Right mousebutton" src="{% static "js/novnc/app/images/mouse_right.svg" %}"
|
||||
id="noVNC_mouse_button4" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Keyboard" src="{% static "js/novnc/app/images/keyboard.svg" %}"
|
||||
id="noVNC_keyboard_button" class="noVNC_button"
|
||||
value="Keyboard" title="Show Keyboard" />
|
||||
</div>
|
||||
|
||||
<!-- Extra manual keys -->
|
||||
<div id="noVNC_extra_keys">
|
||||
<input type="image" alt="Extra keys" src="{% static "js/novnc/app/images/toggleextrakeys.svg" %}"
|
||||
id="noVNC_toggle_extra_keys_button" class="noVNC_button"
|
||||
title="Show Extra Keys"/>
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_modifiers" class="noVNC_panel">
|
||||
<input type="image" alt="Ctrl" src="{% static "js/novnc/app/images/ctrl.svg" %}"
|
||||
id="noVNC_toggle_ctrl_button" class="noVNC_button"
|
||||
title="Toggle Ctrl"/>
|
||||
<input type="image" alt="Alt" src="{% static "js/novnc/app/images/alt.svg" %}"
|
||||
id="noVNC_toggle_alt_button" class="noVNC_button"
|
||||
title="Toggle Alt"/>
|
||||
<input type="image" alt="Tab" src="{% static "js/novnc/app/images/tab.svg" %}"
|
||||
id="noVNC_send_tab_button" class="noVNC_button"
|
||||
title="Send Tab"/>
|
||||
<input type="image" alt="Esc" src="{% static "js/novnc/app/images/esc.svg" %}"
|
||||
id="noVNC_send_esc_button" class="noVNC_button"
|
||||
title="Send Escape"/>
|
||||
<input type="image" alt="Ctrl+Alt+Del" src="{% static "js/novnc/app/images/ctrlaltdel.svg" %}"
|
||||
id="noVNC_send_ctrl_alt_del_button" class="noVNC_button"
|
||||
title="Send Ctrl-Alt-Del" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Shutdown/Reboot -->
|
||||
<input type="image" alt="Shutdown/Reboot" src="{% static "js/novnc/app/images/power.svg" %}"
|
||||
id="noVNC_power_button" class="noVNC_button"
|
||||
title="Shutdown/Reboot..." />
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_power" class="noVNC_panel">
|
||||
<div class="noVNC_heading">
|
||||
<img src="{% static "js/novnc/app/images/power.svg" %}"> Power
|
||||
</div>
|
||||
<input type="button" id="noVNC_shutdown_button" value="Shutdown" />
|
||||
<input type="button" id="noVNC_reboot_button" value="Reboot" />
|
||||
<input type="button" id="noVNC_reset_button" value="Reset" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Clipboard -->
|
||||
<input type="image" alt="Clipboard" src="{% static "js/novnc/app/images/clipboard.svg" %}"
|
||||
id="noVNC_clipboard_button" class="noVNC_button"
|
||||
title="Clipboard" />
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_clipboard" class="noVNC_panel">
|
||||
<div class="noVNC_heading">
|
||||
<img src="{% static "js/novnc/app/images/clipboard.svg" %}"> Clipboard
|
||||
</div>
|
||||
<textarea id="noVNC_clipboard_text" rows=5></textarea>
|
||||
<br />
|
||||
<input id="noVNC_clipboard_clear_button" type="button"
|
||||
value="Clear" class="noVNC_submit" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Toggle fullscreen -->
|
||||
<input type="image" alt="Fullscreen" src="{% static "js/novnc/app/images/fullscreen.svg" %}"
|
||||
id="noVNC_fullscreen_button" class="noVNC_button noVNC_hidden"
|
||||
title="Fullscreen" />
|
||||
|
||||
<!-- Settings -->
|
||||
<input type="image" alt="Settings" src="{% static "js/novnc/app/images/settings.svg" %}"
|
||||
id="noVNC_settings_button" class="noVNC_button"
|
||||
title="Settings" />
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_settings" class="noVNC_panel">
|
||||
<ul>
|
||||
<li class="noVNC_heading">
|
||||
<img src="{% static "js/novnc/app/images/settings.svg" %}"> Settings
|
||||
</li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_shared" type="checkbox" /> Shared Mode</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_view_only" type="checkbox" /> View Only</label>
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_view_clip" type="checkbox" /> Clip to Window</label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_resize">Scaling Mode:</label>
|
||||
<select id="noVNC_setting_resize" name="vncResize">
|
||||
<option value="off">None</option>
|
||||
<option value="scale">Local Scaling</option>
|
||||
<option value="remote">Remote Resizing</option>
|
||||
</select>
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<li>
|
||||
<div class="noVNC_expander">Advanced</div>
|
||||
<div><ul>
|
||||
<li>
|
||||
<label for="noVNC_setting_repeaterID">Repeater ID:</label>
|
||||
<input id="noVNC_setting_repeaterID" type="input" value="" />
|
||||
</li>
|
||||
<li>
|
||||
<div class="noVNC_expander">WebSocket</div>
|
||||
<div><ul>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_encrypt" type="checkbox" /> Encrypt</label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_host">Host:</label>
|
||||
<input id="noVNC_setting_host" value="{{ ws_host }}"/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_port">Port:</label>
|
||||
<input id="noVNC_setting_port" value="{{ ws_port }}" type="number" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_path">Path:</label>
|
||||
<input id="noVNC_setting_path" type="input" value="websockify" />
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_reconnect" type="checkbox" /> Automatic Reconnect</label>
|
||||
<input id="noVNC_setting_autoconnect" type="checkbox" value="true" hidden/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_reconnect_delay">Reconnect Delay (ms):</label>
|
||||
<input id="noVNC_setting_reconnect_delay" type="number" />
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<!-- Logging selection dropdown -->
|
||||
<li>
|
||||
<label>Logging:
|
||||
<select id="noVNC_setting_logging" name="vncLogging">
|
||||
</select>
|
||||
</label>
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Connection Controls -->
|
||||
<input type="image" alt="Disconnect" src="{% static "js/novnc/app/images/disconnect.svg" %}"
|
||||
id="noVNC_disconnect_button" class="noVNC_button"
|
||||
title="Disconnect" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="noVNC_control_bar_hint"></div>
|
||||
|
||||
</div> <!-- End of noVNC_control_bar -->
|
||||
|
||||
<!-- Status Dialog -->
|
||||
<div id="noVNC_status"></div>
|
||||
|
||||
<!-- Connect button -->
|
||||
<div class="noVNC_center">
|
||||
<div id="noVNC_connect_dlg">
|
||||
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
|
||||
<div id="noVNC_connect_button">
|
||||
<div>
|
||||
<img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Password Dialog -->
|
||||
<div class="noVNC_center noVNC_connect_layer">
|
||||
<div id="noVNC_password_dlg" class="noVNC_panel"><form>
|
||||
<ul>
|
||||
<li>
|
||||
<label>Password:</label>
|
||||
<input id="noVNC_password_input" type="password" />
|
||||
</li>
|
||||
<li>
|
||||
<input id="noVNC_password_button" type="submit" value="Send Password" class="noVNC_submit" />
|
||||
</li>
|
||||
</ul>
|
||||
</form></div>
|
||||
</div>
|
||||
|
||||
<!-- Transition Screens -->
|
||||
<div id="noVNC_transition">
|
||||
<div id="noVNC_transition_text"></div>
|
||||
<div>
|
||||
<input type="button" id="noVNC_cancel_reconnect_button" value="Cancel" class="noVNC_submit" />
|
||||
</div>
|
||||
<div class="noVNC_spinner"></div>
|
||||
</div>
|
||||
|
||||
<!-- This is where the RFB elements will attach -->
|
||||
<div id="noVNC_container">
|
||||
<!-- Note that Google Chrome on Android doesn't respect any of these,
|
||||
html attributes which attempt to disable text suggestions on the
|
||||
on-screen keyboard. Let's hope Chrome implements the ime-mode
|
||||
style for example -->
|
||||
<textarea id="noVNC_keyboardinput" autocapitalize="off"
|
||||
autocorrect="off" autocomplete="off" spellcheck="false"
|
||||
mozactionhint="Enter" tabindex="-1"></textarea>
|
||||
</div>
|
||||
|
||||
<audio id="noVNC_bell">
|
||||
<source src="{% static "js/novnc/app/sounds/bell.oga" %}" type="audio/ogg">
|
||||
<source src="{% static "js/novnc/app/sounds/bell.mp3" %}" type="audio/mpeg">
|
||||
</audio>
|
||||
{% endblock %}
|
|
@ -204,6 +204,30 @@ function sendCtrlAltDel()
|
|||
}
|
||||
}
|
||||
|
||||
function sendCtrlAltFN(f) {
|
||||
if (sc && sc.inputs && sc.inputs.state === "ready"){
|
||||
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
|
||||
|
||||
if (keys_code[f]==undefined) {
|
||||
return;
|
||||
}
|
||||
var key = new SpiceMsgcKeyDown();
|
||||
var msg = new SpiceMiniData();
|
||||
|
||||
update_modifier(true, KEY_LCtrl, sc);
|
||||
update_modifier(true, KEY_Alt, sc);
|
||||
|
||||
key.code = keys_code[f];
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
|
||||
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
|
||||
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
|
||||
}
|
||||
}
|
||||
|
||||
function update_modifier(state, code, sc)
|
||||
{
|
||||
var msg = new SpiceMiniData();
|
||||
|
|
Loading…
Reference in a new issue