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">
|
<div class="collapse navbar-collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li class="dropdown">
|
<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">
|
<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 class="divider"></li>
|
||||||
<li onclick='sendCtrlAltFN(0);'><a href='#'>Ctrl+Alt+F1</a></li>
|
<li id="ctrlaltf1"><a href='#'>Ctrl+Alt+F1</a></li>
|
||||||
<li onclick='sendCtrlAltFN(1);'><a href='#'>Ctrl+Alt+F2</a></li>
|
<li id="ctrlaltf2"><a href='#'>Ctrl+Alt+F2</a></li>
|
||||||
<li onclick='sendCtrlAltFN(2);'><a href='#'>Ctrl+Alt+F3</a></li>
|
<li id="ctrlaltf3"><a href='#'>Ctrl+Alt+F3</a></li>
|
||||||
<li onclick='sendCtrlAltFN(3);'><a href='#'>Ctrl+Alt+F4</a></li>
|
<li id="ctrlaltf4"><a href='#'>Ctrl+Alt+F4</a></li>
|
||||||
<li onclick='sendCtrlAltFN(4);'><a href='#'>Ctrl+Alt+F5</a></li>
|
<li id="ctrlaltf5"><a href='#'>Ctrl+Alt+F5</a></li>
|
||||||
<li onclick='sendCtrlAltFN(5);'><a href='#'>Ctrl+Alt+F6</a></li>
|
<li id="ctrlaltf6"><a href='#'>Ctrl+Alt+F6</a></li>
|
||||||
<li onclick='sendCtrlAltFN(6);'><a href='#'>Ctrl+Alt+F7</a></li>
|
<li id="ctrlaltf7"><a href='#'>Ctrl+Alt+F7</a></li>
|
||||||
<li onclick='sendCtrlAltFN(7);'><a href='#'>Ctrl+Alt+F8</a></li>
|
<li id="ctrlaltf8"><a href='#'>Ctrl+Alt+F8</a></li>
|
||||||
<li onclick='sendCtrlAltFN(8);'><a href='#'>Ctrl+Alt+F9</a></li>
|
<li id="ctrlaltf9"><a href='#'>Ctrl+Alt+F9</a></li>
|
||||||
<li onclick='sendCtrlAltFN(9);'><a href='#'>Ctrl+Alt+F10</a></li>
|
<li id="ctrlaltf10"><a href='#'>Ctrl+Alt+F10</a></li>
|
||||||
<li onclick='sendCtrlAltFN(10);'><a href='#'>Ctrl+Alt+F11</a></li>
|
<li id="ctrlaltf11"><a href='#'>Ctrl+Alt+F11</a></li>
|
||||||
<li onclick='sendCtrlAltFN(11);'><a href='#'>Ctrl+Alt+F12</a></li>
|
<li id="ctrlaltf12"><a href='#'>Ctrl+Alt+F12</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li id="fullscreen_button"><a href='#'>{% trans "Fullscreen" %}</a></li>
|
<li id="fullscreen_button"><a href='#'>{% trans "Fullscreen" %}</a></li>
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
/nav>
|
||||||
<div id='main_container' class="container">
|
<div id='main_container' class="container">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -188,30 +188,6 @@
|
||||||
resize_helper(sc);
|
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() {
|
function fullscreen() {
|
||||||
var screen=document.getElementById('spice-screen?');
|
var screen=document.getElementById('spice-screen?');
|
||||||
if(screen.requestFullscreen) {
|
if(screen.requestFullscreen) {
|
||||||
|
@ -236,7 +212,19 @@
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
document.getElementById("fullscreen_button").addEventListener('click', fullscreen);
|
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();
|
connect();
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% 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() {
|
function fullscreen() {
|
||||||
var screen=document.getElementById('spice-screen');
|
var screen=document.getElementById('spice-screen');
|
||||||
if(screen.requestFullscreen) {
|
if(screen.requestFullscreen) {
|
||||||
|
@ -259,6 +235,19 @@
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
document.getElementById("fullscreen_button").addEventListener('click', fullscreen);
|
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();
|
connect();
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
or the fragment:
|
or the fragment:
|
||||||
http://example.com/#host=HOST&port=PORT&encrypt=1
|
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" />
|
<meta charset="utf-8" />
|
||||||
|
|
||||||
|
@ -65,12 +65,26 @@
|
||||||
<script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script>
|
<script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script>
|
||||||
|
|
||||||
<!-- begin scripts -->
|
<!-- 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 -->
|
<!-- end scripts -->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div id="noVNC_fallback_error" class="noVNC_center">
|
<div id="noVNC_fallback_error" class="noVNC_center">
|
||||||
<div>
|
<div>
|
||||||
<div>noVNC encountered an error:</div>
|
<div>noVNC encountered an error:</div>
|
||||||
|
@ -274,9 +288,7 @@
|
||||||
<div id="noVNC_connect_dlg">
|
<div id="noVNC_connect_dlg">
|
||||||
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
|
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
|
||||||
<div id="noVNC_connect_button">
|
<div id="noVNC_connect_button">
|
||||||
<div>
|
<div><img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect</div>
|
||||||
<img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -63,9 +63,7 @@
|
||||||
<!-- promise polyfills promises for IE11 -->
|
<!-- promise polyfills promises for IE11 -->
|
||||||
<script src="{% static "js/novnc/vendor/promise.js" %}"></script>
|
<script src="{% static "js/novnc/vendor/promise.js" %}"></script>
|
||||||
<!-- ES2015/ES6 modules polyfill -->
|
<!-- ES2015/ES6 modules polyfill -->
|
||||||
<script type="module">
|
<script type="module"> window._noVNC_has_module_support = false;</script>
|
||||||
window._noVNC_has_module_support = true;
|
|
||||||
</script>
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("load", function() {
|
window.addEventListener("load", function() {
|
||||||
if (window._noVNC_has_module_support) return;
|
if (window._noVNC_has_module_support) return;
|
||||||
|
@ -76,6 +74,7 @@
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div id="noVNC_status_bar">
|
<div id="noVNC_status_bar">
|
||||||
|
@ -92,9 +91,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id='vnc_container'></div>
|
<div id='vnc_container'></div>
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block foot %}
|
|
||||||
<!-- actual script modules -->
|
<!-- actual script modules -->
|
||||||
<script type="module" crossorigin="anonymous">
|
<script type="module" crossorigin="anonymous">
|
||||||
// Load supporting scripts
|
// Load supporting scripts
|
||||||
|
@ -125,17 +122,38 @@
|
||||||
rfb.sendCredentials({ password: document.getElementById('password_input').value });
|
rfb.sendCredentials({ password: document.getElementById('password_input').value });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function sendCtrlAltFN(f) {
|
|
||||||
var keys_code=[0xFFBE,0xFFBF,0xFFC0,0xFFC1,0xFFC2,0xFFC3,0xFFC4,0xFFC5,0xFFC6,0xFFC7,0xFFC8,0xFFC9];
|
function fullscreen() {
|
||||||
if (keys_code[f]==undefined) {
|
if (document.fullscreenElement || // alternative standard method
|
||||||
return;
|
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');
|
} else {
|
||||||
rfb.sendKey(0xFFE9, 'down');
|
if (document.documentElement.requestFullscreen) {
|
||||||
rfb.sendKey(keys_code[f], 'down');
|
document.documentElement.requestFullscreen();
|
||||||
rfb.sendKey(keys_code[f], 'up');
|
} else if (document.documentElement.mozRequestFullScreen) {
|
||||||
rfb.sendKey(0xFFE9, 'up');
|
document.documentElement.mozRequestFullScreen();
|
||||||
rfb.sendKey(0xFFE3, 'up');
|
} 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() {
|
function sendCtrlAltDel() {
|
||||||
rfb.sendCtrlAltDel();
|
rfb.sendCtrlAltDel();
|
||||||
|
@ -199,6 +217,21 @@
|
||||||
document.getElementById('machineShutdownButton').onclick = machineShutdown;
|
document.getElementById('machineShutdownButton').onclick = machineShutdown;
|
||||||
document.getElementById('machineRebootButton').onclick = machineReboot;
|
document.getElementById('machineRebootButton').onclick = machineReboot;
|
||||||
document.getElementById('machineResetButton').onclick = machineReset;
|
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'));
|
WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn'));
|
||||||
document.title = WebUtil.getConfigVar('title', 'noVNC');
|
document.title = WebUtil.getConfigVar('title', 'noVNC');
|
||||||
|
@ -275,4 +308,6 @@
|
||||||
rfb.resizeSession = WebUtil.getConfigVar('resize', false);
|
rfb.resizeSession = WebUtil.getConfigVar('resize', false);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -111,7 +111,7 @@
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
||||||
<span class="glyphicon glyphicon-refresh"></span>
|
<span class="glyphicon glyphicon-refresh"></span>
|
||||||
</button>
|
</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>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</button>
|
</button>
|
||||||
{% endifequal %}
|
{% 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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* Copyright (C) 2012 Joel Martin
|
||||||
|
@ -16,7 +10,7 @@ exports.Localizer = Localizer;
|
||||||
* Localization Utilities
|
* Localization Utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function Localizer() {
|
export function Localizer() {
|
||||||
// Currently configured language
|
// Currently configured language
|
||||||
this.language = 'en';
|
this.language = 'en';
|
||||||
|
|
||||||
|
@ -48,7 +42,8 @@ Localizer.prototype = {
|
||||||
userLang = userLang.split("-");
|
userLang = userLang.split("-");
|
||||||
|
|
||||||
// Built-in default?
|
// Built-in default?
|
||||||
if (userLang[0] === 'en' && (userLang[1] === undefined || userLang[1] === 'us')) {
|
if ((userLang[0] === 'en') &&
|
||||||
|
((userLang[1] === undefined) || (userLang[1] === 'us'))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,8 +54,10 @@ Localizer.prototype = {
|
||||||
supLang = supLang.replace("_", "-");
|
supLang = supLang.replace("_", "-");
|
||||||
supLang = supLang.split("-");
|
supLang = supLang.split("-");
|
||||||
|
|
||||||
if (userLang[0] !== supLang[0]) continue;
|
if (userLang[0] !== supLang[0])
|
||||||
if (userLang[1] !== supLang[1]) continue;
|
continue;
|
||||||
|
if (userLang[1] !== supLang[1])
|
||||||
|
continue;
|
||||||
|
|
||||||
this.language = supportedLanguages[j];
|
this.language = supportedLanguages[j];
|
||||||
return;
|
return;
|
||||||
|
@ -73,8 +70,10 @@ Localizer.prototype = {
|
||||||
supLang = supLang.replace("_", "-");
|
supLang = supLang.replace("_", "-");
|
||||||
supLang = supLang.split("-");
|
supLang = supLang.split("-");
|
||||||
|
|
||||||
if (userLang[0] !== supLang[0]) continue;
|
if (userLang[0] !== supLang[0])
|
||||||
if (supLang[1] !== undefined) continue;
|
continue;
|
||||||
|
if (supLang[1] !== undefined)
|
||||||
|
continue;
|
||||||
|
|
||||||
this.language = supportedLanguages[j];
|
this.language = supportedLanguages[j];
|
||||||
return;
|
return;
|
||||||
|
@ -121,26 +120,34 @@ Localizer.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
if (elem.hasAttribute("abbr") && elem.tagName === "TH") {
|
if (elem.hasAttribute("abbr") &&
|
||||||
|
elem.tagName === "TH") {
|
||||||
translateAttribute(elem, "abbr");
|
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");
|
translateAttribute(elem, "alt");
|
||||||
}
|
}
|
||||||
if (elem.hasAttribute("download") && isAnyOf(elem.tagName, ["A", "AREA"])) {
|
if (elem.hasAttribute("download") &&
|
||||||
|
isAnyOf(elem.tagName, ["A", "AREA"])) {
|
||||||
translateAttribute(elem, "download");
|
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");
|
translateAttribute(elem, "label");
|
||||||
}
|
}
|
||||||
// FIXME: Should update "lang"
|
// 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");
|
translateAttribute(elem, "placeholder");
|
||||||
}
|
}
|
||||||
if (elem.hasAttribute("title")) {
|
if (elem.hasAttribute("title")) {
|
||||||
translateAttribute(elem, "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");
|
translateAttribute(elem, "value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,8 +163,8 @@ Localizer.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
process(document.body, true);
|
process(document.body, true);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var l10n = exports.l10n = new Localizer();
|
export var l10n = new Localizer();
|
||||||
exports.default = l10n.get.bind(l10n);
|
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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* 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.
|
* 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 = {
|
var UI = {
|
||||||
|
|
||||||
connected: false,
|
connected: false,
|
||||||
|
@ -95,20 +60,19 @@ var UI = {
|
||||||
start: function(callback) {
|
start: function(callback) {
|
||||||
|
|
||||||
// Setup global variables first
|
// 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();
|
UI.initSettings();
|
||||||
|
|
||||||
// Translate the DOM
|
// Translate the DOM
|
||||||
_localization.l10n.translateDOM();
|
l10n.translateDOM();
|
||||||
|
|
||||||
// Adapt the interface for touch screen devices
|
// Adapt the interface for touch screen devices
|
||||||
if (_browser.isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
document.documentElement.classList.add("noVNC_touch");
|
document.documentElement.classList.add("noVNC_touch");
|
||||||
// Remove the address bar
|
// Remove the address bar
|
||||||
setTimeout(function () {
|
setTimeout(function() { window.scrollTo(0, 1); }, 100);
|
||||||
window.scrollTo(0, 1);
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore control bar position
|
// Restore control bar position
|
||||||
|
@ -126,7 +90,8 @@ var UI = {
|
||||||
UI.addConnectionControlHandlers();
|
UI.addConnectionControlHandlers();
|
||||||
UI.addClipboardHandlers();
|
UI.addClipboardHandlers();
|
||||||
UI.addSettingsHandlers();
|
UI.addSettingsHandlers();
|
||||||
document.getElementById("noVNC_status").addEventListener('click', UI.hideStatus);
|
document.getElementById("noVNC_status")
|
||||||
|
.addEventListener('click', UI.hideStatus);
|
||||||
|
|
||||||
// Bootstrap fallback input handler
|
// Bootstrap fallback input handler
|
||||||
UI.keyboardinputReset();
|
UI.keyboardinputReset();
|
||||||
|
@ -137,7 +102,6 @@ var UI = {
|
||||||
|
|
||||||
document.documentElement.classList.remove("noVNC_loading");
|
document.documentElement.classList.remove("noVNC_loading");
|
||||||
|
|
||||||
// *ali*
|
|
||||||
//var autoconnect = WebUtil.getConfigVar('autoconnect', false);
|
//var autoconnect = WebUtil.getConfigVar('autoconnect', false);
|
||||||
var autoconnect = UI.getSetting('autoconnect');
|
var autoconnect = UI.getSetting('autoconnect');
|
||||||
if (autoconnect === 'true' || autoconnect == '1') {
|
if (autoconnect === 'true' || autoconnect == '1') {
|
||||||
|
@ -157,8 +121,13 @@ var UI = {
|
||||||
initFullscreen: function() {
|
initFullscreen: function() {
|
||||||
// Only show the button if fullscreen is properly supported
|
// Only show the button if fullscreen is properly supported
|
||||||
// * Safari doesn't support alphanumerical input while in fullscreen
|
// * Safari doesn't support alphanumerical input while in fullscreen
|
||||||
if (!UI.isSafari && (document.documentElement.requestFullscreen || document.documentElement.mozRequestFullScreen || document.documentElement.webkitRequestFullscreen || document.body.msRequestFullscreen)) {
|
if (!UI.isSafari &&
|
||||||
document.getElementById('noVNC_fullscreen_button').classList.remove("noVNC_hidden");
|
(document.documentElement.requestFullscreen ||
|
||||||
|
document.documentElement.mozRequestFullScreen ||
|
||||||
|
document.documentElement.webkitRequestFullscreen ||
|
||||||
|
document.body.msRequestFullscreen)) {
|
||||||
|
document.getElementById('noVNC_fullscreen_button')
|
||||||
|
.classList.remove("noVNC_hidden");
|
||||||
UI.addFullscreenHandlers();
|
UI.addFullscreenHandlers();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -182,7 +151,8 @@ var UI = {
|
||||||
if (!port) {
|
if (!port) {
|
||||||
if (window.location.protocol.substring(0,5) == 'https') {
|
if (window.location.protocol.substring(0,5) == 'https') {
|
||||||
port = 443;
|
port = 443;
|
||||||
} else if (window.location.protocol.substring(0, 4) == 'http') {
|
}
|
||||||
|
else if (window.location.protocol.substring(0,4) == 'http') {
|
||||||
port = 80;
|
port = 80;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +160,7 @@ var UI = {
|
||||||
/* Populate the controls if defaults are provided in the URL */
|
/* Populate the controls if defaults are provided in the URL */
|
||||||
UI.initSetting('host', window.location.hostname);
|
UI.initSetting('host', window.location.hostname);
|
||||||
UI.initSetting('port', port);
|
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('view_clip', false);
|
||||||
UI.initSetting('resize', 'off');
|
UI.initSetting('resize', 'off');
|
||||||
UI.initSetting('shared', true);
|
UI.initSetting('shared', true);
|
||||||
|
@ -230,19 +200,29 @@ var UI = {
|
||||||
* ------v------*/
|
* ------v------*/
|
||||||
|
|
||||||
addControlbarHandlers: function() {
|
addControlbarHandlers: function() {
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('mousemove', UI.activateControlbar);
|
document.getElementById("noVNC_control_bar")
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('mouseup', UI.activateControlbar);
|
.addEventListener('mousemove', UI.activateControlbar);
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('mousedown', UI.activateControlbar);
|
document.getElementById("noVNC_control_bar")
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('keydown', UI.activateControlbar);
|
.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")
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('keydown', UI.keepControlbar);
|
.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")
|
||||||
document.getElementById("noVNC_control_bar_handle").addEventListener('mouseup', UI.controlbarHandleMouseUp);
|
.addEventListener('mousedown', UI.controlbarHandleMouseDown);
|
||||||
document.getElementById("noVNC_control_bar_handle").addEventListener('mousemove', UI.dragControlbarHandle);
|
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
|
// resize events aren't available for elements
|
||||||
window.addEventListener('resize', UI.updateControlbarHandle);
|
window.addEventListener('resize', UI.updateControlbarHandle);
|
||||||
|
|
||||||
|
@ -253,43 +233,52 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
addTouchSpecificHandlers: function() {
|
addTouchSpecificHandlers: function() {
|
||||||
document.getElementById("noVNC_mouse_button0").addEventListener('click', function () {
|
document.getElementById("noVNC_mouse_button0")
|
||||||
UI.setMouseButton(1);
|
.addEventListener('click', function () { UI.setMouseButton(1); });
|
||||||
});
|
document.getElementById("noVNC_mouse_button1")
|
||||||
document.getElementById("noVNC_mouse_button1").addEventListener('click', function () {
|
.addEventListener('click', function () { UI.setMouseButton(2); });
|
||||||
UI.setMouseButton(2);
|
document.getElementById("noVNC_mouse_button2")
|
||||||
});
|
.addEventListener('click', function () { UI.setMouseButton(4); });
|
||||||
document.getElementById("noVNC_mouse_button2").addEventListener('click', function () {
|
document.getElementById("noVNC_mouse_button4")
|
||||||
UI.setMouseButton(4);
|
.addEventListener('click', function () { UI.setMouseButton(0); });
|
||||||
});
|
document.getElementById("noVNC_keyboard_button")
|
||||||
document.getElementById("noVNC_mouse_button4").addEventListener('click', function () {
|
.addEventListener('click', UI.toggleVirtualKeyboard);
|
||||||
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.onkeyevent = UI.keyEvent;
|
||||||
UI.touchKeyboard.grab();
|
UI.touchKeyboard.grab();
|
||||||
document.getElementById("noVNC_keyboardinput").addEventListener('input', UI.keyInput);
|
document.getElementById("noVNC_keyboardinput")
|
||||||
document.getElementById("noVNC_keyboardinput").addEventListener('focus', UI.onfocusVirtualKeyboard);
|
.addEventListener('input', UI.keyInput);
|
||||||
document.getElementById("noVNC_keyboardinput").addEventListener('blur', UI.onblurVirtualKeyboard);
|
document.getElementById("noVNC_keyboardinput")
|
||||||
document.getElementById("noVNC_keyboardinput").addEventListener('submit', function () {
|
.addEventListener('focus', UI.onfocusVirtualKeyboard);
|
||||||
return false;
|
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")
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('touchmove', UI.activateControlbar);
|
.addEventListener('touchstart', UI.activateControlbar);
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('touchend', UI.activateControlbar);
|
document.getElementById("noVNC_control_bar")
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('input', UI.activateControlbar);
|
.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")
|
||||||
document.getElementById("noVNC_control_bar").addEventListener('input', UI.keepControlbar);
|
.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")
|
||||||
document.getElementById("noVNC_control_bar_handle").addEventListener('touchend', UI.controlbarHandleMouseUp);
|
.addEventListener('touchstart', UI.controlbarHandleMouseDown);
|
||||||
document.getElementById("noVNC_control_bar_handle").addEventListener('touchmove', UI.dragControlbarHandle);
|
document.getElementById("noVNC_control_bar_handle")
|
||||||
|
.addEventListener('touchend', UI.controlbarHandleMouseUp);
|
||||||
|
document.getElementById("noVNC_control_bar_handle")
|
||||||
|
.addEventListener('touchmove', UI.dragControlbarHandle);
|
||||||
},
|
},
|
||||||
|
|
||||||
addExtraKeysHandlers: function() {
|
addExtraKeysHandlers: function() {
|
||||||
|
@ -299,33 +288,52 @@ var UI = {
|
||||||
document.getElementById("noVNC_send_tab_button").addEventListener('click', UI.sendTab);
|
document.getElementById("noVNC_send_tab_button").addEventListener('click', UI.sendTab);
|
||||||
document.getElementById("noVNC_send_esc_button").addEventListener('click', UI.sendEsc);
|
document.getElementById("noVNC_send_esc_button").addEventListener('click', UI.sendEsc);
|
||||||
document.getElementById("noVNC_send_ctrl_alt_del_button").addEventListener('click', UI.sendCtrlAltDel);
|
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() {
|
addMachineHandlers: function() {
|
||||||
document.getElementById("noVNC_shutdown_button").addEventListener('click', function () {
|
document.getElementById("noVNC_shutdown_button")
|
||||||
UI.rfb.machineShutdown();
|
.addEventListener('click', function() { UI.rfb.machineShutdown(); });
|
||||||
});
|
document.getElementById("noVNC_reboot_button")
|
||||||
document.getElementById("noVNC_reboot_button").addEventListener('click', function () {
|
.addEventListener('click', function() { UI.rfb.machineReboot(); });
|
||||||
UI.rfb.machineReboot();
|
document.getElementById("noVNC_reset_button")
|
||||||
});
|
.addEventListener('click', function() { UI.rfb.machineReset(); });
|
||||||
document.getElementById("noVNC_reset_button").addEventListener('click', function () {
|
document.getElementById("noVNC_power_button")
|
||||||
UI.rfb.machineReset();
|
.addEventListener('click', UI.togglePowerPanel);
|
||||||
});
|
|
||||||
document.getElementById("noVNC_power_button").addEventListener('click', UI.togglePowerPanel);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addConnectionControlHandlers: function() {
|
addConnectionControlHandlers: function() {
|
||||||
document.getElementById("noVNC_disconnect_button").addEventListener('click', UI.disconnect);
|
document.getElementById("noVNC_disconnect_button")
|
||||||
document.getElementById("noVNC_connect_button").addEventListener('click', UI.connect);
|
.addEventListener('click', UI.disconnect);
|
||||||
document.getElementById("noVNC_cancel_reconnect_button").addEventListener('click', UI.cancelReconnect);
|
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() {
|
addClipboardHandlers: function() {
|
||||||
document.getElementById("noVNC_clipboard_button").addEventListener('click', UI.toggleClipboardPanel);
|
document.getElementById("noVNC_clipboard_button")
|
||||||
document.getElementById("noVNC_clipboard_text").addEventListener('change', UI.clipboardSend);
|
.addEventListener('click', UI.toggleClipboardPanel);
|
||||||
document.getElementById("noVNC_clipboard_clear_button").addEventListener('click', UI.clipboardClear);
|
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,
|
// Add a call to save settings when the element changes,
|
||||||
|
@ -333,15 +341,14 @@ var UI = {
|
||||||
addSettingChangeHandler: function(name, changeFunc) {
|
addSettingChangeHandler: function(name, changeFunc) {
|
||||||
var settingElem = document.getElementById("noVNC_setting_" + name);
|
var settingElem = document.getElementById("noVNC_setting_" + name);
|
||||||
if (changeFunc === undefined) {
|
if (changeFunc === undefined) {
|
||||||
changeFunc = function () {
|
changeFunc = function () { UI.saveSetting(name); };
|
||||||
UI.saveSetting(name);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
settingElem.addEventListener('change', changeFunc);
|
settingElem.addEventListener('change', changeFunc);
|
||||||
},
|
},
|
||||||
|
|
||||||
addSettingsHandlers: function() {
|
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('encrypt');
|
||||||
UI.addSettingChangeHandler('resize');
|
UI.addSettingChangeHandler('resize');
|
||||||
|
@ -364,6 +371,7 @@ var UI = {
|
||||||
|
|
||||||
addFullscreenHandlers: function() {
|
addFullscreenHandlers: function() {
|
||||||
document.getElementById("noVNC_fullscreen_button").addEventListener('click', UI.toggleFullscreen);
|
document.getElementById("noVNC_fullscreen_button").addEventListener('click', UI.toggleFullscreen);
|
||||||
|
document.getElementById("fullscreen_button").addEventListener('click', UI.toggleFullscreen);
|
||||||
|
|
||||||
window.addEventListener('fullscreenchange', UI.updateFullscreenButton);
|
window.addEventListener('fullscreenchange', UI.updateFullscreenButton);
|
||||||
window.addEventListener('mozfullscreenchange', UI.updateFullscreenButton);
|
window.addEventListener('mozfullscreenchange', UI.updateFullscreenButton);
|
||||||
|
@ -390,25 +398,25 @@ var UI = {
|
||||||
case 'init':
|
case 'init':
|
||||||
break;
|
break;
|
||||||
case 'connecting':
|
case 'connecting':
|
||||||
transition_elem.textContent = (0, _localization2.default)("Connecting...");
|
transition_elem.textContent = _("Connecting...");
|
||||||
document.documentElement.classList.add("noVNC_connecting");
|
document.documentElement.classList.add("noVNC_connecting");
|
||||||
break;
|
break;
|
||||||
case 'connected':
|
case 'connected':
|
||||||
document.documentElement.classList.add("noVNC_connected");
|
document.documentElement.classList.add("noVNC_connected");
|
||||||
break;
|
break;
|
||||||
case 'disconnecting':
|
case 'disconnecting':
|
||||||
transition_elem.textContent = (0, _localization2.default)("Disconnecting...");
|
transition_elem.textContent = _("Disconnecting...");
|
||||||
document.documentElement.classList.add("noVNC_disconnecting");
|
document.documentElement.classList.add("noVNC_disconnecting");
|
||||||
break;
|
break;
|
||||||
case 'disconnected':
|
case 'disconnected':
|
||||||
break;
|
break;
|
||||||
case 'reconnecting':
|
case 'reconnecting':
|
||||||
transition_elem.textContent = (0, _localization2.default)("Reconnecting...");
|
transition_elem.textContent = _("Reconnecting...");
|
||||||
document.documentElement.classList.add("noVNC_reconnecting");
|
document.documentElement.classList.add("noVNC_reconnecting");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.Error("Invalid visual state: " + state);
|
Log.Error("Invalid visual state: " + state);
|
||||||
UI.showStatus((0, _localization2.default)("Internal error"), 'error');
|
UI.showStatus(_("Internal error"), 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +449,8 @@ var UI = {
|
||||||
UI.setViewDrag(false);
|
UI.setViewDrag(false);
|
||||||
|
|
||||||
// State change also closes the password dialog
|
// 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) {
|
showStatus: function(text, status_type, time) {
|
||||||
|
@ -465,7 +474,8 @@ var UI = {
|
||||||
visible_status_type = 'normal';
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,12 +523,14 @@ var UI = {
|
||||||
clearTimeout(UI.idleControlbarTimeout);
|
clearTimeout(UI.idleControlbarTimeout);
|
||||||
// We manipulate the anchor instead of the actual control
|
// We manipulate the anchor instead of the actual control
|
||||||
// bar in order to avoid creating new a stacking group
|
// 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);
|
UI.idleControlbarTimeout = window.setTimeout(UI.idleControlbar, 2000);
|
||||||
},
|
},
|
||||||
|
|
||||||
idleControlbar: function() {
|
idleControlbar: function() {
|
||||||
document.getElementById('noVNC_control_bar_anchor').classList.add("noVNC_idle");
|
document.getElementById('noVNC_control_bar_anchor')
|
||||||
|
.classList.add("noVNC_idle");
|
||||||
},
|
},
|
||||||
|
|
||||||
keepControlbar: function() {
|
keepControlbar: function() {
|
||||||
|
@ -526,16 +538,19 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
openControlbar: function() {
|
openControlbar: function() {
|
||||||
document.getElementById('noVNC_control_bar').classList.add("noVNC_open");
|
document.getElementById('noVNC_control_bar')
|
||||||
|
.classList.add("noVNC_open");
|
||||||
},
|
},
|
||||||
|
|
||||||
closeControlbar: function() {
|
closeControlbar: function() {
|
||||||
UI.closeAllPanels();
|
UI.closeAllPanels();
|
||||||
document.getElementById('noVNC_control_bar').classList.remove("noVNC_open");
|
document.getElementById('noVNC_control_bar')
|
||||||
|
.classList.remove("noVNC_open");
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleControlbar: function() {
|
toggleControlbar: function() {
|
||||||
if (document.getElementById('noVNC_control_bar').classList.contains("noVNC_open")) {
|
if (document.getElementById('noVNC_control_bar')
|
||||||
|
.classList.contains("noVNC_open")) {
|
||||||
UI.closeControlbar();
|
UI.closeControlbar();
|
||||||
} else {
|
} else {
|
||||||
UI.openControlbar();
|
UI.openControlbar();
|
||||||
|
@ -546,9 +561,7 @@ var UI = {
|
||||||
// Temporarily disable animation to avoid weird movement
|
// Temporarily disable animation to avoid weird movement
|
||||||
var bar = document.getElementById('noVNC_control_bar');
|
var bar = document.getElementById('noVNC_control_bar');
|
||||||
bar.style.transitionDuration = '0s';
|
bar.style.transitionDuration = '0s';
|
||||||
bar.addEventListener('transitionend', function () {
|
bar.addEventListener('transitionend', function () { this.style.transitionDuration = ""; });
|
||||||
this.style.transitionDuration = "";
|
|
||||||
});
|
|
||||||
|
|
||||||
var anchor = document.getElementById('noVNC_control_bar_anchor');
|
var anchor = document.getElementById('noVNC_control_bar_anchor');
|
||||||
if (anchor.classList.contains("noVNC_right")) {
|
if (anchor.classList.contains("noVNC_right")) {
|
||||||
|
@ -575,14 +588,14 @@ var UI = {
|
||||||
dragControlbarHandle: function (e) {
|
dragControlbarHandle: function (e) {
|
||||||
if (!UI.controlbarGrabbed) return;
|
if (!UI.controlbarGrabbed) return;
|
||||||
|
|
||||||
var ptr = (0, _events.getPointerEvent)(e);
|
var ptr = getPointerEvent(e);
|
||||||
|
|
||||||
var anchor = document.getElementById('noVNC_control_bar_anchor');
|
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")) {
|
if (anchor.classList.contains("noVNC_right")) {
|
||||||
UI.toggleControlbarSide();
|
UI.toggleControlbarSide();
|
||||||
}
|
}
|
||||||
} else if (ptr.clientX > window.innerWidth * 0.9) {
|
} else if (ptr.clientX > (window.innerWidth * 0.9)) {
|
||||||
if (!anchor.classList.contains("noVNC_right")) {
|
if (!anchor.classList.contains("noVNC_right")) {
|
||||||
UI.toggleControlbarSide();
|
UI.toggleControlbarSide();
|
||||||
}
|
}
|
||||||
|
@ -613,7 +626,8 @@ var UI = {
|
||||||
moveControlbarHandle: function (viewportRelativeY) {
|
moveControlbarHandle: function (viewportRelativeY) {
|
||||||
var handle = document.getElementById("noVNC_control_bar_handle");
|
var handle = document.getElementById("noVNC_control_bar_handle");
|
||||||
var handleHeight = handle.getBoundingClientRect().height;
|
var handleHeight = handle.getBoundingClientRect().height;
|
||||||
var controlbarBounds = document.getElementById("noVNC_control_bar").getBoundingClientRect();
|
var controlbarBounds = document.getElementById("noVNC_control_bar")
|
||||||
|
.getBoundingClientRect();
|
||||||
var margin = 10;
|
var margin = 10;
|
||||||
|
|
||||||
// These heights need to be non-zero for the below logic to work
|
// These heights need to be non-zero for the below logic to work
|
||||||
|
@ -627,14 +641,18 @@ var UI = {
|
||||||
if (newY < controlbarBounds.top + margin) {
|
if (newY < controlbarBounds.top + margin) {
|
||||||
// Force coordinates to be below the top of the control bar
|
// Force coordinates to be below the top of the control bar
|
||||||
newY = controlbarBounds.top + margin;
|
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
|
// 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
|
// Corner case: control bar too small for stable position
|
||||||
if (controlbarBounds.height < handleHeight + margin * 2) {
|
if (controlbarBounds.height < (handleHeight + margin * 2)) {
|
||||||
newY = controlbarBounds.top + (controlbarBounds.height - handleHeight) / 2;
|
newY = controlbarBounds.top +
|
||||||
|
(controlbarBounds.height - handleHeight) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The transform needs coordinates that are relative to the parent
|
// The transform needs coordinates that are relative to the parent
|
||||||
|
@ -651,7 +669,7 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
controlbarHandleMouseUp: function(e) {
|
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
|
// mouseup and mousedown on the same place toggles the controlbar
|
||||||
if (UI.controlbarGrabbed && !UI.controlbarDrag) {
|
if (UI.controlbarGrabbed && !UI.controlbarDrag) {
|
||||||
|
@ -666,16 +684,16 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
controlbarHandleMouseDown: function(e) {
|
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 handle = document.getElementById("noVNC_control_bar_handle");
|
||||||
var bounds = handle.getBoundingClientRect();
|
var bounds = handle.getBoundingClientRect();
|
||||||
|
|
||||||
// Touch events have implicit capture
|
// Touch events have implicit capture
|
||||||
if (e.type === "mousedown") {
|
if (e.type === "mousedown") {
|
||||||
(0, _events.setCapture)(handle);
|
setCapture(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI.controlbarGrabbed = true;
|
UI.controlbarGrabbed = true;
|
||||||
|
@ -731,6 +749,7 @@ var UI = {
|
||||||
var ctrl = document.getElementById('noVNC_setting_' + name);
|
var ctrl = document.getElementById('noVNC_setting_' + name);
|
||||||
if (ctrl.type === 'checkbox') {
|
if (ctrl.type === 'checkbox') {
|
||||||
ctrl.checked = value;
|
ctrl.checked = value;
|
||||||
|
|
||||||
} else if (typeof ctrl.options !== 'undefined') {
|
} else if (typeof ctrl.options !== 'undefined') {
|
||||||
for (var i = 0; i < ctrl.options.length; i += 1) {
|
for (var i = 0; i < ctrl.options.length; i += 1) {
|
||||||
if (ctrl.options[i].value === value) {
|
if (ctrl.options[i].value === value) {
|
||||||
|
@ -750,8 +769,7 @@ var UI = {
|
||||||
|
|
||||||
// Save control setting to cookie
|
// Save control setting to cookie
|
||||||
saveSetting: function(name) {
|
saveSetting: function(name) {
|
||||||
var val,
|
var val, ctrl = document.getElementById('noVNC_setting_' + name);
|
||||||
ctrl = document.getElementById('noVNC_setting_' + name);
|
|
||||||
if (ctrl.type === 'checkbox') {
|
if (ctrl.type === 'checkbox') {
|
||||||
val = ctrl.checked;
|
val = ctrl.checked;
|
||||||
} else if (typeof ctrl.options !== 'undefined') {
|
} else if (typeof ctrl.options !== 'undefined') {
|
||||||
|
@ -830,17 +848,22 @@ var UI = {
|
||||||
UI.updateSetting('reconnect');
|
UI.updateSetting('reconnect');
|
||||||
UI.updateSetting('reconnect_delay');
|
UI.updateSetting('reconnect_delay');
|
||||||
|
|
||||||
document.getElementById('noVNC_settings').classList.add("noVNC_open");
|
document.getElementById('noVNC_settings')
|
||||||
document.getElementById('noVNC_settings_button').classList.add("noVNC_selected");
|
.classList.add("noVNC_open");
|
||||||
|
document.getElementById('noVNC_settings_button')
|
||||||
|
.classList.add("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
closeSettingsPanel: function() {
|
closeSettingsPanel: function() {
|
||||||
document.getElementById('noVNC_settings').classList.remove("noVNC_open");
|
document.getElementById('noVNC_settings')
|
||||||
document.getElementById('noVNC_settings_button').classList.remove("noVNC_selected");
|
.classList.remove("noVNC_open");
|
||||||
|
document.getElementById('noVNC_settings_button')
|
||||||
|
.classList.remove("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSettingsPanel: function() {
|
toggleSettingsPanel: function() {
|
||||||
if (document.getElementById('noVNC_settings').classList.contains("noVNC_open")) {
|
if (document.getElementById('noVNC_settings')
|
||||||
|
.classList.contains("noVNC_open")) {
|
||||||
UI.closeSettingsPanel();
|
UI.closeSettingsPanel();
|
||||||
} else {
|
} else {
|
||||||
UI.openSettingsPanel();
|
UI.openSettingsPanel();
|
||||||
|
@ -857,17 +880,22 @@ var UI = {
|
||||||
UI.closeAllPanels();
|
UI.closeAllPanels();
|
||||||
UI.openControlbar();
|
UI.openControlbar();
|
||||||
|
|
||||||
document.getElementById('noVNC_power').classList.add("noVNC_open");
|
document.getElementById('noVNC_power')
|
||||||
document.getElementById('noVNC_power_button').classList.add("noVNC_selected");
|
.classList.add("noVNC_open");
|
||||||
|
document.getElementById('noVNC_power_button')
|
||||||
|
.classList.add("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
closePowerPanel: function() {
|
closePowerPanel: function() {
|
||||||
document.getElementById('noVNC_power').classList.remove("noVNC_open");
|
document.getElementById('noVNC_power')
|
||||||
document.getElementById('noVNC_power_button').classList.remove("noVNC_selected");
|
.classList.remove("noVNC_open");
|
||||||
|
document.getElementById('noVNC_power_button')
|
||||||
|
.classList.remove("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
togglePowerPanel: function() {
|
togglePowerPanel: function() {
|
||||||
if (document.getElementById('noVNC_power').classList.contains("noVNC_open")) {
|
if (document.getElementById('noVNC_power')
|
||||||
|
.classList.contains("noVNC_open")) {
|
||||||
UI.closePowerPanel();
|
UI.closePowerPanel();
|
||||||
} else {
|
} else {
|
||||||
UI.openPowerPanel();
|
UI.openPowerPanel();
|
||||||
|
@ -876,10 +904,14 @@ var UI = {
|
||||||
|
|
||||||
// Disable/enable power button
|
// Disable/enable power button
|
||||||
updatePowerButton: function() {
|
updatePowerButton: function() {
|
||||||
if (UI.connected && UI.rfb.capabilities.power && !UI.rfb.viewOnly) {
|
if (UI.connected &&
|
||||||
document.getElementById('noVNC_power_button').classList.remove("noVNC_hidden");
|
UI.rfb.capabilities.power &&
|
||||||
|
!UI.rfb.viewOnly) {
|
||||||
|
document.getElementById('noVNC_power_button')
|
||||||
|
.classList.remove("noVNC_hidden");
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('noVNC_power_button').classList.add("noVNC_hidden");
|
document.getElementById('noVNC_power_button')
|
||||||
|
.classList.add("noVNC_hidden");
|
||||||
// Close power panel if open
|
// Close power panel if open
|
||||||
UI.closePowerPanel();
|
UI.closePowerPanel();
|
||||||
}
|
}
|
||||||
|
@ -895,17 +927,22 @@ var UI = {
|
||||||
UI.closeAllPanels();
|
UI.closeAllPanels();
|
||||||
UI.openControlbar();
|
UI.openControlbar();
|
||||||
|
|
||||||
document.getElementById('noVNC_clipboard').classList.add("noVNC_open");
|
document.getElementById('noVNC_clipboard')
|
||||||
document.getElementById('noVNC_clipboard_button').classList.add("noVNC_selected");
|
.classList.add("noVNC_open");
|
||||||
|
document.getElementById('noVNC_clipboard_button')
|
||||||
|
.classList.add("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
closeClipboardPanel: function() {
|
closeClipboardPanel: function() {
|
||||||
document.getElementById('noVNC_clipboard').classList.remove("noVNC_open");
|
document.getElementById('noVNC_clipboard')
|
||||||
document.getElementById('noVNC_clipboard_button').classList.remove("noVNC_selected");
|
.classList.remove("noVNC_open");
|
||||||
|
document.getElementById('noVNC_clipboard_button')
|
||||||
|
.classList.remove("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleClipboardPanel: function() {
|
toggleClipboardPanel: function() {
|
||||||
if (document.getElementById('noVNC_clipboard').classList.contains("noVNC_open")) {
|
if (document.getElementById('noVNC_clipboard')
|
||||||
|
.classList.contains("noVNC_open")) {
|
||||||
UI.closeClipboardPanel();
|
UI.closeClipboardPanel();
|
||||||
} else {
|
} else {
|
||||||
UI.openClipboardPanel();
|
UI.openClipboardPanel();
|
||||||
|
@ -937,11 +974,13 @@ var UI = {
|
||||||
* ------v------*/
|
* ------v------*/
|
||||||
|
|
||||||
openConnectPanel: function() {
|
openConnectPanel: function() {
|
||||||
document.getElementById('noVNC_connect_dlg').classList.add("noVNC_open");
|
document.getElementById('noVNC_connect_dlg')
|
||||||
|
.classList.add("noVNC_open");
|
||||||
},
|
},
|
||||||
|
|
||||||
closeConnectPanel: function() {
|
closeConnectPanel: function() {
|
||||||
document.getElementById('noVNC_connect_dlg').classList.remove("noVNC_open");
|
document.getElementById('noVNC_connect_dlg')
|
||||||
|
.classList.remove("noVNC_open");
|
||||||
},
|
},
|
||||||
|
|
||||||
connect: function(event, password) {
|
connect: function(event, password) {
|
||||||
|
@ -968,7 +1007,7 @@ var UI = {
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
Log.Error("Can't connect when host is: " + 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,16 +1026,15 @@ var UI = {
|
||||||
}
|
}
|
||||||
url += '/' + path;
|
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'),
|
repeaterID: UI.getSetting('repeaterID'),
|
||||||
credentials: { password: password } });
|
credentials: { password: password } });
|
||||||
UI.rfb.addEventListener("connect", UI.connectFinished);
|
UI.rfb.addEventListener("connect", UI.connectFinished);
|
||||||
UI.rfb.addEventListener("disconnect", UI.disconnectFinished);
|
UI.rfb.addEventListener("disconnect", UI.disconnectFinished);
|
||||||
UI.rfb.addEventListener("credentialsrequired", UI.credentials);
|
UI.rfb.addEventListener("credentialsrequired", UI.credentials);
|
||||||
UI.rfb.addEventListener("securityfailure", UI.securityFailed);
|
UI.rfb.addEventListener("securityfailure", UI.securityFailed);
|
||||||
UI.rfb.addEventListener("capabilities", function () {
|
UI.rfb.addEventListener("capabilities", function () { UI.updatePowerButton(); });
|
||||||
UI.updatePowerButton();
|
|
||||||
});
|
|
||||||
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
|
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
|
||||||
UI.rfb.addEventListener("bell", UI.bell);
|
UI.rfb.addEventListener("bell", UI.bell);
|
||||||
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
|
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
|
||||||
|
@ -1050,9 +1088,9 @@ var UI = {
|
||||||
|
|
||||||
let msg;
|
let msg;
|
||||||
if (UI.getSetting('encrypt')) {
|
if (UI.getSetting('encrypt')) {
|
||||||
msg = (0, _localization2.default)("Connected (encrypted) to ") + UI.desktopName;
|
msg = _("Connected (encrypted) to ") + UI.desktopName;
|
||||||
} else {
|
} else {
|
||||||
msg = (0, _localization2.default)("Connected (unencrypted) to ") + UI.desktopName;
|
msg = _("Connected (unencrypted) to ") + UI.desktopName;
|
||||||
}
|
}
|
||||||
UI.showStatus(msg);
|
UI.showStatus(msg);
|
||||||
UI.updateVisualState('connected');
|
UI.updateVisualState('connected');
|
||||||
|
@ -1075,9 +1113,10 @@ var UI = {
|
||||||
if (!e.detail.clean) {
|
if (!e.detail.clean) {
|
||||||
UI.updateVisualState('disconnected');
|
UI.updateVisualState('disconnected');
|
||||||
if (wasConnected) {
|
if (wasConnected) {
|
||||||
UI.showStatus((0, _localization2.default)("Something went wrong, connection is closed"), 'error');
|
UI.showStatus(_("Something went wrong, connection is closed"),
|
||||||
|
'error');
|
||||||
} else {
|
} 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) {
|
} else if (UI.getSetting('reconnect', false) === true && !UI.inhibit_reconnect) {
|
||||||
UI.updateVisualState('reconnecting');
|
UI.updateVisualState('reconnecting');
|
||||||
|
@ -1087,7 +1126,7 @@ var UI = {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
UI.updateVisualState('disconnected');
|
UI.updateVisualState('disconnected');
|
||||||
UI.showStatus((0, _localization2.default)("Disconnected"), 'normal');
|
UI.showStatus(_("Disconnected"), 'normal');
|
||||||
}
|
}
|
||||||
|
|
||||||
UI.openControlbar();
|
UI.openControlbar();
|
||||||
|
@ -1100,9 +1139,10 @@ var UI = {
|
||||||
// directly from the server. Note that we can't control if
|
// directly from the server. Note that we can't control if
|
||||||
// this string is translated or not.
|
// this string is translated or not.
|
||||||
if ('reason' in e.detail) {
|
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 {
|
} else {
|
||||||
msg = (0, _localization2.default)("New connection has been rejected");
|
msg = _("New connection has been rejected");
|
||||||
}
|
}
|
||||||
UI.showStatus(msg, 'error');
|
UI.showStatus(msg, 'error');
|
||||||
},
|
},
|
||||||
|
@ -1115,14 +1155,15 @@ var UI = {
|
||||||
|
|
||||||
credentials: function(e) {
|
credentials: function(e) {
|
||||||
// FIXME: handle more types
|
// FIXME: handle more types
|
||||||
document.getElementById('noVNC_password_dlg').classList.add('noVNC_open');
|
document.getElementById('noVNC_password_dlg')
|
||||||
|
.classList.add('noVNC_open');
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
document.getElementById('noVNC_password_input').focus();
|
document.getElementById('noVNC_password_input').focus();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
Log.Warn("Server asked for a password");
|
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) {
|
setPassword: function(e) {
|
||||||
|
@ -1135,7 +1176,8 @@ var UI = {
|
||||||
inputElem.value = "";
|
inputElem.value = "";
|
||||||
UI.rfb.sendCredentials({ password: password });
|
UI.rfb.sendCredentials({ password: password });
|
||||||
UI.reconnect_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() {
|
toggleFullscreen: function() {
|
||||||
if (document.fullscreenElement || // alternative standard method
|
if (document.fullscreenElement || // alternative standard method
|
||||||
document.mozFullScreenElement || // currently working methods
|
document.mozFullScreenElement || // currently working methods
|
||||||
document.webkitFullscreenElement || document.msFullscreenElement) {
|
document.webkitFullscreenElement ||
|
||||||
|
document.msFullscreenElement) {
|
||||||
if (document.exitFullscreen) {
|
if (document.exitFullscreen) {
|
||||||
document.exitFullscreen();
|
document.exitFullscreen();
|
||||||
} else if (document.mozCancelFullScreen) {
|
} else if (document.mozCancelFullScreen) {
|
||||||
|
@ -1175,10 +1218,13 @@ var UI = {
|
||||||
updateFullscreenButton: function() {
|
updateFullscreenButton: function() {
|
||||||
if (document.fullscreenElement || // alternative standard method
|
if (document.fullscreenElement || // alternative standard method
|
||||||
document.mozFullScreenElement || // currently working methods
|
document.mozFullScreenElement || // currently working methods
|
||||||
document.webkitFullscreenElement || document.msFullscreenElement) {
|
document.webkitFullscreenElement ||
|
||||||
document.getElementById('noVNC_fullscreen_button').classList.add("noVNC_selected");
|
document.msFullscreenElement ) {
|
||||||
|
document.getElementById('noVNC_fullscreen_button')
|
||||||
|
.classList.add("noVNC_selected");
|
||||||
} else {
|
} 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 cur_clip = UI.rfb.clipViewport;
|
||||||
var new_clip = UI.getSetting('view_clip');
|
var new_clip = UI.getSetting('view_clip');
|
||||||
|
|
||||||
if (_browser.isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
// Touch devices usually have shit scrollbars
|
// Touch devices usually have shit scrollbars
|
||||||
new_clip = true;
|
new_clip = true;
|
||||||
}
|
}
|
||||||
|
@ -1227,7 +1273,8 @@ var UI = {
|
||||||
enableDisableViewClip: function() {
|
enableDisableViewClip: function() {
|
||||||
var resizeSetting = UI.getSetting('resize');
|
var resizeSetting = UI.getSetting('resize');
|
||||||
// Disable clipping if we are scaling, connected or on touch
|
// Disable clipping if we are scaling, connected or on touch
|
||||||
if (resizeSetting === 'scale' || _browser.isTouchDevice) {
|
if (resizeSetting === 'scale' ||
|
||||||
|
isTouchDevice) {
|
||||||
UI.disableSetting('view_clip');
|
UI.disableSetting('view_clip');
|
||||||
} else {
|
} else {
|
||||||
UI.enableSetting('view_clip');
|
UI.enableSetting('view_clip');
|
||||||
|
@ -1275,7 +1322,7 @@ var UI = {
|
||||||
|
|
||||||
// Different behaviour for touch vs non-touch
|
// Different behaviour for touch vs non-touch
|
||||||
// The button is disabled instead of hidden on touch devices
|
// The button is disabled instead of hidden on touch devices
|
||||||
if (_browser.isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
viewDragButton.classList.remove("noVNC_hidden");
|
viewDragButton.classList.remove("noVNC_hidden");
|
||||||
|
|
||||||
if (UI.rfb.clipViewport) {
|
if (UI.rfb.clipViewport) {
|
||||||
|
@ -1301,7 +1348,7 @@ var UI = {
|
||||||
* ------v------*/
|
* ------v------*/
|
||||||
|
|
||||||
showVirtualKeyboard: function() {
|
showVirtualKeyboard: function() {
|
||||||
if (!_browser.isTouchDevice) return;
|
if (!isTouchDevice) return;
|
||||||
|
|
||||||
var input = document.getElementById('noVNC_keyboardinput');
|
var input = document.getElementById('noVNC_keyboardinput');
|
||||||
|
|
||||||
|
@ -1317,7 +1364,7 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
hideVirtualKeyboard: function() {
|
hideVirtualKeyboard: function() {
|
||||||
if (!_browser.isTouchDevice) return;
|
if (!isTouchDevice) return;
|
||||||
|
|
||||||
var input = document.getElementById('noVNC_keyboardinput');
|
var input = document.getElementById('noVNC_keyboardinput');
|
||||||
|
|
||||||
|
@ -1327,7 +1374,8 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleVirtualKeyboard: function () {
|
toggleVirtualKeyboard: function () {
|
||||||
if (document.getElementById('noVNC_keyboard_button').classList.contains("noVNC_selected")) {
|
if (document.getElementById('noVNC_keyboard_button')
|
||||||
|
.classList.contains("noVNC_selected")) {
|
||||||
UI.hideVirtualKeyboard();
|
UI.hideVirtualKeyboard();
|
||||||
} else {
|
} else {
|
||||||
UI.showVirtualKeyboard();
|
UI.showVirtualKeyboard();
|
||||||
|
@ -1335,14 +1383,16 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onfocusVirtualKeyboard: function(event) {
|
onfocusVirtualKeyboard: function(event) {
|
||||||
document.getElementById('noVNC_keyboard_button').classList.add("noVNC_selected");
|
document.getElementById('noVNC_keyboard_button')
|
||||||
|
.classList.add("noVNC_selected");
|
||||||
if (UI.rfb) {
|
if (UI.rfb) {
|
||||||
UI.rfb.focusOnClick = false;
|
UI.rfb.focusOnClick = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onblurVirtualKeyboard: function(event) {
|
onblurVirtualKeyboard: function(event) {
|
||||||
document.getElementById('noVNC_keyboard_button').classList.remove("noVNC_selected");
|
document.getElementById('noVNC_keyboard_button')
|
||||||
|
.classList.remove("noVNC_selected");
|
||||||
if (UI.rfb) {
|
if (UI.rfb) {
|
||||||
UI.rfb.focusOnClick = true;
|
UI.rfb.focusOnClick = true;
|
||||||
}
|
}
|
||||||
|
@ -1435,10 +1485,10 @@ var UI = {
|
||||||
|
|
||||||
// Send the key events
|
// Send the key events
|
||||||
for (i = 0; i < backspaces; i++) {
|
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++) {
|
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
|
// Control the text content length in the keyboardinput element
|
||||||
|
@ -1469,17 +1519,22 @@ var UI = {
|
||||||
UI.closeAllPanels();
|
UI.closeAllPanels();
|
||||||
UI.openControlbar();
|
UI.openControlbar();
|
||||||
|
|
||||||
document.getElementById('noVNC_modifiers').classList.add("noVNC_open");
|
document.getElementById('noVNC_modifiers')
|
||||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.add("noVNC_selected");
|
.classList.add("noVNC_open");
|
||||||
|
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||||
|
.classList.add("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
closeExtraKeys: function() {
|
closeExtraKeys: function() {
|
||||||
document.getElementById('noVNC_modifiers').classList.remove("noVNC_open");
|
document.getElementById('noVNC_modifiers')
|
||||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.remove("noVNC_selected");
|
.classList.remove("noVNC_open");
|
||||||
|
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||||
|
.classList.remove("noVNC_selected");
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleExtraKeys: function() {
|
toggleExtraKeys: function() {
|
||||||
if (document.getElementById('noVNC_modifiers').classList.contains("noVNC_open")) {
|
if(document.getElementById('noVNC_modifiers')
|
||||||
|
.classList.contains("noVNC_open")) {
|
||||||
UI.closeExtraKeys();
|
UI.closeExtraKeys();
|
||||||
} else {
|
} else {
|
||||||
UI.openExtraKeys();
|
UI.openExtraKeys();
|
||||||
|
@ -1487,20 +1542,20 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
sendEsc: function() {
|
sendEsc: function() {
|
||||||
UI.rfb.sendKey(_keysym2.default.XK_Escape, "Escape");
|
UI.rfb.sendKey(KeyTable.XK_Escape, "Escape");
|
||||||
},
|
},
|
||||||
|
|
||||||
sendTab: function() {
|
sendTab: function() {
|
||||||
UI.rfb.sendKey(_keysym2.default.XK_Tab);
|
UI.rfb.sendKey(KeyTable.XK_Tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCtrl: function() {
|
toggleCtrl: function() {
|
||||||
var btn = document.getElementById('noVNC_toggle_ctrl_button');
|
var btn = document.getElementById('noVNC_toggle_ctrl_button');
|
||||||
if (btn.classList.contains("noVNC_selected")) {
|
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");
|
btn.classList.remove("noVNC_selected");
|
||||||
} else {
|
} 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");
|
btn.classList.add("noVNC_selected");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1508,10 +1563,10 @@ var UI = {
|
||||||
toggleAlt: function() {
|
toggleAlt: function() {
|
||||||
var btn = document.getElementById('noVNC_toggle_alt_button');
|
var btn = document.getElementById('noVNC_toggle_alt_button');
|
||||||
if (btn.classList.contains("noVNC_selected")) {
|
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");
|
btn.classList.remove("noVNC_selected");
|
||||||
} else {
|
} 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");
|
btn.classList.add("noVNC_selected");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1520,6 +1575,10 @@ var UI = {
|
||||||
UI.rfb.sendCtrlAltDel();
|
UI.rfb.sendCtrlAltDel();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sendCtrlAltFN: function(f) {
|
||||||
|
UI.rfb.sendCtrlAltFN(f);
|
||||||
|
},
|
||||||
|
|
||||||
/* ------^-------
|
/* ------^-------
|
||||||
* /EXTRA KEYS
|
* /EXTRA KEYS
|
||||||
* ==============
|
* ==============
|
||||||
|
@ -1534,7 +1593,8 @@ var UI = {
|
||||||
|
|
||||||
var blist = [0, 1,2,4];
|
var blist = [0, 1,2,4];
|
||||||
for (var b = 0; b < blist.length; b++) {
|
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) {
|
if (blist[b] === num && !view_only) {
|
||||||
button.classList.remove("noVNC_hidden");
|
button.classList.remove("noVNC_hidden");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1549,11 +1609,15 @@ var UI = {
|
||||||
|
|
||||||
// Hide input related buttons in view only mode
|
// Hide input related buttons in view only mode
|
||||||
if (UI.rfb.viewOnly) {
|
if (UI.rfb.viewOnly) {
|
||||||
document.getElementById('noVNC_keyboard_button').classList.add('noVNC_hidden');
|
document.getElementById('noVNC_keyboard_button')
|
||||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.add('noVNC_hidden');
|
.classList.add('noVNC_hidden');
|
||||||
|
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||||
|
.classList.add('noVNC_hidden');
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('noVNC_keyboard_button').classList.remove('noVNC_hidden');
|
document.getElementById('noVNC_keyboard_button')
|
||||||
document.getElementById('noVNC_toggle_extra_keys_button').classList.remove('noVNC_hidden');
|
.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
|
UI.setMouseButton(1); //has it's own logic for hiding/showing
|
||||||
},
|
},
|
||||||
|
@ -1592,7 +1656,7 @@ var UI = {
|
||||||
optn.text = text;
|
optn.text = text;
|
||||||
optn.value = value;
|
optn.value = value;
|
||||||
selectbox.options.add(optn);
|
selectbox.options.add(optn);
|
||||||
}
|
},
|
||||||
|
|
||||||
/* ------^-------
|
/* ------^-------
|
||||||
* /MISC
|
* /MISC
|
||||||
|
@ -1602,10 +1666,10 @@ var UI = {
|
||||||
|
|
||||||
// Set up translations
|
// Set up translations
|
||||||
var LINGUAS = ["de", "el", "es", "nl", "pl", "sv", "tr", "zh"];
|
var LINGUAS = ["de", "el", "es", "nl", "pl", "sv", "tr", "zh"];
|
||||||
_localization.l10n.setup(LINGUAS);
|
l10n.setup(LINGUAS);
|
||||||
if (_localization.l10n.language !== "en" && _localization.l10n.dictionary === undefined) {
|
if (l10n.language !== "en" && l10n.dictionary === undefined) {
|
||||||
WebUtil.fetchJSON('../static/js/novnc/app/locale/' + _localization.l10n.language + '.json', function (translations) {
|
WebUtil.fetchJSON('/static/js/novnc/app/locale/' + l10n.language + '.json', function (translations) {
|
||||||
_localization.l10n.dictionary = translations;
|
l10n.dictionary = translations;
|
||||||
|
|
||||||
// wait for translations to load before loading the UI
|
// wait for translations to load before loading the UI
|
||||||
UI.prime();
|
UI.prime();
|
||||||
|
@ -1617,4 +1681,4 @@ if (_localization.l10n.language !== "en" && _localization.l10n.dictionary === un
|
||||||
UI.prime();
|
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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* Copyright (C) 2012 Joel Martin
|
||||||
* Copyright (C) 2013 NTT corp.
|
* Copyright (C) 2013 NTT corp.
|
||||||
|
@ -38,17 +7,25 @@ function init_logging(level) {
|
||||||
* See README.md for usage and integration instructions.
|
* 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
|
// Read a query string variable
|
||||||
function getQueryVar(name, defVal) {
|
export function getQueryVar (name, defVal) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
|
var re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
|
||||||
match = document.location.href.match(re);
|
match = document.location.href.match(re);
|
||||||
if (typeof defVal === 'undefined') {
|
if (typeof defVal === 'undefined') { defVal = null; }
|
||||||
defVal = null;
|
|
||||||
}
|
|
||||||
if (match) {
|
if (match) {
|
||||||
return decodeURIComponent(match[1]);
|
return decodeURIComponent(match[1]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -57,14 +34,11 @@ function getQueryVar(name, defVal) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Read a hash fragment variable
|
// Read a hash fragment variable
|
||||||
function getHashVar(name, defVal) {
|
export function getHashVar (name, defVal) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var re = new RegExp('.*[&#]' + name + '=([^&]*)'),
|
var re = new RegExp('.*[&#]' + name + '=([^&]*)'),
|
||||||
match = document.location.hash.match(re);
|
match = document.location.hash.match(re);
|
||||||
if (typeof defVal === 'undefined') {
|
if (typeof defVal === 'undefined') { defVal = null; }
|
||||||
defVal = null;
|
|
||||||
}
|
|
||||||
if (match) {
|
if (match) {
|
||||||
return decodeURIComponent(match[1]);
|
return decodeURIComponent(match[1]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,9 +48,8 @@ function getHashVar(name, defVal) {
|
||||||
|
|
||||||
// Read a variable from the fragment or the query string
|
// Read a variable from the fragment or the query string
|
||||||
// Fragment takes precedence
|
// Fragment takes precedence
|
||||||
function getConfigVar(name, defVal) {
|
export function getConfigVar (name, defVal) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var val = getHashVar(name);
|
var val = getHashVar(name);
|
||||||
if (val === null) {
|
if (val === null) {
|
||||||
val = getQueryVar(name, defVal);
|
val = getQueryVar(name, defVal);
|
||||||
|
@ -89,13 +62,12 @@ function getConfigVar(name, defVal) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// No days means only for this browser session
|
// No days means only for this browser session
|
||||||
function createCookie(name, value, days) {
|
export function createCookie (name, value, days) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var date, expires;
|
var date, expires;
|
||||||
if (days) {
|
if (days) {
|
||||||
date = new Date();
|
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();
|
expires = "; expires=" + date.toGMTString();
|
||||||
} else {
|
} else {
|
||||||
expires = "";
|
expires = "";
|
||||||
|
@ -110,27 +82,21 @@ function createCookie(name, value, days) {
|
||||||
document.cookie = name + "=" + value + expires + "; path=/" + secure;
|
document.cookie = name + "=" + value + expires + "; path=/" + secure;
|
||||||
};
|
};
|
||||||
|
|
||||||
function readCookie(name, defaultValue) {
|
export function readCookie (name, defaultValue) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var nameEQ = name + "=",
|
var nameEQ = name + "=",
|
||||||
ca = document.cookie.split(';');
|
ca = document.cookie.split(';');
|
||||||
|
|
||||||
for (var i = 0; i < ca.length; i += 1) {
|
for (var i = 0; i < ca.length; i += 1) {
|
||||||
var c = ca[i];
|
var c = ca[i];
|
||||||
while (c.charAt(0) === ' ') {
|
while (c.charAt(0) === ' ') { c = c.substring(1, c.length); }
|
||||||
c = c.substring(1, c.length);
|
if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length, c.length); }
|
||||||
}
|
}
|
||||||
if (c.indexOf(nameEQ) === 0) {
|
return (typeof defaultValue !== 'undefined') ? defaultValue : null;
|
||||||
return c.substring(nameEQ.length, c.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return typeof defaultValue !== 'undefined' ? defaultValue : null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function eraseCookie(name) {
|
export function eraseCookie (name) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
createCookie(name, "", -1);
|
createCookie(name, "", -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,9 +106,8 @@ function eraseCookie(name) {
|
||||||
|
|
||||||
var settings = {};
|
var settings = {};
|
||||||
|
|
||||||
function initSettings(callback /*, ...callbackArgs */) {
|
export function initSettings (callback /*, ...callbackArgs */) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var callbackArgs = Array.prototype.slice.call(arguments, 1);
|
var callbackArgs = Array.prototype.slice.call(arguments, 1);
|
||||||
if (window.chrome && window.chrome.storage) {
|
if (window.chrome && window.chrome.storage) {
|
||||||
window.chrome.storage.sync.get(function (cfg) {
|
window.chrome.storage.sync.get(function (cfg) {
|
||||||
|
@ -160,9 +125,8 @@ function initSettings(callback /*, ...callbackArgs */) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// No days means only for this browser session
|
// No days means only for this browser session
|
||||||
function writeSetting(name, value) {
|
export function writeSetting (name, value) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (window.chrome && window.chrome.storage) {
|
if (window.chrome && window.chrome.storage) {
|
||||||
if (settings[name] !== value) {
|
if (settings[name] !== value) {
|
||||||
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";
|
"use strict";
|
||||||
|
|
||||||
var value;
|
var value;
|
||||||
if (window.chrome && window.chrome.storage) {
|
if (window.chrome && window.chrome.storage) {
|
||||||
value = settings[name];
|
value = settings[name];
|
||||||
|
@ -192,9 +155,8 @@ function readSetting(name, defaultValue) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function eraseSetting(name) {
|
export function eraseSetting (name) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (window.chrome && window.chrome.storage) {
|
if (window.chrome && window.chrome.storage) {
|
||||||
window.chrome.storage.sync.remove(name);
|
window.chrome.storage.sync.remove(name);
|
||||||
delete settings[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
|
// force pretend that we're dealing with a relative path
|
||||||
// (assume that we wanted an extra if we pass one in)
|
// (assume that we wanted an extra if we pass one in)
|
||||||
path = "/" + path;
|
path = "/" + path;
|
||||||
|
@ -219,9 +181,7 @@ function injectParamIfMissing(path, param, value) {
|
||||||
query = [];
|
query = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!query.some(function (v) {
|
if (!query.some(function (v) { return v.startsWith(param_eq); })) {
|
||||||
return v.startsWith(param_eq);
|
|
||||||
})) {
|
|
||||||
query.push(param_eq + encodeURIComponent(value));
|
query.push(param_eq + encodeURIComponent(value));
|
||||||
elem.search = "?" + query.join("&");
|
elem.search = "?" + query.join("&");
|
||||||
}
|
}
|
||||||
|
@ -239,7 +199,7 @@ function injectParamIfMissing(path, param, value) {
|
||||||
// IE11 support or polyfill promises and fetch in IE11.
|
// IE11 support or polyfill promises and fetch in IE11.
|
||||||
// resolve will receive an object on success, while reject
|
// resolve will receive an object on success, while reject
|
||||||
// will receive either an event or an error on failure.
|
// 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
|
// NB: IE11 doesn't support JSON as a responseType
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.open('GET', path);
|
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", {
|
// From: http://hg.mozilla.org/mozilla-central/raw-file/ec10630b1a54/js/src/devtools/jint/sunspider/string-base64.js
|
||||||
value: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var _logging = require('./util/logging.js');
|
import * as Log from './util/logging.js';
|
||||||
|
|
||||||
var Log = _interopRequireWildcard(_logging);
|
export default {
|
||||||
|
|
||||||
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 = {
|
|
||||||
/* Convert data (an array of integers) to a Base64 string. */
|
/* Convert data (an array of integers) to a Base64 string. */
|
||||||
toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''),
|
toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''),
|
||||||
base64Pad : '=',
|
base64Pad : '=',
|
||||||
|
|
||||||
encode: function (data) {
|
encode: function (data) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var result = '';
|
var result = '';
|
||||||
var toBase64Table = this.toBase64Table;
|
var toBase64Table = this.toBase64Table;
|
||||||
var length = data.length;
|
var length = data.length;
|
||||||
var lengthpad = length % 3;
|
var lengthpad = (length % 3);
|
||||||
// Convert every three bytes to 4 ascii characters.
|
// 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] >> 2];
|
||||||
result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
|
result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
|
||||||
result += toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)];
|
result += toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)];
|
||||||
|
@ -51,12 +46,20 @@ exports.default = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Convert Base64 data to a string */
|
/* 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) {
|
decode: function (data, offset) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
offset = typeof(offset) !== 'undefined' ? offset : 0;
|
||||||
offset = typeof offset !== 'undefined' ? offset : 0;
|
|
||||||
var toBinaryTable = this.toBinaryTable;
|
var toBinaryTable = this.toBinaryTable;
|
||||||
var base64Pad = this.base64Pad;
|
var base64Pad = this.base64Pad;
|
||||||
var result, result_length;
|
var result, result_length;
|
||||||
|
@ -64,18 +67,16 @@ exports.default = {
|
||||||
var leftdata = 0; // bits decoded, but yet to be appended
|
var leftdata = 0; // bits decoded, but yet to be appended
|
||||||
var data_length = data.indexOf('=') - offset;
|
var data_length = data.indexOf('=') - offset;
|
||||||
|
|
||||||
if (data_length < 0) {
|
if (data_length < 0) { data_length = data.length - offset; }
|
||||||
data_length = data.length - offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Every four characters is 3 resulting numbers */
|
/* 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);
|
result = new Array(result_length);
|
||||||
|
|
||||||
// Convert one by one.
|
// Convert one by one.
|
||||||
for (var idx = 0, i = offset; i < data.length; i++) {
|
for (var idx = 0, i = offset; i < data.length; i++) {
|
||||||
var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||||
var padding = data.charAt(i) === base64Pad;
|
var padding = (data.charAt(i) === base64Pad);
|
||||||
// Skip illegal characters and whitespace
|
// Skip illegal characters and whitespace
|
||||||
if (c === -1) {
|
if (c === -1) {
|
||||||
Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
|
Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
|
||||||
|
@ -83,7 +84,7 @@ exports.default = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect data into leftdata, update bitcount
|
// Collect data into leftdata, update bitcount
|
||||||
leftdata = leftdata << 6 | c;
|
leftdata = (leftdata << 6) | c;
|
||||||
leftbits += 6;
|
leftbits += 6;
|
||||||
|
|
||||||
// If we have 8 or more bits, append 8 bits to the result
|
// If we have 8 or more bits, append 8 bits to the result
|
||||||
|
@ -91,7 +92,7 @@ exports.default = {
|
||||||
leftbits -= 8;
|
leftbits -= 8;
|
||||||
// Append if not padding.
|
// Append if not padding.
|
||||||
if (!padding) {
|
if (!padding) {
|
||||||
result[idx++] = leftdata >> leftbits & 0xff;
|
result[idx++] = (leftdata >> leftbits) & 0xff;
|
||||||
}
|
}
|
||||||
leftdata &= (1 << leftbits) - 1;
|
leftdata &= (1 << leftbits) - 1;
|
||||||
}
|
}
|
||||||
|
@ -107,8 +108,3 @@ exports.default = {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}; /* End of Base64 namespace */
|
}; /* 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:
|
* Ported from Flashlight VNC ActionScript implementation:
|
||||||
* http://www.wizhelp.com/flashlight-vnc/
|
* http://www.wizhelp.com/flashlight-vnc/
|
||||||
|
@ -81,67 +75,67 @@ exports.default = DES;
|
||||||
* fine Java utilities: http://www.acme.com/java/
|
* fine Java utilities: http://www.acme.com/java/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function DES(passwd) {
|
export default function DES(passwd) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Tables, permutations, S-boxes, etc.
|
// Tables, permutations, S-boxes, etc.
|
||||||
|
var PC2 = [13,16,10,23, 0, 4, 2,27,14, 5,20, 9,22,18,11, 3,
|
||||||
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],
|
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],
|
totrot = [ 1, 2, 4, 6, 8,10,12,14,15,17,19,21,23,25,27,28],
|
||||||
z = 0x0,
|
z = 0x0, a,b,c,d,e,f, SP1,SP2,SP3,SP4,SP5,SP6,SP7,SP8,
|
||||||
a,
|
|
||||||
b,
|
|
||||||
c,
|
|
||||||
d,
|
|
||||||
e,
|
|
||||||
f,
|
|
||||||
SP1,
|
|
||||||
SP2,
|
|
||||||
SP3,
|
|
||||||
SP4,
|
|
||||||
SP5,
|
|
||||||
SP6,
|
|
||||||
SP7,
|
|
||||||
SP8,
|
|
||||||
keys = [];
|
keys = [];
|
||||||
|
|
||||||
a=1<<16; b=1<<24; c=a|b; d=1<<2; e=1<<10; f=d|e;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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.
|
// Set the key.
|
||||||
function setKeys(keyBlock) {
|
function setKeys(keyBlock) {
|
||||||
var i,
|
var i, j, l, m, n, o, pc1m = [], pcr = [], kn = [],
|
||||||
j,
|
raw0, raw1, rawi, KnLi;
|
||||||
l,
|
|
||||||
m,
|
|
||||||
n,
|
|
||||||
o,
|
|
||||||
pc1m = [],
|
|
||||||
pcr = [],
|
|
||||||
kn = [],
|
|
||||||
raw0,
|
|
||||||
raw1,
|
|
||||||
rawi,
|
|
||||||
KnLi;
|
|
||||||
|
|
||||||
for (j = 0, l = 56; j < 56; ++j, l -= 8) {
|
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
|
l += l < -5 ? 65 : l < -3 ? 31 : l < -1 ? 63 : l === 27 ? 35 : 0; // PC1
|
||||||
m = l & 0x7;
|
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) {
|
for (i = 0; i < 16; ++i) {
|
||||||
|
@ -160,10 +154,10 @@ function DES(passwd) {
|
||||||
}
|
}
|
||||||
for (j = 0; j < 24; ++j) {
|
for (j = 0; j < 24; ++j) {
|
||||||
if (pcr[PC2[j]] !== 0) {
|
if (pcr[PC2[j]] !== 0) {
|
||||||
kn[m] |= 1 << 23 - j;
|
kn[m] |= 1 << (23 - j);
|
||||||
}
|
}
|
||||||
if (pcr[PC2[j + 24]] !== 0) {
|
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 & 0x0003f000) << 12;
|
||||||
keys[KnLi] |= (raw0 & 0x0000003f) << 16;
|
keys[KnLi] |= (raw0 & 0x0000003f) << 16;
|
||||||
keys[KnLi] |= (raw1 & 0x0003f000) >>> 4;
|
keys[KnLi] |= (raw1 & 0x0003f000) >>> 4;
|
||||||
keys[KnLi] |= raw1 & 0x0000003f;
|
keys[KnLi] |= (raw1 & 0x0000003f);
|
||||||
++KnLi;
|
++KnLi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encrypt 8 bytes of text
|
// Encrypt 8 bytes of text
|
||||||
function enc8(text) {
|
function enc8(text) {
|
||||||
var i = 0,
|
var i = 0, b = text.slice(), fval, keysi = 0,
|
||||||
b = text.slice(),
|
l, r, x; // left, right, accumulator
|
||||||
fval,
|
|
||||||
keysi = 0,
|
|
||||||
l,
|
|
||||||
r,
|
|
||||||
x; // left, right, accumulator
|
|
||||||
|
|
||||||
// Squash 8 bytes to 2 ints
|
// Squash 8 bytes to 2 ints
|
||||||
l = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++];
|
l = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++];
|
||||||
r = 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;
|
r ^= x;
|
||||||
l ^= x << 4;
|
l ^= (x << 4);
|
||||||
x = (l >>> 16 ^ r) & 0x0000ffff;
|
x = ((l >>> 16) ^ r) & 0x0000ffff;
|
||||||
r ^= x;
|
r ^= x;
|
||||||
l ^= x << 16;
|
l ^= (x << 16);
|
||||||
x = (r >>> 2 ^ l) & 0x33333333;
|
x = ((r >>> 2) ^ l) & 0x33333333;
|
||||||
l ^= x;
|
l ^= x;
|
||||||
r ^= x << 2;
|
r ^= (x << 2);
|
||||||
x = (r >>> 8 ^ l) & 0x00ff00ff;
|
x = ((r >>> 8) ^ l) & 0x00ff00ff;
|
||||||
l ^= x;
|
l ^= x;
|
||||||
r ^= x << 8;
|
r ^= (x << 8);
|
||||||
r = r << 1 | r >>> 31 & 1;
|
r = (r << 1) | ((r >>> 31) & 1);
|
||||||
x = (l ^ r) & 0xaaaaaaaa;
|
x = (l ^ r) & 0xaaaaaaaa;
|
||||||
l ^= x;
|
l ^= x;
|
||||||
r ^= x;
|
r ^= x;
|
||||||
l = l << 1 | l >>> 31 & 1;
|
l = (l << 1) | ((l >>> 31) & 1);
|
||||||
|
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
x = r << 28 | r >>> 4;
|
x = (r << 28) | (r >>> 4);
|
||||||
x ^= keys[keysi++];
|
x ^= keys[keysi++];
|
||||||
fval = SP7[x & 0x3f];
|
fval = SP7[x & 0x3f];
|
||||||
fval |= SP5[x >>> 8 & 0x3f];
|
fval |= SP5[(x >>> 8) & 0x3f];
|
||||||
fval |= SP3[x >>> 16 & 0x3f];
|
fval |= SP3[(x >>> 16) & 0x3f];
|
||||||
fval |= SP1[x >>> 24 & 0x3f];
|
fval |= SP1[(x >>> 24) & 0x3f];
|
||||||
x = r ^ keys[keysi++];
|
x = r ^ keys[keysi++];
|
||||||
fval |= SP8[x & 0x3f];
|
fval |= SP8[x & 0x3f];
|
||||||
fval |= SP6[x >>> 8 & 0x3f];
|
fval |= SP6[(x >>> 8) & 0x3f];
|
||||||
fval |= SP4[x >>> 16 & 0x3f];
|
fval |= SP4[(x >>> 16) & 0x3f];
|
||||||
fval |= SP2[x >>> 24 & 0x3f];
|
fval |= SP2[(x >>> 24) & 0x3f];
|
||||||
l ^= fval;
|
l ^= fval;
|
||||||
x = l << 28 | l >>> 4;
|
x = (l << 28) | (l >>> 4);
|
||||||
x ^= keys[keysi++];
|
x ^= keys[keysi++];
|
||||||
fval = SP7[x & 0x3f];
|
fval = SP7[x & 0x3f];
|
||||||
fval |= SP5[x >>> 8 & 0x3f];
|
fval |= SP5[(x >>> 8) & 0x3f];
|
||||||
fval |= SP3[x >>> 16 & 0x3f];
|
fval |= SP3[(x >>> 16) & 0x3f];
|
||||||
fval |= SP1[x >>> 24 & 0x3f];
|
fval |= SP1[(x >>> 24) & 0x3f];
|
||||||
x = l ^ keys[keysi++];
|
x = l ^ keys[keysi++];
|
||||||
fval |= SP8[x & 0x0000003f];
|
fval |= SP8[x & 0x0000003f];
|
||||||
fval |= SP6[x >>> 8 & 0x3f];
|
fval |= SP6[(x >>> 8) & 0x3f];
|
||||||
fval |= SP4[x >>> 16 & 0x3f];
|
fval |= SP4[(x >>> 16) & 0x3f];
|
||||||
fval |= SP2[x >>> 24 & 0x3f];
|
fval |= SP2[(x >>> 24) & 0x3f];
|
||||||
r ^= fval;
|
r ^= fval;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = r << 31 | r >>> 1;
|
r = (r << 31) | (r >>> 1);
|
||||||
x = (l ^ r) & 0xaaaaaaaa;
|
x = (l ^ r) & 0xaaaaaaaa;
|
||||||
l ^= x;
|
l ^= x;
|
||||||
r ^= x;
|
r ^= x;
|
||||||
l = l << 31 | l >>> 1;
|
l = (l << 31) | (l >>> 1);
|
||||||
x = (l >>> 8 ^ r) & 0x00ff00ff;
|
x = ((l >>> 8) ^ r) & 0x00ff00ff;
|
||||||
r ^= x;
|
r ^= x;
|
||||||
l ^= x << 8;
|
l ^= (x << 8);
|
||||||
x = (l >>> 2 ^ r) & 0x33333333;
|
x = ((l >>> 2) ^ r) & 0x33333333;
|
||||||
r ^= x;
|
r ^= x;
|
||||||
l ^= x << 2;
|
l ^= (x << 2);
|
||||||
x = (r >>> 16 ^ l) & 0x0000ffff;
|
x = ((r >>> 16) ^ l) & 0x0000ffff;
|
||||||
l ^= x;
|
l ^= x;
|
||||||
r ^= x << 16;
|
r ^= (x << 16);
|
||||||
x = (r >>> 4 ^ l) & 0x0f0f0f0f;
|
x = ((r >>> 4) ^ l) & 0x0f0f0f0f;
|
||||||
l ^= x;
|
l ^= x;
|
||||||
r ^= x << 4;
|
r ^= (x << 4);
|
||||||
|
|
||||||
// Spread ints to bytes
|
// Spread ints to bytes
|
||||||
x = [r, l];
|
x = [r, l];
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
b[i] = (x[i >>> 2] >>> 8 * (3 - i % 4)) % 256;
|
b[i] = (x[i>>>2] >>> (8 * (3 - (i % 4)))) % 256;
|
||||||
if (b[i] < 0) {
|
if (b[i] < 0) { b[i] += 256; } // unsigned
|
||||||
b[i] += 256;
|
|
||||||
} // unsigned
|
|
||||||
}
|
}
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
@ -280,4 +267,5 @@ function DES(passwd) {
|
||||||
|
|
||||||
setKeys(passwd); // Setup keys
|
setKeys(passwd); // Setup keys
|
||||||
return {'encrypt': encrypt}; // Public interface
|
return {'encrypt': encrypt}; // Public interface
|
||||||
|
|
||||||
}; // function DES
|
}; // 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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* 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.
|
* 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._drawCtx = null;
|
||||||
this._c_forceCanvas = false;
|
this._c_forceCanvas = false;
|
||||||
|
|
||||||
|
@ -98,17 +82,13 @@ Display.prototype = {
|
||||||
// ===== PROPERTIES =====
|
// ===== PROPERTIES =====
|
||||||
|
|
||||||
_scale: 1.0,
|
_scale: 1.0,
|
||||||
get scale() {
|
get scale() { return this._scale; },
|
||||||
return this._scale;
|
|
||||||
},
|
|
||||||
set scale(scale) {
|
set scale(scale) {
|
||||||
this._rescale(scale);
|
this._rescale(scale);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clipViewport: false,
|
_clipViewport: false,
|
||||||
get clipViewport() {
|
get clipViewport() { return this._clipViewport; },
|
||||||
return this._clipViewport;
|
|
||||||
},
|
|
||||||
set clipViewport(viewport) {
|
set clipViewport(viewport) {
|
||||||
this._clipViewport = viewport;
|
this._clipViewport = viewport;
|
||||||
// May need to readjust the viewport dimensions
|
// May need to readjust the viewport dimensions
|
||||||
|
@ -158,7 +138,7 @@ Display.prototype = {
|
||||||
deltaY = -vp.y;
|
deltaY = -vp.y;
|
||||||
}
|
}
|
||||||
if (vy2 + deltaY >= this._fb_height) {
|
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) {
|
if (deltaX === 0 && deltaY === 0) {
|
||||||
|
@ -176,7 +156,9 @@ Display.prototype = {
|
||||||
|
|
||||||
viewportChangeSize: function(width, height) {
|
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");
|
Log.Debug("Setting viewport to full display region");
|
||||||
width = this._fb_width;
|
width = this._fb_width;
|
||||||
|
@ -260,10 +242,10 @@ Display.prototype = {
|
||||||
if (y < this._damageBounds.top) {
|
if (y < this._damageBounds.top) {
|
||||||
this._damageBounds.top = y;
|
this._damageBounds.top = y;
|
||||||
}
|
}
|
||||||
if (x + w > this._damageBounds.right) {
|
if ((x + w) > this._damageBounds.right) {
|
||||||
this._damageBounds.right = x + w;
|
this._damageBounds.right = x + w;
|
||||||
}
|
}
|
||||||
if (y + h > this._damageBounds.bottom) {
|
if ((y + h) > this._damageBounds.bottom) {
|
||||||
this._damageBounds.bottom = y + h;
|
this._damageBounds.bottom = y + h;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -297,18 +279,20 @@ Display.prototype = {
|
||||||
vy = 0;
|
vy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vx + w > this._viewportLoc.w) {
|
if ((vx + w) > this._viewportLoc.w) {
|
||||||
w = this._viewportLoc.w - vx;
|
w = this._viewportLoc.w - vx;
|
||||||
}
|
}
|
||||||
if (vy + h > this._viewportLoc.h) {
|
if ((vy + h) > this._viewportLoc.h) {
|
||||||
h = this._viewportLoc.h - vy;
|
h = this._viewportLoc.h - vy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w > 0 && h > 0) {
|
if ((w > 0) && (h > 0)) {
|
||||||
// FIXME: We may need to disable image smoothing here
|
// FIXME: We may need to disable image smoothing here
|
||||||
// as well (see copyImage()), but we haven't
|
// as well (see copyImage()), but we haven't
|
||||||
// noticed any problem yet.
|
// 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;
|
this._damageBounds.left = this._damageBounds.top = 65535;
|
||||||
|
@ -365,7 +349,7 @@ Display.prototype = {
|
||||||
'x': new_x,
|
'x': new_x,
|
||||||
'y': new_y,
|
'y': new_y,
|
||||||
'width': w,
|
'width': w,
|
||||||
'height': h
|
'height': h,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Due to this bug among others [1] we need to disable the image-smoothing to
|
// 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.msImageSmoothingEnabled = false;
|
||||||
this._drawCtx.imageSmoothingEnabled = 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);
|
this._damage(new_x, new_y, w, h);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
imageRect: function(x, y, mime, arr) {
|
imageRect: function(x, y, mime, arr) {
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.src = "data: " + mime + ";base64," + _base2.default.encode(arr);
|
img.src = "data: " + mime + ";base64," + Base64.encode(arr);
|
||||||
this._renderQ_push({
|
this._renderQ_push({
|
||||||
'type': 'img',
|
'type': 'img',
|
||||||
'img': img,
|
'img': img,
|
||||||
|
@ -431,7 +417,7 @@ Display.prototype = {
|
||||||
var width = this._tile.width;
|
var width = this._tile.width;
|
||||||
for (var j = y; j < yend; j++) {
|
for (var j = y; j < yend; j++) {
|
||||||
for (var i = x; i < xend; i++) {
|
for (var i = x; i < xend; i++) {
|
||||||
var p = (i + j * width) * 4;
|
var p = (i + (j * width)) * 4;
|
||||||
data[p] = red;
|
data[p] = red;
|
||||||
data[p + 1] = green;
|
data[p + 1] = green;
|
||||||
data[p + 2] = blue;
|
data[p + 2] = blue;
|
||||||
|
@ -443,7 +429,8 @@ Display.prototype = {
|
||||||
// draw the current tile to the screen
|
// draw the current tile to the screen
|
||||||
finishTile: function () {
|
finishTile: function () {
|
||||||
this._drawCtx.putImageData(this._tile, this._tile_x, this._tile_y);
|
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) {
|
blitImage: function (x, y, width, height, arr, offset, from_queue) {
|
||||||
|
@ -459,7 +446,7 @@ Display.prototype = {
|
||||||
'x': x,
|
'x': x,
|
||||||
'y': y,
|
'y': y,
|
||||||
'width': width,
|
'width': width,
|
||||||
'height': height
|
'height': height,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._bgrxImageData(x, y, width, height, arr, offset);
|
this._bgrxImageData(x, y, width, height, arr, offset);
|
||||||
|
@ -479,7 +466,7 @@ Display.prototype = {
|
||||||
'x': x,
|
'x': x,
|
||||||
'y': y,
|
'y': y,
|
||||||
'width': width,
|
'width': width,
|
||||||
'height': height
|
'height': height,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._rgbImageData(x, y, width, height, arr, offset);
|
this._rgbImageData(x, y, width, height, arr, offset);
|
||||||
|
@ -499,7 +486,7 @@ Display.prototype = {
|
||||||
'x': x,
|
'x': x,
|
||||||
'y': y,
|
'y': y,
|
||||||
'width': width,
|
'width': width,
|
||||||
'height': height
|
'height': height,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._rgbxImageData(x, y, width, height, arr, offset);
|
this._rgbxImageData(x, y, width, height, arr, offset);
|
||||||
|
@ -551,7 +538,8 @@ Display.prototype = {
|
||||||
var width = Math.round(factor * vp.w) + 'px';
|
var width = Math.round(factor * vp.w) + 'px';
|
||||||
var height = Math.round(factor * vp.h) + '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.width = width;
|
||||||
this._target.style.height = height;
|
this._target.style.height = height;
|
||||||
}
|
}
|
||||||
|
@ -665,23 +653,23 @@ Display.prototype = {
|
||||||
this._flushing = false;
|
this._flushing = false;
|
||||||
this.onflush();
|
this.onflush();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Class Methods
|
// Class Methods
|
||||||
Display.changeCursor = function (target, pixels, mask, hotx, hoty, w, h) {
|
Display.changeCursor = function (target, pixels, mask, hotx, hoty, w, h) {
|
||||||
if (w === 0 || h === 0) {
|
if ((w === 0) || (h === 0)) {
|
||||||
target.style.cursor = 'none';
|
target.style.cursor = 'none';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cur = [];
|
var cur = []
|
||||||
var y, x;
|
var y, x;
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
for (x = 0; x < w; x++) {
|
for (x = 0; x < w; x++) {
|
||||||
var idx = y * Math.ceil(w / 8) + Math.floor(x / 8);
|
var idx = y * Math.ceil(w / 8) + Math.floor(x / 8);
|
||||||
var alpha = mask[idx] << x % 8 & 0x80 ? 255 : 0;
|
var alpha = (mask[idx] << (x % 8)) & 0x80 ? 255 : 0;
|
||||||
idx = (w * y + x) * 4;
|
idx = ((w * y) + x) * 4;
|
||||||
cur.push(pixels[idx + 2]); // red
|
cur.push(pixels[idx + 2]); // red
|
||||||
cur.push(pixels[idx + 1]); // green
|
cur.push(pixels[idx + 1]); // green
|
||||||
cur.push(pixels[idx]); // blue
|
cur.push(pixels[idx]); // blue
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.encodingName = encodingName;
|
|
||||||
/*
|
/*
|
||||||
* noVNC: HTML5 VNC client
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
||||||
|
@ -12,7 +6,7 @@ exports.encodingName = encodingName;
|
||||||
* See README.md for usage and integration instructions.
|
* See README.md for usage and integration instructions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var encodings = exports.encodings = {
|
export var encodings = {
|
||||||
encodingRaw: 0,
|
encodingRaw: 0,
|
||||||
encodingCopyRect: 1,
|
encodingCopyRect: 1,
|
||||||
encodingRRE: 2,
|
encodingRRE: 2,
|
||||||
|
@ -31,22 +25,16 @@ var encodings = exports.encodings = {
|
||||||
pseudoEncodingFence: -312,
|
pseudoEncodingFence: -312,
|
||||||
pseudoEncodingContinuousUpdates: -313,
|
pseudoEncodingContinuousUpdates: -313,
|
||||||
pseudoEncodingCompressLevel9: -247,
|
pseudoEncodingCompressLevel9: -247,
|
||||||
pseudoEncodingCompressLevel0: -256
|
pseudoEncodingCompressLevel0: -256,
|
||||||
};
|
};
|
||||||
|
|
||||||
function encodingName(num) {
|
export function encodingName(num) {
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case encodings.encodingRaw:
|
case encodings.encodingRaw: return "Raw";
|
||||||
return "Raw";
|
case encodings.encodingCopyRect: return "CopyRect";
|
||||||
case encodings.encodingCopyRect:
|
case encodings.encodingRRE: return "RRE";
|
||||||
return "CopyRect";
|
case encodings.encodingHextile: return "Hextile";
|
||||||
case encodings.encodingRRE:
|
case encodings.encodingTight: return "Tight";
|
||||||
return "RRE";
|
default: return "[unknown encoding " + num + "]";
|
||||||
case encodings.encodingHextile:
|
|
||||||
return "Hextile";
|
|
||||||
case encodings.encodingTight:
|
|
||||||
return "Tight";
|
|
||||||
default:
|
|
||||||
return "[unknown encoding " + num + "]";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,17 +1,5 @@
|
||||||
"use strict";
|
import { inflateInit, inflate, inflateReset } from "../vendor/pako/lib/zlib/inflate.js";
|
||||||
|
import ZStream from "../vendor/pako/lib/zlib/zstream.js";
|
||||||
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 }; }
|
|
||||||
|
|
||||||
Inflate.prototype = {
|
Inflate.prototype = {
|
||||||
inflate: function (data, flush, expected) {
|
inflate: function (data, flush, expected) {
|
||||||
|
@ -30,21 +18,21 @@ Inflate.prototype = {
|
||||||
|
|
||||||
this.strm.avail_out = this.chunkSize;
|
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);
|
return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
|
||||||
},
|
},
|
||||||
|
|
||||||
reset: function () {
|
reset: function () {
|
||||||
(0, _inflate.inflateReset)(this.strm);
|
inflateReset(this.strm);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function Inflate() {
|
export default function Inflate() {
|
||||||
this.strm = new _zstream2.default();
|
this.strm = new ZStream();
|
||||||
this.chunkSize = 1024 * 10 * 10;
|
this.chunkSize = 1024 * 10 * 10;
|
||||||
this.strm.output = new Uint8Array(this.chunkSize);
|
this.strm.output = new Uint8Array(this.chunkSize);
|
||||||
this.windowBits = 5;
|
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", {
|
import KeyTable from "./keysym.js";
|
||||||
value: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var _keysym = require("./keysym.js");
|
|
||||||
|
|
||||||
var _keysym2 = _interopRequireDefault(_keysym);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mapping between HTML key values and VNC/X11 keysyms for "special"
|
* 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.
|
* See https://www.w3.org/TR/uievents-key/ for possible values.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var DOMKeyTable = {}; /*
|
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)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function addStandard(key, standard) {
|
function addStandard(key, standard)
|
||||||
|
{
|
||||||
if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||||
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
|
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
|
||||||
DOMKeyTable[key] = [standard, standard, standard, standard];
|
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 (left === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||||
if (right === 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 + "\"";
|
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
|
||||||
DOMKeyTable[key] = [left, left, right, left];
|
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 (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
|
||||||
if (numpad === 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 + "\"";
|
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
|
||||||
|
@ -45,177 +40,177 @@ function addNumpad(key, standard, numpad) {
|
||||||
|
|
||||||
// 2.2. Modifier Keys
|
// 2.2. Modifier Keys
|
||||||
|
|
||||||
addLeftRight("Alt", _keysym2.default.XK_Alt_L, _keysym2.default.XK_Alt_R);
|
addLeftRight("Alt", KeyTable.XK_Alt_L, KeyTable.XK_Alt_R);
|
||||||
addStandard("AltGraph", _keysym2.default.XK_ISO_Level3_Shift);
|
addStandard("AltGraph", KeyTable.XK_ISO_Level3_Shift);
|
||||||
addStandard("CapsLock", _keysym2.default.XK_Caps_Lock);
|
addStandard("CapsLock", KeyTable.XK_Caps_Lock);
|
||||||
addLeftRight("Control", _keysym2.default.XK_Control_L, _keysym2.default.XK_Control_R);
|
addLeftRight("Control", KeyTable.XK_Control_L, KeyTable.XK_Control_R);
|
||||||
// - Fn
|
// - Fn
|
||||||
// - FnLock
|
// - FnLock
|
||||||
addLeftRight("Hyper", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R);
|
addLeftRight("Hyper", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
|
||||||
addLeftRight("Meta", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R);
|
addLeftRight("Meta", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
|
||||||
addStandard("NumLock", _keysym2.default.XK_Num_Lock);
|
addStandard("NumLock", KeyTable.XK_Num_Lock);
|
||||||
addStandard("ScrollLock", _keysym2.default.XK_Scroll_Lock);
|
addStandard("ScrollLock", KeyTable.XK_Scroll_Lock);
|
||||||
addLeftRight("Shift", _keysym2.default.XK_Shift_L, _keysym2.default.XK_Shift_R);
|
addLeftRight("Shift", KeyTable.XK_Shift_L, KeyTable.XK_Shift_R);
|
||||||
addLeftRight("Super", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R);
|
addLeftRight("Super", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
|
||||||
// - Symbol
|
// - Symbol
|
||||||
// - SymbolLock
|
// - SymbolLock
|
||||||
|
|
||||||
// 2.3. Whitespace Keys
|
// 2.3. Whitespace Keys
|
||||||
|
|
||||||
addNumpad("Enter", _keysym2.default.XK_Return, _keysym2.default.XK_KP_Enter);
|
addNumpad("Enter", KeyTable.XK_Return, KeyTable.XK_KP_Enter);
|
||||||
addStandard("Tab", _keysym2.default.XK_Tab);
|
addStandard("Tab", KeyTable.XK_Tab);
|
||||||
addNumpad(" ", _keysym2.default.XK_space, _keysym2.default.XK_KP_Space);
|
addNumpad(" ", KeyTable.XK_space, KeyTable.XK_KP_Space);
|
||||||
|
|
||||||
// 2.4. Navigation Keys
|
// 2.4. Navigation Keys
|
||||||
|
|
||||||
addNumpad("ArrowDown", _keysym2.default.XK_Down, _keysym2.default.XK_KP_Down);
|
addNumpad("ArrowDown", KeyTable.XK_Down, KeyTable.XK_KP_Down);
|
||||||
addNumpad("ArrowUp", _keysym2.default.XK_Up, _keysym2.default.XK_KP_Up);
|
addNumpad("ArrowUp", KeyTable.XK_Up, KeyTable.XK_KP_Up);
|
||||||
addNumpad("ArrowLeft", _keysym2.default.XK_Left, _keysym2.default.XK_KP_Left);
|
addNumpad("ArrowLeft", KeyTable.XK_Left, KeyTable.XK_KP_Left);
|
||||||
addNumpad("ArrowRight", _keysym2.default.XK_Right, _keysym2.default.XK_KP_Right);
|
addNumpad("ArrowRight", KeyTable.XK_Right, KeyTable.XK_KP_Right);
|
||||||
addNumpad("End", _keysym2.default.XK_End, _keysym2.default.XK_KP_End);
|
addNumpad("End", KeyTable.XK_End, KeyTable.XK_KP_End);
|
||||||
addNumpad("Home", _keysym2.default.XK_Home, _keysym2.default.XK_KP_Home);
|
addNumpad("Home", KeyTable.XK_Home, KeyTable.XK_KP_Home);
|
||||||
addNumpad("PageDown", _keysym2.default.XK_Next, _keysym2.default.XK_KP_Next);
|
addNumpad("PageDown", KeyTable.XK_Next, KeyTable.XK_KP_Next);
|
||||||
addNumpad("PageUp", _keysym2.default.XK_Prior, _keysym2.default.XK_KP_Prior);
|
addNumpad("PageUp", KeyTable.XK_Prior, KeyTable.XK_KP_Prior);
|
||||||
|
|
||||||
// 2.5. Editing Keys
|
// 2.5. Editing Keys
|
||||||
|
|
||||||
addStandard("Backspace", _keysym2.default.XK_BackSpace);
|
addStandard("Backspace", KeyTable.XK_BackSpace);
|
||||||
addStandard("Clear", _keysym2.default.XK_Clear);
|
addStandard("Clear", KeyTable.XK_Clear);
|
||||||
addStandard("Copy", _keysym2.default.XF86XK_Copy);
|
addStandard("Copy", KeyTable.XF86XK_Copy);
|
||||||
// - CrSel
|
// - CrSel
|
||||||
addStandard("Cut", _keysym2.default.XF86XK_Cut);
|
addStandard("Cut", KeyTable.XF86XK_Cut);
|
||||||
addNumpad("Delete", _keysym2.default.XK_Delete, _keysym2.default.XK_KP_Delete);
|
addNumpad("Delete", KeyTable.XK_Delete, KeyTable.XK_KP_Delete);
|
||||||
// - EraseEof
|
// - EraseEof
|
||||||
// - ExSel
|
// - ExSel
|
||||||
addNumpad("Insert", _keysym2.default.XK_Insert, _keysym2.default.XK_KP_Insert);
|
addNumpad("Insert", KeyTable.XK_Insert, KeyTable.XK_KP_Insert);
|
||||||
addStandard("Paste", _keysym2.default.XF86XK_Paste);
|
addStandard("Paste", KeyTable.XF86XK_Paste);
|
||||||
addStandard("Redo", _keysym2.default.XK_Redo);
|
addStandard("Redo", KeyTable.XK_Redo);
|
||||||
addStandard("Undo", _keysym2.default.XK_Undo);
|
addStandard("Undo", KeyTable.XK_Undo);
|
||||||
|
|
||||||
// 2.6. UI Keys
|
// 2.6. UI Keys
|
||||||
|
|
||||||
// - Accept
|
// - Accept
|
||||||
// - Again (could just be XK_Redo)
|
// - Again (could just be XK_Redo)
|
||||||
// - Attn
|
// - Attn
|
||||||
addStandard("Cancel", _keysym2.default.XK_Cancel);
|
addStandard("Cancel", KeyTable.XK_Cancel);
|
||||||
addStandard("ContextMenu", _keysym2.default.XK_Menu);
|
addStandard("ContextMenu", KeyTable.XK_Menu);
|
||||||
addStandard("Escape", _keysym2.default.XK_Escape);
|
addStandard("Escape", KeyTable.XK_Escape);
|
||||||
addStandard("Execute", _keysym2.default.XK_Execute);
|
addStandard("Execute", KeyTable.XK_Execute);
|
||||||
addStandard("Find", _keysym2.default.XK_Find);
|
addStandard("Find", KeyTable.XK_Find);
|
||||||
addStandard("Help", _keysym2.default.XK_Help);
|
addStandard("Help", KeyTable.XK_Help);
|
||||||
addStandard("Pause", _keysym2.default.XK_Pause);
|
addStandard("Pause", KeyTable.XK_Pause);
|
||||||
// - Play
|
// - Play
|
||||||
// - Props
|
// - Props
|
||||||
addStandard("Select", _keysym2.default.XK_Select);
|
addStandard("Select", KeyTable.XK_Select);
|
||||||
addStandard("ZoomIn", _keysym2.default.XF86XK_ZoomIn);
|
addStandard("ZoomIn", KeyTable.XF86XK_ZoomIn);
|
||||||
addStandard("ZoomOut", _keysym2.default.XF86XK_ZoomOut);
|
addStandard("ZoomOut", KeyTable.XF86XK_ZoomOut);
|
||||||
|
|
||||||
// 2.7. Device Keys
|
// 2.7. Device Keys
|
||||||
|
|
||||||
addStandard("BrightnessDown", _keysym2.default.XF86XK_MonBrightnessDown);
|
addStandard("BrightnessDown", KeyTable.XF86XK_MonBrightnessDown);
|
||||||
addStandard("BrightnessUp", _keysym2.default.XF86XK_MonBrightnessUp);
|
addStandard("BrightnessUp", KeyTable.XF86XK_MonBrightnessUp);
|
||||||
addStandard("Eject", _keysym2.default.XF86XK_Eject);
|
addStandard("Eject", KeyTable.XF86XK_Eject);
|
||||||
addStandard("LogOff", _keysym2.default.XF86XK_LogOff);
|
addStandard("LogOff", KeyTable.XF86XK_LogOff);
|
||||||
addStandard("Power", _keysym2.default.XF86XK_PowerOff);
|
addStandard("Power", KeyTable.XF86XK_PowerOff);
|
||||||
addStandard("PowerOff", _keysym2.default.XF86XK_PowerDown);
|
addStandard("PowerOff", KeyTable.XF86XK_PowerDown);
|
||||||
addStandard("PrintScreen", _keysym2.default.XK_Print);
|
addStandard("PrintScreen", KeyTable.XK_Print);
|
||||||
addStandard("Hibernate", _keysym2.default.XF86XK_Hibernate);
|
addStandard("Hibernate", KeyTable.XF86XK_Hibernate);
|
||||||
addStandard("Standby", _keysym2.default.XF86XK_Standby);
|
addStandard("Standby", KeyTable.XF86XK_Standby);
|
||||||
addStandard("WakeUp", _keysym2.default.XF86XK_WakeUp);
|
addStandard("WakeUp", KeyTable.XF86XK_WakeUp);
|
||||||
|
|
||||||
// 2.8. IME and Composition Keys
|
// 2.8. IME and Composition Keys
|
||||||
|
|
||||||
addStandard("AllCandidates", _keysym2.default.XK_MultipleCandidate);
|
addStandard("AllCandidates", KeyTable.XK_MultipleCandidate);
|
||||||
addStandard("Alphanumeric", _keysym2.default.XK_Eisu_Shift); // could also be _Eisu_Toggle
|
addStandard("Alphanumeric", KeyTable.XK_Eisu_Shift); // could also be _Eisu_Toggle
|
||||||
addStandard("CodeInput", _keysym2.default.XK_Codeinput);
|
addStandard("CodeInput", KeyTable.XK_Codeinput);
|
||||||
addStandard("Compose", _keysym2.default.XK_Multi_key);
|
addStandard("Compose", KeyTable.XK_Multi_key);
|
||||||
addStandard("Convert", _keysym2.default.XK_Henkan);
|
addStandard("Convert", KeyTable.XK_Henkan);
|
||||||
// - Dead
|
// - Dead
|
||||||
// - FinalMode
|
// - FinalMode
|
||||||
addStandard("GroupFirst", _keysym2.default.XK_ISO_First_Group);
|
addStandard("GroupFirst", KeyTable.XK_ISO_First_Group);
|
||||||
addStandard("GroupLast", _keysym2.default.XK_ISO_Last_Group);
|
addStandard("GroupLast", KeyTable.XK_ISO_Last_Group);
|
||||||
addStandard("GroupNext", _keysym2.default.XK_ISO_Next_Group);
|
addStandard("GroupNext", KeyTable.XK_ISO_Next_Group);
|
||||||
addStandard("GroupPrevious", _keysym2.default.XK_ISO_Prev_Group);
|
addStandard("GroupPrevious", KeyTable.XK_ISO_Prev_Group);
|
||||||
// - ModeChange (XK_Mode_switch is often used for AltGr)
|
// - ModeChange (XK_Mode_switch is often used for AltGr)
|
||||||
// - NextCandidate
|
// - NextCandidate
|
||||||
addStandard("NonConvert", _keysym2.default.XK_Muhenkan);
|
addStandard("NonConvert", KeyTable.XK_Muhenkan);
|
||||||
addStandard("PreviousCandidate", _keysym2.default.XK_PreviousCandidate);
|
addStandard("PreviousCandidate", KeyTable.XK_PreviousCandidate);
|
||||||
// - Process
|
// - Process
|
||||||
addStandard("SingleCandidate", _keysym2.default.XK_SingleCandidate);
|
addStandard("SingleCandidate", KeyTable.XK_SingleCandidate);
|
||||||
addStandard("HangulMode", _keysym2.default.XK_Hangul);
|
addStandard("HangulMode", KeyTable.XK_Hangul);
|
||||||
addStandard("HanjaMode", _keysym2.default.XK_Hangul_Hanja);
|
addStandard("HanjaMode", KeyTable.XK_Hangul_Hanja);
|
||||||
addStandard("JunjuaMode", _keysym2.default.XK_Hangul_Jeonja);
|
addStandard("JunjuaMode", KeyTable.XK_Hangul_Jeonja);
|
||||||
addStandard("Eisu", _keysym2.default.XK_Eisu_toggle);
|
addStandard("Eisu", KeyTable.XK_Eisu_toggle);
|
||||||
addStandard("Hankaku", _keysym2.default.XK_Hankaku);
|
addStandard("Hankaku", KeyTable.XK_Hankaku);
|
||||||
addStandard("Hiragana", _keysym2.default.XK_Hiragana);
|
addStandard("Hiragana", KeyTable.XK_Hiragana);
|
||||||
addStandard("HiraganaKatakana", _keysym2.default.XK_Hiragana_Katakana);
|
addStandard("HiraganaKatakana", KeyTable.XK_Hiragana_Katakana);
|
||||||
addStandard("KanaMode", _keysym2.default.XK_Kana_Shift); // could also be _Kana_Lock
|
addStandard("KanaMode", KeyTable.XK_Kana_Shift); // could also be _Kana_Lock
|
||||||
addStandard("KanjiMode", _keysym2.default.XK_Kanji);
|
addStandard("KanjiMode", KeyTable.XK_Kanji);
|
||||||
addStandard("Katakana", _keysym2.default.XK_Katakana);
|
addStandard("Katakana", KeyTable.XK_Katakana);
|
||||||
addStandard("Romaji", _keysym2.default.XK_Romaji);
|
addStandard("Romaji", KeyTable.XK_Romaji);
|
||||||
addStandard("Zenkaku", _keysym2.default.XK_Zenkaku);
|
addStandard("Zenkaku", KeyTable.XK_Zenkaku);
|
||||||
addStandard("ZenkakuHanaku", _keysym2.default.XK_Zenkaku_Hankaku);
|
addStandard("ZenkakuHanaku", KeyTable.XK_Zenkaku_Hankaku);
|
||||||
|
|
||||||
// 2.9. General-Purpose Function Keys
|
// 2.9. General-Purpose Function Keys
|
||||||
|
|
||||||
addStandard("F1", _keysym2.default.XK_F1);
|
addStandard("F1", KeyTable.XK_F1);
|
||||||
addStandard("F2", _keysym2.default.XK_F2);
|
addStandard("F2", KeyTable.XK_F2);
|
||||||
addStandard("F3", _keysym2.default.XK_F3);
|
addStandard("F3", KeyTable.XK_F3);
|
||||||
addStandard("F4", _keysym2.default.XK_F4);
|
addStandard("F4", KeyTable.XK_F4);
|
||||||
addStandard("F5", _keysym2.default.XK_F5);
|
addStandard("F5", KeyTable.XK_F5);
|
||||||
addStandard("F6", _keysym2.default.XK_F6);
|
addStandard("F6", KeyTable.XK_F6);
|
||||||
addStandard("F7", _keysym2.default.XK_F7);
|
addStandard("F7", KeyTable.XK_F7);
|
||||||
addStandard("F8", _keysym2.default.XK_F8);
|
addStandard("F8", KeyTable.XK_F8);
|
||||||
addStandard("F9", _keysym2.default.XK_F9);
|
addStandard("F9", KeyTable.XK_F9);
|
||||||
addStandard("F10", _keysym2.default.XK_F10);
|
addStandard("F10", KeyTable.XK_F10);
|
||||||
addStandard("F11", _keysym2.default.XK_F11);
|
addStandard("F11", KeyTable.XK_F11);
|
||||||
addStandard("F12", _keysym2.default.XK_F12);
|
addStandard("F12", KeyTable.XK_F12);
|
||||||
addStandard("F13", _keysym2.default.XK_F13);
|
addStandard("F13", KeyTable.XK_F13);
|
||||||
addStandard("F14", _keysym2.default.XK_F14);
|
addStandard("F14", KeyTable.XK_F14);
|
||||||
addStandard("F15", _keysym2.default.XK_F15);
|
addStandard("F15", KeyTable.XK_F15);
|
||||||
addStandard("F16", _keysym2.default.XK_F16);
|
addStandard("F16", KeyTable.XK_F16);
|
||||||
addStandard("F17", _keysym2.default.XK_F17);
|
addStandard("F17", KeyTable.XK_F17);
|
||||||
addStandard("F18", _keysym2.default.XK_F18);
|
addStandard("F18", KeyTable.XK_F18);
|
||||||
addStandard("F19", _keysym2.default.XK_F19);
|
addStandard("F19", KeyTable.XK_F19);
|
||||||
addStandard("F20", _keysym2.default.XK_F20);
|
addStandard("F20", KeyTable.XK_F20);
|
||||||
addStandard("F21", _keysym2.default.XK_F21);
|
addStandard("F21", KeyTable.XK_F21);
|
||||||
addStandard("F22", _keysym2.default.XK_F22);
|
addStandard("F22", KeyTable.XK_F22);
|
||||||
addStandard("F23", _keysym2.default.XK_F23);
|
addStandard("F23", KeyTable.XK_F23);
|
||||||
addStandard("F24", _keysym2.default.XK_F24);
|
addStandard("F24", KeyTable.XK_F24);
|
||||||
addStandard("F25", _keysym2.default.XK_F25);
|
addStandard("F25", KeyTable.XK_F25);
|
||||||
addStandard("F26", _keysym2.default.XK_F26);
|
addStandard("F26", KeyTable.XK_F26);
|
||||||
addStandard("F27", _keysym2.default.XK_F27);
|
addStandard("F27", KeyTable.XK_F27);
|
||||||
addStandard("F28", _keysym2.default.XK_F28);
|
addStandard("F28", KeyTable.XK_F28);
|
||||||
addStandard("F29", _keysym2.default.XK_F29);
|
addStandard("F29", KeyTable.XK_F29);
|
||||||
addStandard("F30", _keysym2.default.XK_F30);
|
addStandard("F30", KeyTable.XK_F30);
|
||||||
addStandard("F31", _keysym2.default.XK_F31);
|
addStandard("F31", KeyTable.XK_F31);
|
||||||
addStandard("F32", _keysym2.default.XK_F32);
|
addStandard("F32", KeyTable.XK_F32);
|
||||||
addStandard("F33", _keysym2.default.XK_F33);
|
addStandard("F33", KeyTable.XK_F33);
|
||||||
addStandard("F34", _keysym2.default.XK_F34);
|
addStandard("F34", KeyTable.XK_F34);
|
||||||
addStandard("F35", _keysym2.default.XK_F35);
|
addStandard("F35", KeyTable.XK_F35);
|
||||||
// - Soft1...
|
// - Soft1...
|
||||||
|
|
||||||
// 2.10. Multimedia Keys
|
// 2.10. Multimedia Keys
|
||||||
|
|
||||||
// - ChannelDown
|
// - ChannelDown
|
||||||
// - ChannelUp
|
// - ChannelUp
|
||||||
addStandard("Close", _keysym2.default.XF86XK_Close);
|
addStandard("Close", KeyTable.XF86XK_Close);
|
||||||
addStandard("MailForward", _keysym2.default.XF86XK_MailForward);
|
addStandard("MailForward", KeyTable.XF86XK_MailForward);
|
||||||
addStandard("MailReply", _keysym2.default.XF86XK_Reply);
|
addStandard("MailReply", KeyTable.XF86XK_Reply);
|
||||||
addStandard("MainSend", _keysym2.default.XF86XK_Send);
|
addStandard("MainSend", KeyTable.XF86XK_Send);
|
||||||
addStandard("MediaFastForward", _keysym2.default.XF86XK_AudioForward);
|
addStandard("MediaFastForward", KeyTable.XF86XK_AudioForward);
|
||||||
addStandard("MediaPause", _keysym2.default.XF86XK_AudioPause);
|
addStandard("MediaPause", KeyTable.XF86XK_AudioPause);
|
||||||
addStandard("MediaPlay", _keysym2.default.XF86XK_AudioPlay);
|
addStandard("MediaPlay", KeyTable.XF86XK_AudioPlay);
|
||||||
addStandard("MediaRecord", _keysym2.default.XF86XK_AudioRecord);
|
addStandard("MediaRecord", KeyTable.XF86XK_AudioRecord);
|
||||||
addStandard("MediaRewind", _keysym2.default.XF86XK_AudioRewind);
|
addStandard("MediaRewind", KeyTable.XF86XK_AudioRewind);
|
||||||
addStandard("MediaStop", _keysym2.default.XF86XK_AudioStop);
|
addStandard("MediaStop", KeyTable.XF86XK_AudioStop);
|
||||||
addStandard("MediaTrackNext", _keysym2.default.XF86XK_AudioNext);
|
addStandard("MediaTrackNext", KeyTable.XF86XK_AudioNext);
|
||||||
addStandard("MediaTrackPrevious", _keysym2.default.XF86XK_AudioPrev);
|
addStandard("MediaTrackPrevious", KeyTable.XF86XK_AudioPrev);
|
||||||
addStandard("New", _keysym2.default.XF86XK_New);
|
addStandard("New", KeyTable.XF86XK_New);
|
||||||
addStandard("Open", _keysym2.default.XF86XK_Open);
|
addStandard("Open", KeyTable.XF86XK_Open);
|
||||||
addStandard("Print", _keysym2.default.XK_Print);
|
addStandard("Print", KeyTable.XK_Print);
|
||||||
addStandard("Save", _keysym2.default.XF86XK_Save);
|
addStandard("Save", KeyTable.XF86XK_Save);
|
||||||
addStandard("SpellCheck", _keysym2.default.XF86XK_Spell);
|
addStandard("SpellCheck", KeyTable.XF86XK_Spell);
|
||||||
|
|
||||||
// 2.11. Multimedia Numpad Keys
|
// 2.11. Multimedia Numpad Keys
|
||||||
|
|
||||||
|
@ -236,13 +231,13 @@ addStandard("SpellCheck", _keysym2.default.XF86XK_Spell);
|
||||||
// - AudioSurroundModeNext
|
// - AudioSurroundModeNext
|
||||||
// - AudioTrebleDown
|
// - AudioTrebleDown
|
||||||
// - AudioTrebleUp
|
// - AudioTrebleUp
|
||||||
addStandard("AudioVolumeDown", _keysym2.default.XF86XK_AudioLowerVolume);
|
addStandard("AudioVolumeDown", KeyTable.XF86XK_AudioLowerVolume);
|
||||||
addStandard("AudioVolumeUp", _keysym2.default.XF86XK_AudioRaiseVolume);
|
addStandard("AudioVolumeUp", KeyTable.XF86XK_AudioRaiseVolume);
|
||||||
addStandard("AudioVolumeMute", _keysym2.default.XF86XK_AudioMute);
|
addStandard("AudioVolumeMute", KeyTable.XF86XK_AudioMute);
|
||||||
// - MicrophoneToggle
|
// - MicrophoneToggle
|
||||||
// - MicrophoneVolumeDown
|
// - MicrophoneVolumeDown
|
||||||
// - MicrophoneVolumeUp
|
// - MicrophoneVolumeUp
|
||||||
addStandard("MicrophoneVolumeMute", _keysym2.default.XF86XK_AudioMicMute);
|
addStandard("MicrophoneVolumeMute", KeyTable.XF86XK_AudioMicMute);
|
||||||
|
|
||||||
// 2.13. Speech Keys
|
// 2.13. Speech Keys
|
||||||
|
|
||||||
|
@ -251,28 +246,28 @@ addStandard("MicrophoneVolumeMute", _keysym2.default.XF86XK_AudioMicMute);
|
||||||
|
|
||||||
// 2.14. Application Keys
|
// 2.14. Application Keys
|
||||||
|
|
||||||
addStandard("LaunchCalculator", _keysym2.default.XF86XK_Calculator);
|
addStandard("LaunchCalculator", KeyTable.XF86XK_Calculator);
|
||||||
addStandard("LaunchCalendar", _keysym2.default.XF86XK_Calendar);
|
addStandard("LaunchCalendar", KeyTable.XF86XK_Calendar);
|
||||||
addStandard("LaunchMail", _keysym2.default.XF86XK_Mail);
|
addStandard("LaunchMail", KeyTable.XF86XK_Mail);
|
||||||
addStandard("LaunchMediaPlayer", _keysym2.default.XF86XK_AudioMedia);
|
addStandard("LaunchMediaPlayer", KeyTable.XF86XK_AudioMedia);
|
||||||
addStandard("LaunchMusicPlayer", _keysym2.default.XF86XK_Music);
|
addStandard("LaunchMusicPlayer", KeyTable.XF86XK_Music);
|
||||||
addStandard("LaunchMyComputer", _keysym2.default.XF86XK_MyComputer);
|
addStandard("LaunchMyComputer", KeyTable.XF86XK_MyComputer);
|
||||||
addStandard("LaunchPhone", _keysym2.default.XF86XK_Phone);
|
addStandard("LaunchPhone", KeyTable.XF86XK_Phone);
|
||||||
addStandard("LaunchScreenSaver", _keysym2.default.XF86XK_ScreenSaver);
|
addStandard("LaunchScreenSaver", KeyTable.XF86XK_ScreenSaver);
|
||||||
addStandard("LaunchSpreadsheet", _keysym2.default.XF86XK_Excel);
|
addStandard("LaunchSpreadsheet", KeyTable.XF86XK_Excel);
|
||||||
addStandard("LaunchWebBrowser", _keysym2.default.XF86XK_WWW);
|
addStandard("LaunchWebBrowser", KeyTable.XF86XK_WWW);
|
||||||
addStandard("LaunchWebCam", _keysym2.default.XF86XK_WebCam);
|
addStandard("LaunchWebCam", KeyTable.XF86XK_WebCam);
|
||||||
addStandard("LaunchWordProcessor", _keysym2.default.XF86XK_Word);
|
addStandard("LaunchWordProcessor", KeyTable.XF86XK_Word);
|
||||||
|
|
||||||
// 2.15. Browser Keys
|
// 2.15. Browser Keys
|
||||||
|
|
||||||
addStandard("BrowserBack", _keysym2.default.XF86XK_Back);
|
addStandard("BrowserBack", KeyTable.XF86XK_Back);
|
||||||
addStandard("BrowserFavorites", _keysym2.default.XF86XK_Favorites);
|
addStandard("BrowserFavorites", KeyTable.XF86XK_Favorites);
|
||||||
addStandard("BrowserForward", _keysym2.default.XF86XK_Forward);
|
addStandard("BrowserForward", KeyTable.XF86XK_Forward);
|
||||||
addStandard("BrowserHome", _keysym2.default.XF86XK_HomePage);
|
addStandard("BrowserHome", KeyTable.XF86XK_HomePage);
|
||||||
addStandard("BrowserRefresh", _keysym2.default.XF86XK_Refresh);
|
addStandard("BrowserRefresh", KeyTable.XF86XK_Refresh);
|
||||||
addStandard("BrowserSearch", _keysym2.default.XF86XK_Search);
|
addStandard("BrowserSearch", KeyTable.XF86XK_Search);
|
||||||
addStandard("BrowserStop", _keysym2.default.XF86XK_Stop);
|
addStandard("BrowserStop", KeyTable.XF86XK_Stop);
|
||||||
|
|
||||||
// 2.16. Mobile Phone Keys
|
// 2.16. Mobile Phone Keys
|
||||||
|
|
||||||
|
@ -285,31 +280,31 @@ addStandard("BrowserStop", _keysym2.default.XF86XK_Stop);
|
||||||
// 2.18. Media Controller Keys
|
// 2.18. Media Controller Keys
|
||||||
|
|
||||||
// - A whole bunch...
|
// - A whole bunch...
|
||||||
addStandard("Dimmer", _keysym2.default.XF86XK_BrightnessAdjust);
|
addStandard("Dimmer", KeyTable.XF86XK_BrightnessAdjust);
|
||||||
addStandard("MediaAudioTrack", _keysym2.default.XF86XK_AudioCycleTrack);
|
addStandard("MediaAudioTrack", KeyTable.XF86XK_AudioCycleTrack);
|
||||||
addStandard("RandomToggle", _keysym2.default.XF86XK_AudioRandomPlay);
|
addStandard("RandomToggle", KeyTable.XF86XK_AudioRandomPlay);
|
||||||
addStandard("SplitScreenToggle", _keysym2.default.XF86XK_SplitScreen);
|
addStandard("SplitScreenToggle", KeyTable.XF86XK_SplitScreen);
|
||||||
addStandard("Subtitle", _keysym2.default.XF86XK_Subtitle);
|
addStandard("Subtitle", KeyTable.XF86XK_Subtitle);
|
||||||
addStandard("VideoModeNext", _keysym2.default.XF86XK_Next_VMode);
|
addStandard("VideoModeNext", KeyTable.XF86XK_Next_VMode);
|
||||||
|
|
||||||
// Extra: Numpad
|
// Extra: Numpad
|
||||||
|
|
||||||
addNumpad("=", _keysym2.default.XK_equal, _keysym2.default.XK_KP_Equal);
|
addNumpad("=", KeyTable.XK_equal, KeyTable.XK_KP_Equal);
|
||||||
addNumpad("+", _keysym2.default.XK_plus, _keysym2.default.XK_KP_Add);
|
addNumpad("+", KeyTable.XK_plus, KeyTable.XK_KP_Add);
|
||||||
addNumpad("-", _keysym2.default.XK_minus, _keysym2.default.XK_KP_Subtract);
|
addNumpad("-", KeyTable.XK_minus, KeyTable.XK_KP_Subtract);
|
||||||
addNumpad("*", _keysym2.default.XK_asterisk, _keysym2.default.XK_KP_Multiply);
|
addNumpad("*", KeyTable.XK_asterisk, KeyTable.XK_KP_Multiply);
|
||||||
addNumpad("/", _keysym2.default.XK_slash, _keysym2.default.XK_KP_Divide);
|
addNumpad("/", KeyTable.XK_slash, KeyTable.XK_KP_Divide);
|
||||||
addNumpad(".", _keysym2.default.XK_period, _keysym2.default.XK_KP_Decimal);
|
addNumpad(".", KeyTable.XK_period, KeyTable.XK_KP_Decimal);
|
||||||
addNumpad(",", _keysym2.default.XK_comma, _keysym2.default.XK_KP_Separator);
|
addNumpad(",", KeyTable.XK_comma, KeyTable.XK_KP_Separator);
|
||||||
addNumpad("0", _keysym2.default.XK_0, _keysym2.default.XK_KP_0);
|
addNumpad("0", KeyTable.XK_0, KeyTable.XK_KP_0);
|
||||||
addNumpad("1", _keysym2.default.XK_1, _keysym2.default.XK_KP_1);
|
addNumpad("1", KeyTable.XK_1, KeyTable.XK_KP_1);
|
||||||
addNumpad("2", _keysym2.default.XK_2, _keysym2.default.XK_KP_2);
|
addNumpad("2", KeyTable.XK_2, KeyTable.XK_KP_2);
|
||||||
addNumpad("3", _keysym2.default.XK_3, _keysym2.default.XK_KP_3);
|
addNumpad("3", KeyTable.XK_3, KeyTable.XK_KP_3);
|
||||||
addNumpad("4", _keysym2.default.XK_4, _keysym2.default.XK_KP_4);
|
addNumpad("4", KeyTable.XK_4, KeyTable.XK_KP_4);
|
||||||
addNumpad("5", _keysym2.default.XK_5, _keysym2.default.XK_KP_5);
|
addNumpad("5", KeyTable.XK_5, KeyTable.XK_KP_5);
|
||||||
addNumpad("6", _keysym2.default.XK_6, _keysym2.default.XK_KP_6);
|
addNumpad("6", KeyTable.XK_6, KeyTable.XK_KP_6);
|
||||||
addNumpad("7", _keysym2.default.XK_7, _keysym2.default.XK_KP_7);
|
addNumpad("7", KeyTable.XK_7, KeyTable.XK_KP_7);
|
||||||
addNumpad("8", _keysym2.default.XK_8, _keysym2.default.XK_KP_8);
|
addNumpad("8", KeyTable.XK_8, KeyTable.XK_KP_8);
|
||||||
addNumpad("9", _keysym2.default.XK_9, _keysym2.default.XK_KP_9);
|
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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
* 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.
|
* See https://www.w3.org/TR/uievents-key/ for possible values.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.default = {
|
export default {
|
||||||
|
|
||||||
// 3.1.1.1. Writing System Keys
|
// 3.1.1.1. Writing System Keys
|
||||||
|
|
||||||
|
@ -128,5 +123,5 @@ exports.default = {
|
||||||
'AudioVolumeDown': 'AudioVolumeDown',
|
'AudioVolumeDown': 'AudioVolumeDown',
|
||||||
'AudioVolumeMute': 'AudioVolumeMute',
|
'AudioVolumeMute': 'AudioVolumeMute',
|
||||||
'AudioVolumeUp': 'AudioVolumeUp',
|
'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", {
|
import * as Log from '../util/logging.js';
|
||||||
value: true
|
import { stopEvent } from '../util/events.js';
|
||||||
});
|
import * as KeyboardUtil from "./util.js";
|
||||||
exports.default = Keyboard;
|
import KeyTable from "./keysym.js";
|
||||||
|
import * as browser from "../util/browser.js";
|
||||||
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; } }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Keyboard event handler
|
// Keyboard event handler
|
||||||
//
|
//
|
||||||
|
|
||||||
function Keyboard(target) {
|
export default function Keyboard(target) {
|
||||||
this._target = target || null;
|
this._target = target || null;
|
||||||
|
|
||||||
this._keyDownList = {}; // List of depressed keys
|
this._keyDownList = {}; // List of depressed keys
|
||||||
|
@ -45,14 +29,7 @@ function Keyboard(target) {
|
||||||
'keypress': this._handleKeyPress.bind(this),
|
'keypress': this._handleKeyPress.bind(this),
|
||||||
'blur': this._allKeysUp.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 = {
|
Keyboard.prototype = {
|
||||||
// ===== EVENT HANDLERS =====
|
// ===== EVENT HANDLERS =====
|
||||||
|
@ -62,7 +39,8 @@ Keyboard.prototype = {
|
||||||
// ===== PRIVATE METHODS =====
|
// ===== PRIVATE METHODS =====
|
||||||
|
|
||||||
_sendKeyEvent: function (keysym, code, down) {
|
_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
|
// Windows sends CtrlLeft+AltRight when you press
|
||||||
// AltGraph, which tends to confuse the hell out of
|
// AltGraph, which tends to confuse the hell out of
|
||||||
|
@ -70,18 +48,25 @@ Keyboard.prototype = {
|
||||||
// there is a way to detect AltGraph properly.
|
// there is a way to detect AltGraph properly.
|
||||||
var fakeAltGraph = false;
|
var fakeAltGraph = false;
|
||||||
if (down && browser.isWindows()) {
|
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;
|
fakeAltGraph = true;
|
||||||
this.onkeyevent(this._keyDownList['AltRight'], 'AltRight', false);
|
this.onkeyevent(this._keyDownList['AltRight'],
|
||||||
this.onkeyevent(this._keyDownList['ControlLeft'], 'ControlLeft', false);
|
'AltRight', false);
|
||||||
|
this.onkeyevent(this._keyDownList['ControlLeft'],
|
||||||
|
'ControlLeft', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onkeyevent(keysym, code, down);
|
this.onkeyevent(keysym, code, down);
|
||||||
|
|
||||||
if (fakeAltGraph) {
|
if (fakeAltGraph) {
|
||||||
this.onkeyevent(this._keyDownList['ControlLeft'], 'ControlLeft', true);
|
this.onkeyevent(this._keyDownList['ControlLeft'],
|
||||||
this.onkeyevent(this._keyDownList['AltRight'], 'AltRight', true);
|
'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
|
// Unstable, but we don't have anything else to go on
|
||||||
// (don't use it for 'keypress' events thought since
|
// (don't use it for 'keypress' events thought since
|
||||||
// WebKit sets it to the same as charCode)
|
// 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
|
// 229 is used for composition events
|
||||||
if (e.keyCode !== 229) {
|
if (e.keyCode !== 229) {
|
||||||
return 'Platform' + e.keyCode;
|
return 'Platform' + e.keyCode;
|
||||||
|
@ -128,7 +113,7 @@ Keyboard.prototype = {
|
||||||
// to deal with virtual keyboards which omit key info
|
// to deal with virtual keyboards which omit key info
|
||||||
// (iOS omits tracking info on keyup events, which forces us to
|
// (iOS omits tracking info on keyup events, which forces us to
|
||||||
// special treat that platform here)
|
// special treat that platform here)
|
||||||
if (code === 'Unidentified' || browser.isIOS()) {
|
if ((code === 'Unidentified') || browser.isIOS()) {
|
||||||
if (keysym) {
|
if (keysym) {
|
||||||
// If it's a virtual keyboard then it should be
|
// If it's a virtual keyboard then it should be
|
||||||
// sufficient to just send press and release right
|
// sufficient to just send press and release right
|
||||||
|
@ -137,7 +122,7 @@ Keyboard.prototype = {
|
||||||
this._sendKeyEvent(keysym, code, false);
|
this._sendKeyEvent(keysym, code, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,17 +132,17 @@ Keyboard.prototype = {
|
||||||
// possibly others).
|
// possibly others).
|
||||||
if (browser.isMac()) {
|
if (browser.isMac()) {
|
||||||
switch (keysym) {
|
switch (keysym) {
|
||||||
case _keysym2.default.XK_Super_L:
|
case KeyTable.XK_Super_L:
|
||||||
keysym = _keysym2.default.XK_Alt_L;
|
keysym = KeyTable.XK_Alt_L;
|
||||||
break;
|
break;
|
||||||
case _keysym2.default.XK_Super_R:
|
case KeyTable.XK_Super_R:
|
||||||
keysym = _keysym2.default.XK_Super_L;
|
keysym = KeyTable.XK_Super_L;
|
||||||
break;
|
break;
|
||||||
case _keysym2.default.XK_Alt_L:
|
case KeyTable.XK_Alt_L:
|
||||||
keysym = _keysym2.default.XK_Mode_switch;
|
keysym = KeyTable.XK_Mode_switch;
|
||||||
break;
|
break;
|
||||||
case _keysym2.default.XK_Alt_R:
|
case KeyTable.XK_Alt_R:
|
||||||
keysym = _keysym2.default.XK_ISO_Level3_Shift;
|
keysym = KeyTable.XK_ISO_Level3_Shift;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,10 +157,10 @@ Keyboard.prototype = {
|
||||||
// state change events. That gets extra confusing for CapsLock
|
// state change events. That gets extra confusing for CapsLock
|
||||||
// which toggles on each press, but not on release. So pretend
|
// which toggles on each press, but not on release. So pretend
|
||||||
// it was a quick press and release of the button.
|
// it was a quick press and release of the button.
|
||||||
if (browser.isMac() && code === 'CapsLock') {
|
if (browser.isMac() && (code === 'CapsLock')) {
|
||||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', true);
|
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
|
||||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', false);
|
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +178,7 @@ Keyboard.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._pendingKey = null;
|
this._pendingKey = null;
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
|
|
||||||
this._keyDownList[code] = keysym;
|
this._keyDownList[code] = keysym;
|
||||||
|
|
||||||
|
@ -202,7 +187,7 @@ Keyboard.prototype = {
|
||||||
|
|
||||||
// Legacy event for browsers without code/key
|
// Legacy event for browsers without code/key
|
||||||
_handleKeyPress: function (e) {
|
_handleKeyPress: function (e) {
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
|
|
||||||
// Are we expecting a keypress?
|
// Are we expecting a keypress?
|
||||||
if (this._pendingKey === null) {
|
if (this._pendingKey === null) {
|
||||||
|
@ -213,7 +198,7 @@ Keyboard.prototype = {
|
||||||
var keysym = KeyboardUtil.getKeysym(e);
|
var keysym = KeyboardUtil.getKeysym(e);
|
||||||
|
|
||||||
// The key we were waiting for?
|
// The key we were waiting for?
|
||||||
if (code !== 'Unidentified' && code != this._pendingKey) {
|
if ((code !== 'Unidentified') && (code != this._pendingKey)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,14 +228,17 @@ Keyboard.prototype = {
|
||||||
// We have no way of knowing the proper keysym with the
|
// We have no way of knowing the proper keysym with the
|
||||||
// information given, but the following are true for most
|
// information given, but the following are true for most
|
||||||
// layouts
|
// layouts
|
||||||
if (e.keyCode >= 0x30 && e.keyCode <= 0x39) {
|
if ((e.keyCode >= 0x30) && (e.keyCode <= 0x39)) {
|
||||||
// Digit
|
// Digit
|
||||||
keysym = e.keyCode;
|
keysym = e.keyCode;
|
||||||
} else if (e.keyCode >= 0x41 && e.keyCode <= 0x5a) {
|
} else if ((e.keyCode >= 0x41) && (e.keyCode <= 0x5a)) {
|
||||||
// Character (A-Z)
|
// Character (A-Z)
|
||||||
var char = String.fromCharCode(e.keyCode);
|
var char = String.fromCharCode(e.keyCode);
|
||||||
// A feeble attempt at the correct case
|
// 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();
|
keysym = char.charCodeAt();
|
||||||
} else {
|
} else {
|
||||||
// Unknown, give up
|
// Unknown, give up
|
||||||
|
@ -263,14 +251,14 @@ Keyboard.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleKeyUp: function (e) {
|
_handleKeyUp: function (e) {
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
|
|
||||||
var code = this._getKeyCode(e);
|
var code = this._getKeyCode(e);
|
||||||
|
|
||||||
// See comment in _handleKeyDown()
|
// See comment in _handleKeyDown()
|
||||||
if (browser.isMac() && code === 'CapsLock') {
|
if (browser.isMac() && (code === 'CapsLock')) {
|
||||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', true);
|
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
|
||||||
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', false);
|
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,5 +310,5 @@ Keyboard.prototype = {
|
||||||
this._allKeysUp();
|
this._allKeysUp();
|
||||||
|
|
||||||
//Log.Debug(">> Keyboard.ungrab");
|
//Log.Debug(">> Keyboard.ungrab");
|
||||||
}
|
},
|
||||||
};
|
};
|
|
@ -1,9 +1,4 @@
|
||||||
"use strict";
|
export default {
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = {
|
|
||||||
XK_VoidSymbol: 0xffffff, /* Void symbol */
|
XK_VoidSymbol: 0xffffff, /* Void symbol */
|
||||||
|
|
||||||
XK_BackSpace: 0xff08, /* Back space, back char */
|
XK_BackSpace: 0xff08, /* Back space, back char */
|
||||||
|
@ -62,6 +57,7 @@ exports.default = {
|
||||||
XK_End: 0xff57, /* EOL */
|
XK_End: 0xff57, /* EOL */
|
||||||
XK_Begin: 0xff58, /* BOL */
|
XK_Begin: 0xff58, /* BOL */
|
||||||
|
|
||||||
|
|
||||||
/* Misc functions */
|
/* Misc functions */
|
||||||
|
|
||||||
XK_Select: 0xff60, /* Select, mark */
|
XK_Select: 0xff60, /* Select, mark */
|
||||||
|
@ -614,5 +610,5 @@ exports.default = {
|
||||||
XF86XK_Next_VMode: 0x1008FE22,
|
XF86XK_Next_VMode: 0x1008FE22,
|
||||||
XF86XK_Prev_VMode: 0x1008FE23,
|
XF86XK_Prev_VMode: 0x1008FE23,
|
||||||
XF86XK_LogWindowTree: 0x1008FE24,
|
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
|
* Mapping from Unicode codepoints to X11/RFB keysyms
|
||||||
*
|
*
|
||||||
|
@ -671,13 +666,13 @@ var codepoints = {
|
||||||
0x30f2: 0x04a6, // XK_kana_WO
|
0x30f2: 0x04a6, // XK_kana_WO
|
||||||
0x30f3: 0x04dd, // XK_kana_N
|
0x30f3: 0x04dd, // XK_kana_N
|
||||||
0x30fb: 0x04a5, // XK_kana_conjunctive
|
0x30fb: 0x04a5, // XK_kana_conjunctive
|
||||||
0x30fc: 0x04b0 // XK_prolongedsound
|
0x30fc: 0x04b0, // XK_prolongedsound
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.default = {
|
export default {
|
||||||
lookup : function(u) {
|
lookup : function(u) {
|
||||||
// Latin-1 is one-to-one mapping
|
// Latin-1 is one-to-one mapping
|
||||||
if (u >= 0x20 && u <= 0xff) {
|
if ((u >= 0x20) && (u <= 0xff)) {
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,5 +684,5 @@ exports.default = {
|
||||||
|
|
||||||
// General mapping as final fallback
|
// General mapping as final fallback
|
||||||
return 0x01000000 | u;
|
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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* 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)
|
* 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_STEP_TIMEOUT = 50; // ms
|
||||||
var WHEEL_LINE_HEIGHT = 19;
|
var WHEEL_LINE_HEIGHT = 19;
|
||||||
|
|
||||||
function Mouse(target) {
|
export default function Mouse(target) {
|
||||||
this._target = target || document;
|
this._target = target || document;
|
||||||
|
|
||||||
this._doubleClickTimer = null;
|
this._doubleClickTimer = null;
|
||||||
|
@ -85,7 +72,7 @@ Mouse.prototype = {
|
||||||
|
|
||||||
var xs = this._lastTouchPos.x - pos.x;
|
var xs = this._lastTouchPos.x - pos.x;
|
||||||
var ys = this._lastTouchPos.y - pos.y;
|
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
|
// The goal is to trigger on a certain physical width, the
|
||||||
// devicePixelRatio brings us a bit closer but is not optimal.
|
// devicePixelRatio brings us a bit closer but is not optimal.
|
||||||
|
@ -108,16 +95,17 @@ Mouse.prototype = {
|
||||||
(e.button & 0x4) / 2; // Middle
|
(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);
|
this.onmousebutton(pos.x, pos.y, down, bmask);
|
||||||
|
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleMouseDown: function (e) {
|
_handleMouseDown: function (e) {
|
||||||
// Touch events have implicit capture
|
// Touch events have implicit capture
|
||||||
if (e.type === "mousedown") {
|
if (e.type === "mousedown") {
|
||||||
(0, _events.setCapture)(this._target);
|
setCapture(this._target);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._handleMouseButton(e, 1);
|
this._handleMouseButton(e, 1);
|
||||||
|
@ -191,21 +179,25 @@ Mouse.prototype = {
|
||||||
if (Math.abs(this._accumulatedWheelDeltaX) > WHEEL_STEP) {
|
if (Math.abs(this._accumulatedWheelDeltaX) > WHEEL_STEP) {
|
||||||
this._generateWheelStepX();
|
this._generateWheelStepX();
|
||||||
} else {
|
} 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) {
|
if (Math.abs(this._accumulatedWheelDeltaY) > WHEEL_STEP) {
|
||||||
this._generateWheelStepY();
|
this._generateWheelStepY();
|
||||||
} else {
|
} 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) {
|
_handleMouseMove: function (e) {
|
||||||
this._updateMousePosition(e);
|
this._updateMousePosition(e);
|
||||||
this.onmousemove(this._pos.x, this._pos.y);
|
this.onmousemove(this._pos.x, this._pos.y);
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleMouseDisable: function (e) {
|
_handleMouseDisable: function (e) {
|
||||||
|
@ -216,13 +208,13 @@ Mouse.prototype = {
|
||||||
* to listen on the document element instead.
|
* to listen on the document element instead.
|
||||||
*/
|
*/
|
||||||
if (e.target == this._target) {
|
if (e.target == this._target) {
|
||||||
(0, _events.stopEvent)(e);
|
stopEvent(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Update coordinates relative to target
|
// Update coordinates relative to target
|
||||||
_updateMousePosition: function(e) {
|
_updateMousePosition: function(e) {
|
||||||
e = (0, _events.getPointerEvent)(e);
|
e = getPointerEvent(e);
|
||||||
var bounds = this._target.getBoundingClientRect();
|
var bounds = this._target.getBoundingClientRect();
|
||||||
var x, y;
|
var x, y;
|
||||||
// Clip to target bounds
|
// Clip to target bounds
|
||||||
|
@ -248,7 +240,7 @@ Mouse.prototype = {
|
||||||
grab: function () {
|
grab: function () {
|
||||||
var c = this._target;
|
var c = this._target;
|
||||||
|
|
||||||
if (_browser.isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
c.addEventListener('touchstart', this._eventHandlers.mousedown);
|
c.addEventListener('touchstart', this._eventHandlers.mousedown);
|
||||||
c.addEventListener('touchend', this._eventHandlers.mouseup);
|
c.addEventListener('touchend', this._eventHandlers.mouseup);
|
||||||
c.addEventListener('touchmove', this._eventHandlers.mousemove);
|
c.addEventListener('touchmove', this._eventHandlers.mousemove);
|
||||||
|
@ -271,7 +263,7 @@ Mouse.prototype = {
|
||||||
|
|
||||||
this._resetWheelStepTimers();
|
this._resetWheelStepTimers();
|
||||||
|
|
||||||
if (_browser.isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
c.removeEventListener('touchstart', this._eventHandlers.mousedown);
|
c.removeEventListener('touchstart', this._eventHandlers.mousedown);
|
||||||
c.removeEventListener('touchend', this._eventHandlers.mouseup);
|
c.removeEventListener('touchend', this._eventHandlers.mouseup);
|
||||||
c.removeEventListener('touchmove', this._eventHandlers.mousemove);
|
c.removeEventListener('touchmove', this._eventHandlers.mousemove);
|
||||||
|
|
|
@ -1,42 +1,12 @@
|
||||||
"use strict";
|
import KeyTable from "./keysym.js";
|
||||||
|
import keysyms from "./keysymdef.js";
|
||||||
Object.defineProperty(exports, "__esModule", {
|
import vkeys from "./vkeys.js";
|
||||||
value: true
|
import fixedkeys from "./fixedkeys.js";
|
||||||
});
|
import DOMKeyTable from "./domkeytable.js";
|
||||||
exports.getKeycode = getKeycode;
|
import * as browser from "../util/browser.js";
|
||||||
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 }; }
|
|
||||||
|
|
||||||
// Get 'KeyboardEvent.code', handling legacy browsers
|
// Get 'KeyboardEvent.code', handling legacy browsers
|
||||||
function getKeycode(evt) {
|
export function getKeycode(evt){
|
||||||
// Are we getting proper key identifiers?
|
// Are we getting proper key identifiers?
|
||||||
// (unfortunately Firefox and Chrome are crappy here and gives
|
// (unfortunately Firefox and Chrome are crappy here and gives
|
||||||
// us an empty string on some platforms, rather than leaving it
|
// us an empty string on some platforms, rather than leaving it
|
||||||
|
@ -44,10 +14,8 @@ function getKeycode(evt) {
|
||||||
if (evt.code) {
|
if (evt.code) {
|
||||||
// Mozilla isn't fully in sync with the spec yet
|
// Mozilla isn't fully in sync with the spec yet
|
||||||
switch (evt.code) {
|
switch (evt.code) {
|
||||||
case 'OSLeft':
|
case 'OSLeft': return 'MetaLeft';
|
||||||
return 'MetaLeft';
|
case 'OSRight': return 'MetaRight';
|
||||||
case 'OSRight':
|
|
||||||
return 'MetaRight';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return evt.code;
|
return evt.code;
|
||||||
|
@ -56,11 +24,11 @@ function getKeycode(evt) {
|
||||||
// The de-facto standard is to use Windows Virtual-Key codes
|
// The de-facto standard is to use Windows Virtual-Key codes
|
||||||
// in the 'keyCode' field for non-printable characters. However
|
// in the 'keyCode' field for non-printable characters. However
|
||||||
// Webkit sets it to the same as charCode in 'keypress' events.
|
// Webkit sets it to the same as charCode in 'keypress' events.
|
||||||
if (evt.type !== 'keypress' && evt.keyCode in _vkeys2.default) {
|
if ((evt.type !== 'keypress') && (evt.keyCode in vkeys)) {
|
||||||
var code = _vkeys2.default[evt.keyCode];
|
var code = vkeys[evt.keyCode];
|
||||||
|
|
||||||
// macOS has messed up this code for some reason
|
// macOS has messed up this code for some reason
|
||||||
if (browser.isMac() && code === 'ContextMenu') {
|
if (browser.isMac() && (code === 'ContextMenu')) {
|
||||||
code = 'MetaRight';
|
code = 'MetaRight';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,40 +36,26 @@ function getKeycode(evt) {
|
||||||
// for the standard modifiers
|
// for the standard modifiers
|
||||||
if (evt.location === 2) {
|
if (evt.location === 2) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 'ShiftLeft':
|
case 'ShiftLeft': return 'ShiftRight';
|
||||||
return 'ShiftRight';
|
case 'ControlLeft': return 'ControlRight';
|
||||||
case 'ControlLeft':
|
case 'AltLeft': return 'AltRight';
|
||||||
return 'ControlRight';
|
|
||||||
case 'AltLeft':
|
|
||||||
return 'AltRight';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nor a bunch of the numpad keys
|
// Nor a bunch of the numpad keys
|
||||||
if (evt.location === 3) {
|
if (evt.location === 3) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 'Delete':
|
case 'Delete': return 'NumpadDecimal';
|
||||||
return 'NumpadDecimal';
|
case 'Insert': return 'Numpad0';
|
||||||
case 'Insert':
|
case 'End': return 'Numpad1';
|
||||||
return 'Numpad0';
|
case 'ArrowDown': return 'Numpad2';
|
||||||
case 'End':
|
case 'PageDown': return 'Numpad3';
|
||||||
return 'Numpad1';
|
case 'ArrowLeft': return 'Numpad4';
|
||||||
case 'ArrowDown':
|
case 'ArrowRight': return 'Numpad6';
|
||||||
return 'Numpad2';
|
case 'Home': return 'Numpad7';
|
||||||
case 'PageDown':
|
case 'ArrowUp': return 'Numpad8';
|
||||||
return 'Numpad3';
|
case 'PageUp': return 'Numpad9';
|
||||||
case 'ArrowLeft':
|
case 'Enter': return 'NumpadEnter';
|
||||||
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
|
// Get 'KeyboardEvent.key', handling legacy browsers
|
||||||
function getKey(evt) {
|
export function getKey(evt) {
|
||||||
// Are we getting a proper key value?
|
// Are we getting a proper key value?
|
||||||
if (evt.key !== undefined) {
|
if (evt.key !== undefined) {
|
||||||
// IE and Edge use some ancient version of the spec
|
// IE and Edge use some ancient version of the spec
|
||||||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
|
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
|
||||||
switch (evt.key) {
|
switch (evt.key) {
|
||||||
case 'Spacebar':
|
case 'Spacebar': return ' ';
|
||||||
return ' ';
|
case 'Esc': return 'Escape';
|
||||||
case 'Esc':
|
case 'Scroll': return 'ScrollLock';
|
||||||
return 'Escape';
|
case 'Win': return 'Meta';
|
||||||
case 'Scroll':
|
case 'Apps': return 'ContextMenu';
|
||||||
return 'ScrollLock';
|
case 'Up': return 'ArrowUp';
|
||||||
case 'Win':
|
case 'Left': return 'ArrowLeft';
|
||||||
return 'Meta';
|
case 'Right': return 'ArrowRight';
|
||||||
case 'Apps':
|
case 'Down': return 'ArrowDown';
|
||||||
return 'ContextMenu';
|
case 'Del': return 'Delete';
|
||||||
case 'Up':
|
case 'Divide': return '/';
|
||||||
return 'ArrowUp';
|
case 'Multiply': return '*';
|
||||||
case 'Left':
|
case 'Subtract': return '-';
|
||||||
return 'ArrowLeft';
|
case 'Add': return '+';
|
||||||
case 'Right':
|
case 'Decimal': return evt.char;
|
||||||
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
|
// Mozilla isn't fully in sync with the spec yet
|
||||||
switch (evt.key) {
|
switch (evt.key) {
|
||||||
case 'OS':
|
case 'OS': return 'Meta';
|
||||||
return 'Meta';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// iOS leaks some OS names
|
// iOS leaks some OS names
|
||||||
switch (evt.key) {
|
switch (evt.key) {
|
||||||
case 'UIKeyInputUpArrow':
|
case 'UIKeyInputUpArrow': return 'ArrowUp';
|
||||||
return 'ArrowUp';
|
case 'UIKeyInputDownArrow': return 'ArrowDown';
|
||||||
case 'UIKeyInputDownArrow':
|
case 'UIKeyInputLeftArrow': return 'ArrowLeft';
|
||||||
return 'ArrowDown';
|
case 'UIKeyInputRightArrow': return 'ArrowRight';
|
||||||
case 'UIKeyInputLeftArrow':
|
case 'UIKeyInputEscape': return 'Escape';
|
||||||
return 'ArrowLeft';
|
|
||||||
case 'UIKeyInputRightArrow':
|
|
||||||
return 'ArrowRight';
|
|
||||||
case 'UIKeyInputEscape':
|
|
||||||
return 'Escape';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IE and Edge have broken handling of AltGraph so we cannot
|
// IE and Edge have broken handling of AltGraph so we cannot
|
||||||
// trust them for printable characters
|
// 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;
|
return evt.key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to deduce it based on the physical key
|
// Try to deduce it based on the physical key
|
||||||
var code = getKeycode(evt);
|
var code = getKeycode(evt);
|
||||||
if (code in _fixedkeys2.default) {
|
if (code in fixedkeys) {
|
||||||
return _fixedkeys2.default[code];
|
return fixedkeys[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If that failed, then see if we have a printable character
|
// 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
|
// Get the most reliable keysym value we can get from a key event
|
||||||
function getKeysym(evt) {
|
export function getKeysym(evt){
|
||||||
var key = getKey(evt);
|
var key = getKey(evt);
|
||||||
|
|
||||||
if (key === 'Unidentified') {
|
if (key === 'Unidentified') {
|
||||||
|
@ -201,19 +134,19 @@ function getKeysym(evt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// First look up special keys
|
// First look up special keys
|
||||||
if (key in _domkeytable2.default) {
|
if (key in DOMKeyTable) {
|
||||||
var location = evt.location;
|
var location = evt.location;
|
||||||
|
|
||||||
// Safari screws up location for the right cmd key
|
// Safari screws up location for the right cmd key
|
||||||
if (key === 'Meta' && location === 0) {
|
if ((key === 'Meta') && (location === 0)) {
|
||||||
location = 2;
|
location = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location === undefined || location > 3) {
|
if ((location === undefined) || (location > 3)) {
|
||||||
location = 0;
|
location = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _domkeytable2.default[key][location];
|
return DOMKeyTable[key][location];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we need to look at the Unicode symbol instead
|
// Now we need to look at the Unicode symbol instead
|
||||||
|
@ -227,7 +160,7 @@ function getKeysym(evt) {
|
||||||
|
|
||||||
codepoint = key.charCodeAt();
|
codepoint = key.charCodeAt();
|
||||||
if (codepoint) {
|
if (codepoint) {
|
||||||
return _keysymdef2.default.lookup(codepoint);
|
return keysyms.lookup(codepoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
/*
|
/*
|
||||||
* noVNC: HTML5 VNC client
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
* Copyright (C) 2017 Pierre Ossman for Cendio AB
|
||||||
|
@ -14,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||||
* HTML key codes.
|
* HTML key codes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.default = {
|
export default {
|
||||||
0x08: 'Backspace',
|
0x08: 'Backspace',
|
||||||
0x09: 'Tab',
|
0x09: 'Tab',
|
||||||
0x0a: 'NumpadClear',
|
0x0a: 'NumpadClear',
|
||||||
|
@ -117,5 +112,5 @@ exports.default = {
|
||||||
0xb5: 'MediaSelect',
|
0xb5: 'MediaSelect',
|
||||||
0xb6: 'LaunchApp1',
|
0xb6: 'LaunchApp1',
|
||||||
0xb7: 'LaunchApp2',
|
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
|
* This file is auto-generated from keymaps.csv on 2017-05-31 16:20
|
||||||
* Database checksum sha256(92fd165507f2a3b8c5b3fa56e425d45788dbcb98cf067a307527d91ce22cab94)
|
* Database checksum sha256(92fd165507f2a3b8c5b3fa56e425d45788dbcb98cf067a307527d91ce22cab94)
|
||||||
* To re-generate, run:
|
* To re-generate, run:
|
||||||
* keymap-gen --lang=js code-map keymaps.csv html atset1
|
* 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 */
|
"Again": 0xe005, /* html:Again (Again) -> linux:129 (KEY_AGAIN) -> atset1:57349 */
|
||||||
"AltLeft": 0x38, /* html:AltLeft (AltLeft) -> linux:56 (KEY_LEFTALT) -> atset1:56 */
|
"AltLeft": 0x38, /* html:AltLeft (AltLeft) -> linux:56 (KEY_LEFTALT) -> atset1:56 */
|
||||||
"AltRight": 0xe038, /* html:AltRight (AltRight) -> linux:100 (KEY_RIGHTALT) -> atset1:57400 */
|
"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 */
|
"Suspend": 0xe025, /* html:Suspend (Suspend) -> linux:205 (KEY_SUSPEND) -> atset1:57381 */
|
||||||
"Tab": 0xf, /* html:Tab (Tab) -> linux:15 (KEY_TAB) -> atset1:15 */
|
"Tab": 0xf, /* html:Tab (Tab) -> linux:15 (KEY_TAB) -> atset1:15 */
|
||||||
"Undo": 0xe007, /* html:Undo (Undo) -> linux:131 (KEY_UNDO) -> atset1:57351 */
|
"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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* Copyright (C) 2012 Joel Martin
|
||||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
* 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.
|
* 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() {
|
window.addEventListener('touchstart', function onFirstTouch() {
|
||||||
exports.isTouchDevice = isTouchDevice = true;
|
isTouchDevice = true;
|
||||||
window.removeEventListener('touchstart', onFirstTouch, false);
|
window.removeEventListener('touchstart', onFirstTouch, false);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
var _cursor_uris_supported = null;
|
var _cursor_uris_supported = null;
|
||||||
|
|
||||||
function supportsCursorURIs() {
|
export function supportsCursorURIs () {
|
||||||
if (_cursor_uris_supported === null) {
|
if (_cursor_uris_supported === null) {
|
||||||
try {
|
try {
|
||||||
var target = document.createElement('canvas');
|
var target = document.createElement('canvas');
|
||||||
|
@ -59,22 +44,26 @@ function supportsCursorURIs() {
|
||||||
return _cursor_uris_supported;
|
return _cursor_uris_supported;
|
||||||
};
|
};
|
||||||
|
|
||||||
function isMac() {
|
export function isMac() {
|
||||||
return navigator && !!/mac/i.exec(navigator.platform);
|
return navigator && !!(/mac/i).exec(navigator.platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isIE() {
|
export function isIE() {
|
||||||
return navigator && !!/trident/i.exec(navigator.userAgent);
|
return navigator && !!(/trident/i).exec(navigator.userAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEdge() {
|
export function isEdge() {
|
||||||
return navigator && !!/edge/i.exec(navigator.userAgent);
|
return navigator && !!(/edge/i).exec(navigator.userAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isWindows() {
|
export function isWindows() {
|
||||||
return navigator && !!/win/i.exec(navigator.platform);
|
return navigator && !!(/win/i).exec(navigator.platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isIOS() {
|
export function isIOS() {
|
||||||
return navigator && (!!/ipad/i.exec(navigator.platform) || !!/iphone/i.exec(navigator.platform) || !!/ipod/i.exec(navigator.platform));
|
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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* Copyright (C) 2012 Joel Martin
|
||||||
|
@ -19,11 +10,11 @@ exports.releaseCapture = releaseCapture;
|
||||||
* Cross-browser event and position routines
|
* 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;
|
return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e;
|
||||||
};
|
};
|
||||||
|
|
||||||
function stopEvent(e) {
|
export function stopEvent (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
@ -65,13 +56,14 @@ var _captureObserver = new MutationObserver(_captureElemChanged);
|
||||||
|
|
||||||
var _captureIndex = 0;
|
var _captureIndex = 0;
|
||||||
|
|
||||||
function setCapture(elem) {
|
export function setCapture (elem) {
|
||||||
if (elem.setCapture) {
|
if (elem.setCapture) {
|
||||||
|
|
||||||
elem.setCapture();
|
elem.setCapture();
|
||||||
|
|
||||||
// IE releases capture on 'click' events which might not trigger
|
// IE releases capture on 'click' events which might not trigger
|
||||||
elem.addEventListener('mouseup', releaseCapture);
|
elem.addEventListener('mouseup', releaseCapture);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Release any existing capture in case this method is
|
// Release any existing capture in case this method is
|
||||||
// called multiple times without coordination
|
// called multiple times without coordination
|
||||||
|
@ -115,10 +107,11 @@ function setCapture(elem) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function releaseCapture() {
|
export function releaseCapture () {
|
||||||
if (document.releaseCapture) {
|
if (document.releaseCapture) {
|
||||||
|
|
||||||
document.releaseCapture();
|
document.releaseCapture();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!_captureElem) {
|
if (!_captureElem) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
/*
|
/*
|
||||||
* noVNC: HTML5 VNC client
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright 2017 Pierre Ossman for Cendio AB
|
* Copyright 2017 Pierre Ossman for Cendio AB
|
||||||
|
@ -39,7 +34,7 @@ var EventTargetMixin = {
|
||||||
callback.call(this, event);
|
callback.call(this, event);
|
||||||
}, this);
|
}, this);
|
||||||
return !event.defaultPrevented;
|
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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* Copyright (C) 2012 Joel Martin
|
||||||
|
@ -24,24 +17,24 @@ var Info = function (msg) {};
|
||||||
var Warn = function (msg) {};
|
var Warn = function (msg) {};
|
||||||
var Error = function (msg) {};
|
var Error = function (msg) {};
|
||||||
|
|
||||||
function init_logging(level) {
|
export function init_logging (level) {
|
||||||
if (typeof level === 'undefined') {
|
if (typeof level === 'undefined') {
|
||||||
level = _log_level;
|
level = _log_level;
|
||||||
} else {
|
} else {
|
||||||
_log_level = level;
|
_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") {
|
if (typeof window.console !== "undefined") {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 'debug':
|
case 'debug':
|
||||||
exports.Debug = Debug = console.debug.bind(window.console);
|
Debug = console.debug.bind(window.console);
|
||||||
case 'info':
|
case 'info':
|
||||||
exports.Info = Info = console.info.bind(window.console);
|
Info = console.info.bind(window.console);
|
||||||
case 'warn':
|
case 'warn':
|
||||||
exports.Warn = Warn = console.warn.bind(window.console);
|
Warn = console.warn.bind(window.console);
|
||||||
case 'error':
|
case 'error':
|
||||||
exports.Error = Error = console.error.bind(window.console);
|
Error = console.error.bind(window.console);
|
||||||
case 'none':
|
case 'none':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -49,14 +42,10 @@ function init_logging(level) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function get_logging() {
|
export function get_logging () {
|
||||||
return _log_level;
|
return _log_level;
|
||||||
};
|
};
|
||||||
exports.Debug = Debug;
|
export { Debug, Info, Warn, Error };
|
||||||
exports.Info = Info;
|
|
||||||
exports.Warn = Warn;
|
|
||||||
exports.Error = Error;
|
|
||||||
|
|
||||||
// Initialize logging level
|
// Initialize logging level
|
||||||
|
|
||||||
init_logging();
|
init_logging();
|
|
@ -1,5 +1,3 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* noVNC: HTML5 VNC client
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright 2017 Pierre Ossman for noVNC
|
* Copyright 2017 Pierre Ossman for noVNC
|
||||||
|
@ -12,12 +10,9 @@
|
||||||
if (typeof Object.assign != 'function') {
|
if (typeof Object.assign != 'function') {
|
||||||
// Must be writable: true, enumerable: false, configurable: true
|
// Must be writable: true, enumerable: false, configurable: true
|
||||||
Object.defineProperty(Object, "assign", {
|
Object.defineProperty(Object, "assign", {
|
||||||
value: function assign(target, varArgs) {
|
value: function assign(target, varArgs) { // .length of function is 2
|
||||||
// .length of function is 2
|
|
||||||
'use strict';
|
'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');
|
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++) {
|
for (var index = 1; index < arguments.length; index++) {
|
||||||
var nextSource = arguments[index];
|
var nextSource = arguments[index];
|
||||||
|
|
||||||
if (nextSource != null) {
|
if (nextSource != null) { // Skip over if undefined or null
|
||||||
// Skip over if undefined or null
|
|
||||||
for (var nextKey in nextSource) {
|
for (var nextKey in nextSource) {
|
||||||
// Avoid bugs when hasOwnProperty is shadowed
|
// Avoid bugs when hasOwnProperty is shadowed
|
||||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
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
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* Copyright (C) 2012 Joel Martin
|
||||||
|
@ -15,8 +9,7 @@ exports.decodeUTF8 = decodeUTF8;
|
||||||
/*
|
/*
|
||||||
* Decode from UTF-8
|
* Decode from UTF-8
|
||||||
*/
|
*/
|
||||||
function decodeUTF8(utf8string) {
|
export function decodeUTF8 (utf8string) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
return decodeURIComponent(escape(utf8string));
|
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", {
|
import * as Log from './util/logging.js';
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = Websock;
|
|
||||||
|
|
||||||
var _logging = require('./util/logging.js');
|
export default function Websock() {
|
||||||
|
|
||||||
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() {
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
this._websocket = null; // WebSocket object
|
this._websocket = null; // WebSocket object
|
||||||
|
@ -34,21 +37,7 @@ function Websock() {
|
||||||
'close': function () {},
|
'close': function () {},
|
||||||
'error': 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
|
// this has performance issues in some versions Chromium, and
|
||||||
// doesn't gain a tremendous amount of performance increase in Firefox
|
// 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 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
|
// This is only for PhantomJS, which doesn't like apply-ing
|
||||||
// with Typed Arrays
|
// with Typed Arrays
|
||||||
try {
|
try {
|
||||||
var arr = new Uint8Array([1, 2, 3]);
|
var arr = new Uint8Array([1, 2, 3]);
|
||||||
String.fromCharCode.apply(null, arr);
|
String.fromCharCode.apply(null, arr);
|
||||||
return function (a) {
|
return function (a) { return String.fromCharCode.apply(null, a); };
|
||||||
return String.fromCharCode.apply(null, a);
|
|
||||||
};
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
return function (a) {
|
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 = {
|
Websock.prototype = {
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
|
@ -114,34 +102,32 @@ Websock.prototype = {
|
||||||
|
|
||||||
// TODO(directxman12): test performance with these vs a DataView
|
// TODO(directxman12): test performance with these vs a DataView
|
||||||
rQshift16: function () {
|
rQshift16: function () {
|
||||||
return (this._rQ[this._rQi++] << 8) + this._rQ[this._rQi++];
|
return (this._rQ[this._rQi++] << 8) +
|
||||||
|
this._rQ[this._rQi++];
|
||||||
},
|
},
|
||||||
|
|
||||||
rQshift32: function () {
|
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) {
|
rQshiftStr: function (len) {
|
||||||
if (typeof len === 'undefined') {
|
if (typeof(len) === 'undefined') { len = this.rQlen(); }
|
||||||
len = this.rQlen();
|
|
||||||
}
|
|
||||||
var arr = new Uint8Array(this._rQ.buffer, this._rQi, len);
|
var arr = new Uint8Array(this._rQ.buffer, this._rQi, len);
|
||||||
this._rQi += len;
|
this._rQi += len;
|
||||||
return typedArrayToString(arr);
|
return typedArrayToString(arr);
|
||||||
},
|
},
|
||||||
|
|
||||||
rQshiftBytes: function (len) {
|
rQshiftBytes: function (len) {
|
||||||
if (typeof len === 'undefined') {
|
if (typeof(len) === 'undefined') { len = this.rQlen(); }
|
||||||
len = this.rQlen();
|
|
||||||
}
|
|
||||||
this._rQi += len;
|
this._rQi += len;
|
||||||
return new Uint8Array(this._rQ.buffer, this._rQi - len, len);
|
return new Uint8Array(this._rQ.buffer, this._rQi - len, len);
|
||||||
},
|
},
|
||||||
|
|
||||||
rQshiftTo: function (target, len) {
|
rQshiftTo: function (target, len) {
|
||||||
if (len === undefined) {
|
if (len === undefined) { len = this.rQlen(); }
|
||||||
len = this.rQlen();
|
|
||||||
}
|
|
||||||
// TODO: make this just use set with views when using a ArrayBuffer to store the rQ
|
// 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));
|
target.set(new Uint8Array(this._rQ.buffer, this._rQi, len));
|
||||||
this._rQi += len;
|
this._rQi += len;
|
||||||
|
@ -225,7 +211,7 @@ Websock.prototype = {
|
||||||
this._websocket.binaryType = 'arraybuffer';
|
this._websocket.binaryType = 'arraybuffer';
|
||||||
|
|
||||||
this._websocket.onmessage = this._recv_message.bind(this);
|
this._websocket.onmessage = this._recv_message.bind(this);
|
||||||
this._websocket.onopen = function () {
|
this._websocket.onopen = (function () {
|
||||||
Log.Debug('>> WebSock.onopen');
|
Log.Debug('>> WebSock.onopen');
|
||||||
if (this._websocket.protocol) {
|
if (this._websocket.protocol) {
|
||||||
Log.Info("Server choose sub-protocol: " + this._websocket.protocol);
|
Log.Info("Server choose sub-protocol: " + this._websocket.protocol);
|
||||||
|
@ -233,29 +219,28 @@ Websock.prototype = {
|
||||||
|
|
||||||
this._eventHandlers.open();
|
this._eventHandlers.open();
|
||||||
Log.Debug("<< WebSock.onopen");
|
Log.Debug("<< WebSock.onopen");
|
||||||
}.bind(this);
|
}).bind(this);
|
||||||
this._websocket.onclose = function (e) {
|
this._websocket.onclose = (function (e) {
|
||||||
Log.Debug(">> WebSock.onclose");
|
Log.Debug(">> WebSock.onclose");
|
||||||
this._eventHandlers.close(e);
|
this._eventHandlers.close(e);
|
||||||
Log.Debug("<< WebSock.onclose");
|
Log.Debug("<< WebSock.onclose");
|
||||||
}.bind(this);
|
}).bind(this);
|
||||||
this._websocket.onerror = function (e) {
|
this._websocket.onerror = (function (e) {
|
||||||
Log.Debug(">> WebSock.onerror: " + e);
|
Log.Debug(">> WebSock.onerror: " + e);
|
||||||
this._eventHandlers.error(e);
|
this._eventHandlers.error(e);
|
||||||
Log.Debug("<< WebSock.onerror: " + e);
|
Log.Debug("<< WebSock.onerror: " + e);
|
||||||
}.bind(this);
|
}).bind(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function () {
|
close: function () {
|
||||||
if (this._websocket) {
|
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");
|
Log.Info("Closing WebSocket connection");
|
||||||
this._websocket.close();
|
this._websocket.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._websocket.onmessage = function (e) {
|
this._websocket.onmessage = function (e) { return; };
|
||||||
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
|
// reduce buffer size, avoiding mem copy
|
||||||
function shrinkBuf(buf, size) {
|
export function shrinkBuf (buf, size) {
|
||||||
if (buf.length === size) {
|
if (buf.length === size) { return buf; }
|
||||||
return buf;
|
if (buf.subarray) { return buf.subarray(0, size); }
|
||||||
}
|
|
||||||
if (buf.subarray) {
|
|
||||||
return buf.subarray(0, size);
|
|
||||||
}
|
|
||||||
buf.length = size;
|
buf.length = size;
|
||||||
return buf;
|
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) {
|
if (src.subarray && dest.subarray) {
|
||||||
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
|
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
|
||||||
return;
|
return;
|
||||||
|
@ -30,7 +19,7 @@ function arraySet(dest, src, src_offs, len, dest_offs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Join array of chunks to single array.
|
// Join array of chunks to single array.
|
||||||
function flattenChunks(chunks) {
|
export function flattenChunks (chunks) {
|
||||||
var i, l, len, pos, chunk, result;
|
var i, l, len, pos, chunk, result;
|
||||||
|
|
||||||
// calculate data length
|
// calculate data length
|
||||||
|
@ -51,6 +40,6 @@ function flattenChunks(chunks) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
var Buf8 = exports.Buf8 = Uint8Array;
|
export var Buf8 = Uint8Array;
|
||||||
var Buf16 = exports.Buf16 = Uint16Array;
|
export var Buf16 = Uint16Array;
|
||||||
var Buf32 = exports.Buf32 = Int32Array;
|
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.
|
// Note: adler32 takes 12% for level 0 and 2% for level 6.
|
||||||
// It doesn't worth to make additional optimizationa as in original.
|
// It doesn't worth to make additional optimizationa as in original.
|
||||||
// Small size is preferable.
|
// Small size is preferable.
|
||||||
|
|
||||||
function adler32(adler, buf, len, pos) {
|
export default function adler32(adler, buf, len, pos) {
|
||||||
var s1 = adler & 0xffff | 0,
|
var s1 = (adler & 0xffff) |0,
|
||||||
s2 = adler >>> 16 & 0xffff | 0,
|
s2 = ((adler >>> 16) & 0xffff) |0,
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
while (len !== 0) {
|
while (len !== 0) {
|
||||||
|
@ -21,13 +15,13 @@ function adler32(adler, buf, len, pos) {
|
||||||
len -= n;
|
len -= n;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
s1 = s1 + buf[pos++] | 0;
|
s1 = (s1 + buf[pos++]) |0;
|
||||||
s2 = s2 + s1 | 0;
|
s2 = (s2 + s1) |0;
|
||||||
} while (--n);
|
} while (--n);
|
||||||
|
|
||||||
s1 %= 65521;
|
s1 %= 65521;
|
||||||
s2 %= 65521;
|
s2 %= 65521;
|
||||||
}
|
}
|
||||||
|
|
||||||
return s1 | s2 << 16 | 0;
|
return (s1 | (s2 << 16)) |0;
|
||||||
}
|
}
|
|
@ -1,9 +1,4 @@
|
||||||
"use strict";
|
export default {
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = {
|
|
||||||
|
|
||||||
/* Allowed flush values; see deflate() and inflate() below for details */
|
/* Allowed flush values; see deflate() and inflate() below for details */
|
||||||
Z_NO_FLUSH: 0,
|
Z_NO_FLUSH: 0,
|
||||||
|
@ -33,6 +28,7 @@ exports.default = {
|
||||||
Z_BEST_COMPRESSION: 9,
|
Z_BEST_COMPRESSION: 9,
|
||||||
Z_DEFAULT_COMPRESSION: -1,
|
Z_DEFAULT_COMPRESSION: -1,
|
||||||
|
|
||||||
|
|
||||||
Z_FILTERED: 1,
|
Z_FILTERED: 1,
|
||||||
Z_HUFFMAN_ONLY: 2,
|
Z_HUFFMAN_ONLY: 2,
|
||||||
Z_RLE: 3,
|
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.
|
// Note: we can't get significant speed boost here.
|
||||||
// So write code to minimize size - no pregenerated tables
|
// So write code to minimize size - no pregenerated tables
|
||||||
// and array tools dependencies.
|
// and array tools dependencies.
|
||||||
|
|
||||||
|
|
||||||
// Use ordinary array, since untyped makes no boost here
|
// Use ordinary array, since untyped makes no boost here
|
||||||
function makeTable() {
|
export default function makeTable() {
|
||||||
var c,
|
var c, table = [];
|
||||||
table = [];
|
|
||||||
|
|
||||||
for (var n = 0; n < 256; n++) {
|
for (var n = 0; n < 256; n++) {
|
||||||
c = n;
|
c = n;
|
||||||
for (var k = 0; k < 8; k++) {
|
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;
|
table[n] = c;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +21,7 @@ function makeTable() {
|
||||||
// Create table on load. Just 255 signed longs. Not a problem.
|
// Create table on load. Just 255 signed longs. Not a problem.
|
||||||
var crcTable = makeTable();
|
var crcTable = makeTable();
|
||||||
|
|
||||||
|
|
||||||
function crc32(crc, buf, len, pos) {
|
function crc32(crc, buf, len, pos) {
|
||||||
var t = crcTable,
|
var t = crcTable,
|
||||||
end = pos + len;
|
end = pos + len;
|
||||||
|
@ -35,8 +29,8 @@ function crc32(crc, buf, len, pos) {
|
||||||
crc ^= -1;
|
crc ^= -1;
|
||||||
|
|
||||||
for (var i = pos; i < end; i++) {
|
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";
|
import * as utils from "../utils/common.js";
|
||||||
|
import * as trees from "./trees.js";
|
||||||
Object.defineProperty(exports, "__esModule", {
|
import adler32 from "./adler32.js";
|
||||||
value: true
|
import crc32 from "./crc32.js";
|
||||||
});
|
import msg from "./messages.js";
|
||||||
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; } }
|
|
||||||
|
|
||||||
/* Public constants ==========================================================*/
|
/* Public constants ==========================================================*/
|
||||||
/* ===========================================================================*/
|
/* ===========================================================================*/
|
||||||
|
|
||||||
|
|
||||||
/* Allowed flush values; see deflate() and inflate() below for details */
|
/* Allowed flush values; see deflate() and inflate() below for details */
|
||||||
var Z_NO_FLUSH = 0;
|
var Z_NO_FLUSH = 0;
|
||||||
var Z_PARTIAL_FLUSH = 1;
|
var Z_PARTIAL_FLUSH = 1;
|
||||||
|
@ -62,6 +38,7 @@ var Z_BUF_ERROR = -5;
|
||||||
//var Z_BEST_COMPRESSION = 9;
|
//var Z_BEST_COMPRESSION = 9;
|
||||||
var Z_DEFAULT_COMPRESSION = -1;
|
var Z_DEFAULT_COMPRESSION = -1;
|
||||||
|
|
||||||
|
|
||||||
var Z_FILTERED = 1;
|
var Z_FILTERED = 1;
|
||||||
var Z_HUFFMAN_ONLY = 2;
|
var Z_HUFFMAN_ONLY = 2;
|
||||||
var Z_RLE = 3;
|
var Z_RLE = 3;
|
||||||
|
@ -74,17 +51,20 @@ var Z_DEFAULT_STRATEGY = 0;
|
||||||
//var Z_ASCII = 1; // = Z_TEXT
|
//var Z_ASCII = 1; // = Z_TEXT
|
||||||
var Z_UNKNOWN = 2;
|
var Z_UNKNOWN = 2;
|
||||||
|
|
||||||
|
|
||||||
/* The deflate compression method */
|
/* The deflate compression method */
|
||||||
var Z_DEFLATED = 8;
|
var Z_DEFLATED = 8;
|
||||||
|
|
||||||
/*============================================================================*/
|
/*============================================================================*/
|
||||||
|
|
||||||
|
|
||||||
var MAX_MEM_LEVEL = 9;
|
var MAX_MEM_LEVEL = 9;
|
||||||
/* Maximum value for memLevel in deflateInit2 */
|
/* Maximum value for memLevel in deflateInit2 */
|
||||||
var MAX_WBITS = 15;
|
var MAX_WBITS = 15;
|
||||||
/* 32K LZ77 window */
|
/* 32K LZ77 window */
|
||||||
var DEF_MEM_LEVEL = 8;
|
var DEF_MEM_LEVEL = 8;
|
||||||
|
|
||||||
|
|
||||||
var LENGTH_CODES = 29;
|
var LENGTH_CODES = 29;
|
||||||
/* number of length codes, not counting the special END_BLOCK code */
|
/* number of length codes, not counting the special END_BLOCK code */
|
||||||
var LITERALS = 256;
|
var LITERALS = 256;
|
||||||
|
@ -102,7 +82,7 @@ var MAX_BITS = 15;
|
||||||
|
|
||||||
var MIN_MATCH = 3;
|
var MIN_MATCH = 3;
|
||||||
var MAX_MATCH = 258;
|
var MAX_MATCH = 258;
|
||||||
var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;
|
var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
|
||||||
|
|
||||||
var PRESET_DICT = 0x20;
|
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.
|
var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
||||||
|
|
||||||
function err(strm, errorCode) {
|
function err(strm, errorCode) {
|
||||||
strm.msg = _messages2.default[errorCode];
|
strm.msg = msg[errorCode];
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rank(f) {
|
function rank(f) {
|
||||||
return (f << 1) - (f > 4 ? 9 : 0);
|
return ((f) << 1) - ((f) > 4 ? 9 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function zero(buf) {
|
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
||||||
var len = buf.length;while (--len >= 0) {
|
|
||||||
buf[len] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* Flush as much pending output as possible. All deflate() output goes
|
* Flush as much pending output as possible. All deflate() output goes
|
||||||
|
@ -150,9 +127,7 @@ function flush_pending(strm) {
|
||||||
if (len > strm.avail_out) {
|
if (len > strm.avail_out) {
|
||||||
len = strm.avail_out;
|
len = strm.avail_out;
|
||||||
}
|
}
|
||||||
if (len === 0) {
|
if (len === 0) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
|
utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
|
||||||
strm.next_out += len;
|
strm.next_out += len;
|
||||||
|
@ -165,16 +140,19 @@ function flush_pending(strm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function flush_block_only(s, last) {
|
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;
|
s.block_start = s.strstart;
|
||||||
flush_pending(s.strm);
|
flush_pending(s.strm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function put_byte(s, b) {
|
function put_byte(s, b) {
|
||||||
s.pending_buf[s.pending++] = b;
|
s.pending_buf[s.pending++] = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* Put a short in the pending buffer. The 16-bit value is put in MSB order.
|
* 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
|
* 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) {
|
function putShortMSB(s, b) {
|
||||||
// put_byte(s, (Byte)(b >> 8));
|
// put_byte(s, (Byte)(b >> 8));
|
||||||
// put_byte(s, (Byte)(b & 0xff));
|
// 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;
|
s.pending_buf[s.pending++] = b & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Read a new buffer from the current input stream, update the adler32
|
* Read a new buffer from the current input stream, update the adler32
|
||||||
* and total number of bytes read. All deflate() input goes through
|
* 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) {
|
function read_buf(strm, buf, start, size) {
|
||||||
var len = strm.avail_in;
|
var len = strm.avail_in;
|
||||||
|
|
||||||
if (len > size) {
|
if (len > size) { len = size; }
|
||||||
len = size;
|
if (len === 0) { return 0; }
|
||||||
}
|
|
||||||
if (len === 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
strm.avail_in -= len;
|
strm.avail_in -= len;
|
||||||
|
|
||||||
// zmemcpy(buf, strm->next_in, len);
|
// zmemcpy(buf, strm->next_in, len);
|
||||||
utils.arraySet(buf, strm.input, strm.next_in, len, start);
|
utils.arraySet(buf, strm.input, strm.next_in, len, start);
|
||||||
if (strm.state.wrap === 1) {
|
if (strm.state.wrap === 1) {
|
||||||
strm.adler = (0, _adler2.default)(strm.adler, buf, len, start);
|
strm.adler = adler32(strm.adler, buf, len, start);
|
||||||
} else if (strm.state.wrap === 2) {
|
}
|
||||||
strm.adler = (0, _crc2.default)(strm.adler, buf, len, start);
|
|
||||||
|
else if (strm.state.wrap === 2) {
|
||||||
|
strm.adler = crc32(strm.adler, buf, len, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
strm.next_in += len;
|
strm.next_in += len;
|
||||||
|
@ -220,6 +197,7 @@ function read_buf(strm, buf, start, size) {
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Set match_start to the longest match starting at the given string and
|
* 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,
|
* 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 len; /* length of current match */
|
||||||
var best_len = s.prev_length; /* best match length so far */
|
var best_len = s.prev_length; /* best match length so far */
|
||||||
var nice_match = s.nice_match; /* stop if match long enough */
|
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
|
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
|
/* Do not look for matches beyond the end of the input. This is necessary
|
||||||
* to make deflate deterministic.
|
* to make deflate deterministic.
|
||||||
*/
|
*/
|
||||||
if (nice_match > s.lookahead) {
|
if (nice_match > s.lookahead) { nice_match = s.lookahead; }
|
||||||
nice_match = s.lookahead;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need 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.
|
* 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +281,11 @@ function longest_match(s, cur_match) {
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
// Do nothing
|
// 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");
|
// Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
||||||
|
|
||||||
|
@ -325,6 +309,7 @@ function longest_match(s, cur_match) {
|
||||||
return s.lookahead;
|
return s.lookahead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Fill the window when the lookahead becomes insufficient.
|
* Fill the window when the lookahead becomes insufficient.
|
||||||
* Updates strstart and lookahead.
|
* Updates strstart and lookahead.
|
||||||
|
@ -381,14 +366,14 @@ function fill_window(s) {
|
||||||
p = n;
|
p = n;
|
||||||
do {
|
do {
|
||||||
m = s.head[--p];
|
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);
|
} while (--n);
|
||||||
|
|
||||||
n = _w_size;
|
n = _w_size;
|
||||||
p = n;
|
p = n;
|
||||||
do {
|
do {
|
||||||
m = s.prev[--p];
|
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
|
/* If n is not on any hash chain, prev[n] is garbage but
|
||||||
* its value will never be used.
|
* its value will never be used.
|
||||||
*/
|
*/
|
||||||
|
@ -421,13 +406,13 @@ function fill_window(s) {
|
||||||
s.ins_h = s.window[str];
|
s.ins_h = s.window[str];
|
||||||
|
|
||||||
/* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
|
/* 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
|
//#if MIN_MATCH != 3
|
||||||
// Call update_hash() MIN_MATCH-3 more times
|
// Call update_hash() MIN_MATCH-3 more times
|
||||||
//#endif
|
//#endif
|
||||||
while (s.insert) {
|
while (s.insert) {
|
||||||
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
/* 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.prev[str & s.w_mask] = s.head[s.ins_h];
|
||||||
s.head[s.ins_h] = str;
|
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,
|
/* 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.
|
* but this is not important since only literal bytes will be emitted.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
|
} 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
|
/* 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;
|
return BS_NEED_MORE;
|
||||||
}
|
}
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Flush if we may have to slide, otherwise block_start may become
|
/* Flush if we may have to slide, otherwise block_start may become
|
||||||
* negative and the data will be gone:
|
* 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(s, 0); ***/
|
||||||
flush_block_only(s, false);
|
flush_block_only(s, false);
|
||||||
if (s.strm.avail_out === 0) {
|
if (s.strm.avail_out === 0) {
|
||||||
|
@ -612,7 +600,7 @@ function deflate_fast(s, flush) {
|
||||||
hash_head = 0/*NIL*/;
|
hash_head = 0/*NIL*/;
|
||||||
if (s.lookahead >= MIN_MATCH) {
|
if (s.lookahead >= MIN_MATCH) {
|
||||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
/*** 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];
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||||
s.head[s.ins_h] = s.strstart;
|
s.head[s.ins_h] = s.strstart;
|
||||||
/***/
|
/***/
|
||||||
|
@ -621,7 +609,7 @@ function deflate_fast(s, flush) {
|
||||||
/* Find the longest match, discarding those <= prev_length.
|
/* Find the longest match, discarding those <= prev_length.
|
||||||
* At this point we have always match_length < MIN_MATCH
|
* 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
|
/* To simplify the code, we prevent matches with the string
|
||||||
* of window index 0 (in particular we have to avoid a match
|
* of window index 0 (in particular we have to avoid a match
|
||||||
* of the string with itself at the start of the input file).
|
* of the string with itself at the start of the input file).
|
||||||
|
@ -646,7 +634,7 @@ function deflate_fast(s, flush) {
|
||||||
do {
|
do {
|
||||||
s.strstart++;
|
s.strstart++;
|
||||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
/*** 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];
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||||
s.head[s.ins_h] = s.strstart;
|
s.head[s.ins_h] = s.strstart;
|
||||||
/***/
|
/***/
|
||||||
|
@ -655,12 +643,13 @@ function deflate_fast(s, flush) {
|
||||||
*/
|
*/
|
||||||
} while (--s.match_length !== 0);
|
} while (--s.match_length !== 0);
|
||||||
s.strstart++;
|
s.strstart++;
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
s.strstart += s.match_length;
|
s.strstart += s.match_length;
|
||||||
s.match_length = 0;
|
s.match_length = 0;
|
||||||
s.ins_h = s.window[s.strstart];
|
s.ins_h = s.window[s.strstart];
|
||||||
/* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
|
/* 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
|
//#if MIN_MATCH != 3
|
||||||
// Call UPDATE_HASH() MIN_MATCH-3 more times
|
// 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) {
|
if (flush === Z_FINISH) {
|
||||||
/*** FLUSH_BLOCK(s, 1); ***/
|
/*** FLUSH_BLOCK(s, 1); ***/
|
||||||
flush_block_only(s, true);
|
flush_block_only(s, true);
|
||||||
|
@ -731,9 +720,7 @@ function deflate_slow(s, flush) {
|
||||||
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
||||||
return BS_NEED_MORE;
|
return BS_NEED_MORE;
|
||||||
}
|
}
|
||||||
if (s.lookahead === 0) {
|
if (s.lookahead === 0) { break; } /* flush the current block */
|
||||||
break;
|
|
||||||
} /* flush the current block */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the string window[strstart .. strstart+2] in the
|
/* Insert the string window[strstart .. strstart+2] in the
|
||||||
|
@ -742,7 +729,7 @@ function deflate_slow(s, flush) {
|
||||||
hash_head = 0/*NIL*/;
|
hash_head = 0/*NIL*/;
|
||||||
if (s.lookahead >= MIN_MATCH) {
|
if (s.lookahead >= MIN_MATCH) {
|
||||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
/*** 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];
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||||
s.head[s.ins_h] = s.strstart;
|
s.head[s.ins_h] = s.strstart;
|
||||||
/***/
|
/***/
|
||||||
|
@ -754,7 +741,8 @@ function deflate_slow(s, flush) {
|
||||||
s.prev_match = s.match_start;
|
s.prev_match = s.match_start;
|
||||||
s.match_length = MIN_MATCH - 1;
|
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
|
/* To simplify the code, we prevent matches with the string
|
||||||
* of window index 0 (in particular we have to avoid a match
|
* of window index 0 (in particular we have to avoid a match
|
||||||
* of the string with itself at the start of the input file).
|
* 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);
|
s.match_length = longest_match(s, hash_head);
|
||||||
/* longest_match() sets match_start */
|
/* 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
|
/* If prev_match is also MIN_MATCH, match_start is garbage
|
||||||
* but we will ignore the current match anyway.
|
* but we will ignore the current match anyway.
|
||||||
|
@ -792,7 +781,7 @@ function deflate_slow(s, flush) {
|
||||||
do {
|
do {
|
||||||
if (++s.strstart <= max_insert) {
|
if (++s.strstart <= max_insert) {
|
||||||
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
/*** 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];
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
||||||
s.head[s.ins_h] = s.strstart;
|
s.head[s.ins_h] = s.strstart;
|
||||||
/***/
|
/***/
|
||||||
|
@ -810,6 +799,7 @@ function deflate_slow(s, flush) {
|
||||||
}
|
}
|
||||||
/***/
|
/***/
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (s.match_available) {
|
} else if (s.match_available) {
|
||||||
/* If there was no match at the previous position, output a
|
/* If there was no match at the previous position, output a
|
||||||
* single literal. If there was a match but the current match
|
* single literal. If there was a match but the current match
|
||||||
|
@ -868,6 +858,7 @@ function deflate_slow(s, flush) {
|
||||||
return BS_BLOCK_DONE;
|
return BS_BLOCK_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
|
* 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
|
* 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) {
|
if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
|
||||||
return BS_NEED_MORE;
|
return BS_NEED_MORE;
|
||||||
}
|
}
|
||||||
if (s.lookahead === 0) {
|
if (s.lookahead === 0) { break; } /* flush the current block */
|
||||||
break;
|
|
||||||
} /* flush the current block */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See how many times the previous byte repeats */
|
/* See how many times the previous byte repeats */
|
||||||
|
@ -904,7 +893,11 @@ function deflate_rle(s, flush) {
|
||||||
strend = s.strstart + MAX_MATCH;
|
strend = s.strstart + MAX_MATCH;
|
||||||
do {
|
do {
|
||||||
// Do nothing
|
// 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);
|
s.match_length = MAX_MATCH - (strend - scan);
|
||||||
if (s.match_length > s.lookahead) {
|
if (s.match_length > s.lookahead) {
|
||||||
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 */
|
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Initialize the "longest match" routines for a new zlib stream
|
* Initialize the "longest match" routines for a new zlib stream
|
||||||
*/
|
*/
|
||||||
|
@ -1073,6 +1067,7 @@ function lm_init(s) {
|
||||||
s.ins_h = 0;
|
s.ins_h = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function DeflateState() {
|
function DeflateState() {
|
||||||
this.strm = null; /* pointer back to this zlib stream */
|
this.strm = null; /* pointer back to this zlib stream */
|
||||||
this.status = 0; /* as the name implies */
|
this.status = 0; /* as the name implies */
|
||||||
|
@ -1241,6 +1236,7 @@ function DeflateState() {
|
||||||
this.matches = 0; /* number of string matches in current block */
|
this.matches = 0; /* number of string matches in current block */
|
||||||
this.insert = 0; /* bytes at end of window left to insert */
|
this.insert = 0; /* bytes at end of window left to insert */
|
||||||
|
|
||||||
|
|
||||||
this.bi_buf = 0;
|
this.bi_buf = 0;
|
||||||
/* Output buffer. bits are inserted starting at the bottom (least
|
/* Output buffer. bits are inserted starting at the bottom (least
|
||||||
* significant bits).
|
* significant bits).
|
||||||
|
@ -1260,6 +1256,7 @@ function DeflateState() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function deflateResetKeep(strm) {
|
function deflateResetKeep(strm) {
|
||||||
var s;
|
var s;
|
||||||
|
|
||||||
|
@ -1278,14 +1275,17 @@ function deflateResetKeep(strm) {
|
||||||
s.wrap = -s.wrap;
|
s.wrap = -s.wrap;
|
||||||
/* was made negative by deflate(..., Z_FINISH); */
|
/* was made negative by deflate(..., Z_FINISH); */
|
||||||
}
|
}
|
||||||
s.status = s.wrap ? INIT_STATE : BUSY_STATE;
|
s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
|
||||||
strm.adler = s.wrap === 2 ? 0 // crc32(0, Z_NULL, 0)
|
strm.adler = (s.wrap === 2) ?
|
||||||
: 1; // adler32(0, Z_NULL, 0)
|
0 // crc32(0, Z_NULL, 0)
|
||||||
|
:
|
||||||
|
1; // adler32(0, Z_NULL, 0)
|
||||||
s.last_flush = Z_NO_FLUSH;
|
s.last_flush = Z_NO_FLUSH;
|
||||||
trees._tr_init(s);
|
trees._tr_init(s);
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function deflateReset(strm) {
|
function deflateReset(strm) {
|
||||||
var ret = deflateResetKeep(strm);
|
var ret = deflateResetKeep(strm);
|
||||||
if (ret === Z_OK) {
|
if (ret === Z_OK) {
|
||||||
|
@ -1294,20 +1294,17 @@ function deflateReset(strm) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function deflateSetHeader(strm, head) {
|
function deflateSetHeader(strm, head) {
|
||||||
if (!strm || !strm.state) {
|
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
||||||
return Z_STREAM_ERROR;
|
if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
|
||||||
}
|
|
||||||
if (strm.state.wrap !== 2) {
|
|
||||||
return Z_STREAM_ERROR;
|
|
||||||
}
|
|
||||||
strm.state.gzhead = head;
|
strm.state.gzhead = head;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
||||||
if (!strm) {
|
if (!strm) { // === Z_NULL
|
||||||
// === Z_NULL
|
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
var wrap = 1;
|
var wrap = 1;
|
||||||
|
@ -1316,19 +1313,24 @@ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
||||||
level = 6;
|
level = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windowBits < 0) {
|
if (windowBits < 0) { /* suppress zlib wrapper */
|
||||||
/* suppress zlib wrapper */
|
|
||||||
wrap = 0;
|
wrap = 0;
|
||||||
windowBits = -windowBits;
|
windowBits = -windowBits;
|
||||||
} else if (windowBits > 15) {
|
}
|
||||||
|
|
||||||
|
else if (windowBits > 15) {
|
||||||
wrap = 2; /* write gzip wrapper instead */
|
wrap = 2; /* write gzip wrapper instead */
|
||||||
windowBits -= 16;
|
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);
|
return err(strm, Z_STREAM_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (windowBits === 8) {
|
if (windowBits === 8) {
|
||||||
windowBits = 9;
|
windowBits = 9;
|
||||||
}
|
}
|
||||||
|
@ -1357,7 +1359,7 @@ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
||||||
// Don't need mem init magic for JS.
|
// Don't need mem init magic for JS.
|
||||||
//s.high_water = 0; /* nothing written to s->window yet */
|
//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;
|
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);
|
return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function deflate(strm, flush) {
|
function deflate(strm, flush) {
|
||||||
var old_flush, s;
|
var old_flush, s;
|
||||||
var beg, val; // for gzip header write only
|
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;
|
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = strm.state;
|
s = strm.state;
|
||||||
|
|
||||||
if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH) {
|
if (!strm.output ||
|
||||||
return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR);
|
(!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 */
|
s.strm = strm; /* just in case */
|
||||||
|
@ -1404,43 +1410,52 @@ function deflate(strm, flush) {
|
||||||
/* Write the header */
|
/* Write the header */
|
||||||
if (s.status === INIT_STATE) {
|
if (s.status === INIT_STATE) {
|
||||||
|
|
||||||
if (s.wrap === 2) {
|
if (s.wrap === 2) { // GZIP header
|
||||||
// GZIP header
|
|
||||||
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
||||||
put_byte(s, 31);
|
put_byte(s, 31);
|
||||||
put_byte(s, 139);
|
put_byte(s, 139);
|
||||||
put_byte(s, 8);
|
put_byte(s, 8);
|
||||||
if (!s.gzhead) {
|
if (!s.gzhead) { // s->gzhead == Z_NULL
|
||||||
// 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, 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);
|
put_byte(s, OS_CODE);
|
||||||
s.status = BUSY_STATE;
|
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 & 0xff);
|
||||||
put_byte(s, s.gzhead.time >> 8 & 0xff);
|
put_byte(s, (s.gzhead.time >> 8) & 0xff);
|
||||||
put_byte(s, s.gzhead.time >> 16 & 0xff);
|
put_byte(s, (s.gzhead.time >> 16) & 0xff);
|
||||||
put_byte(s, s.gzhead.time >> 24 & 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.level === 9 ? 2 :
|
||||||
|
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
||||||
|
4 : 0));
|
||||||
put_byte(s, s.gzhead.os & 0xff);
|
put_byte(s, s.gzhead.os & 0xff);
|
||||||
if (s.gzhead.extra && s.gzhead.extra.length) {
|
if (s.gzhead.extra && s.gzhead.extra.length) {
|
||||||
put_byte(s, s.gzhead.extra.length & 0xff);
|
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) {
|
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.gzindex = 0;
|
||||||
s.status = EXTRA_STATE;
|
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;
|
var level_flags = -1;
|
||||||
|
|
||||||
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
||||||
|
@ -1452,11 +1467,9 @@ function deflate(strm, flush) {
|
||||||
} else {
|
} else {
|
||||||
level_flags = 3;
|
level_flags = 3;
|
||||||
}
|
}
|
||||||
header |= level_flags << 6;
|
header |= (level_flags << 6);
|
||||||
if (s.strstart !== 0) {
|
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
||||||
header |= PRESET_DICT;
|
header += 31 - (header % 31);
|
||||||
}
|
|
||||||
header += 31 - header % 31;
|
|
||||||
|
|
||||||
s.status = BUSY_STATE;
|
s.status = BUSY_STATE;
|
||||||
putShortMSB(s, header);
|
putShortMSB(s, header);
|
||||||
|
@ -1478,7 +1491,7 @@ function deflate(strm, flush) {
|
||||||
while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
|
while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
|
||||||
if (s.pending === s.pending_buf_size) {
|
if (s.pending === s.pending_buf_size) {
|
||||||
if (s.gzhead.hcrc && s.pending > beg) {
|
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);
|
flush_pending(strm);
|
||||||
beg = s.pending;
|
beg = s.pending;
|
||||||
|
@ -1490,13 +1503,14 @@ function deflate(strm, flush) {
|
||||||
s.gzindex++;
|
s.gzindex++;
|
||||||
}
|
}
|
||||||
if (s.gzhead.hcrc && s.pending > beg) {
|
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) {
|
if (s.gzindex === s.gzhead.extra.length) {
|
||||||
s.gzindex = 0;
|
s.gzindex = 0;
|
||||||
s.status = NAME_STATE;
|
s.status = NAME_STATE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
s.status = NAME_STATE;
|
s.status = NAME_STATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1508,7 +1522,7 @@ function deflate(strm, flush) {
|
||||||
do {
|
do {
|
||||||
if (s.pending === s.pending_buf_size) {
|
if (s.pending === s.pending_buf_size) {
|
||||||
if (s.gzhead.hcrc && s.pending > beg) {
|
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);
|
flush_pending(strm);
|
||||||
beg = s.pending;
|
beg = s.pending;
|
||||||
|
@ -1527,13 +1541,14 @@ function deflate(strm, flush) {
|
||||||
} while (val !== 0);
|
} while (val !== 0);
|
||||||
|
|
||||||
if (s.gzhead.hcrc && s.pending > beg) {
|
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) {
|
if (val === 0) {
|
||||||
s.gzindex = 0;
|
s.gzindex = 0;
|
||||||
s.status = COMMENT_STATE;
|
s.status = COMMENT_STATE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
s.status = COMMENT_STATE;
|
s.status = COMMENT_STATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1545,7 +1560,7 @@ function deflate(strm, flush) {
|
||||||
do {
|
do {
|
||||||
if (s.pending === s.pending_buf_size) {
|
if (s.pending === s.pending_buf_size) {
|
||||||
if (s.gzhead.hcrc && s.pending > beg) {
|
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);
|
flush_pending(strm);
|
||||||
beg = s.pending;
|
beg = s.pending;
|
||||||
|
@ -1564,12 +1579,13 @@ function deflate(strm, flush) {
|
||||||
} while (val !== 0);
|
} while (val !== 0);
|
||||||
|
|
||||||
if (s.gzhead.hcrc && s.pending > beg) {
|
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) {
|
if (val === 0) {
|
||||||
s.status = HCRC_STATE;
|
s.status = HCRC_STATE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
s.status = HCRC_STATE;
|
s.status = HCRC_STATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1580,11 +1596,12 @@ function deflate(strm, flush) {
|
||||||
}
|
}
|
||||||
if (s.pending + 2 <= s.pending_buf_size) {
|
if (s.pending + 2 <= s.pending_buf_size) {
|
||||||
put_byte(s, strm.adler & 0xff);
|
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);
|
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
||||||
s.status = BUSY_STATE;
|
s.status = BUSY_STATE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
s.status = BUSY_STATE;
|
s.status = BUSY_STATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1608,7 +1625,8 @@ function deflate(strm, flush) {
|
||||||
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
||||||
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
* 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);
|
return err(strm, Z_BUF_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1619,8 +1637,11 @@ function deflate(strm, flush) {
|
||||||
|
|
||||||
/* Start a new block or continue the current one.
|
/* 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) {
|
if (strm.avail_in !== 0 || s.lookahead !== 0 ||
|
||||||
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);
|
(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) {
|
if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
|
||||||
s.status = FINISH_STATE;
|
s.status = FINISH_STATE;
|
||||||
|
@ -1642,8 +1663,8 @@ function deflate(strm, flush) {
|
||||||
if (bstate === BS_BLOCK_DONE) {
|
if (bstate === BS_BLOCK_DONE) {
|
||||||
if (flush === Z_PARTIAL_FLUSH) {
|
if (flush === Z_PARTIAL_FLUSH) {
|
||||||
trees._tr_align(s);
|
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);
|
trees._tr_stored_block(s, 0, 0, false);
|
||||||
/* For a full flush, this empty block will be recognized
|
/* For a full flush, this empty block will be recognized
|
||||||
|
@ -1670,24 +1691,22 @@ function deflate(strm, flush) {
|
||||||
//Assert(strm->avail_out > 0, "bug2");
|
//Assert(strm->avail_out > 0, "bug2");
|
||||||
//if (strm.avail_out <= 0) { throw new Error("bug2");}
|
//if (strm.avail_out <= 0) { throw new Error("bug2");}
|
||||||
|
|
||||||
if (flush !== Z_FINISH) {
|
if (flush !== Z_FINISH) { return Z_OK; }
|
||||||
return Z_OK;
|
if (s.wrap <= 0) { return Z_STREAM_END; }
|
||||||
}
|
|
||||||
if (s.wrap <= 0) {
|
|
||||||
return Z_STREAM_END;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write the trailer */
|
/* Write the trailer */
|
||||||
if (s.wrap === 2) {
|
if (s.wrap === 2) {
|
||||||
put_byte(s, strm.adler & 0xff);
|
put_byte(s, strm.adler & 0xff);
|
||||||
put_byte(s, strm.adler >> 8 & 0xff);
|
put_byte(s, (strm.adler >> 8) & 0xff);
|
||||||
put_byte(s, strm.adler >> 16 & 0xff);
|
put_byte(s, (strm.adler >> 16) & 0xff);
|
||||||
put_byte(s, strm.adler >> 24 & 0xff);
|
put_byte(s, (strm.adler >> 24) & 0xff);
|
||||||
put_byte(s, strm.total_in & 0xff);
|
put_byte(s, strm.total_in & 0xff);
|
||||||
put_byte(s, strm.total_in >> 8 & 0xff);
|
put_byte(s, (strm.total_in >> 8) & 0xff);
|
||||||
put_byte(s, strm.total_in >> 16 & 0xff);
|
put_byte(s, (strm.total_in >> 16) & 0xff);
|
||||||
put_byte(s, strm.total_in >> 24 & 0xff);
|
put_byte(s, (strm.total_in >> 24) & 0xff);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
putShortMSB(s, strm.adler >>> 16);
|
putShortMSB(s, strm.adler >>> 16);
|
||||||
putShortMSB(s, strm.adler & 0xffff);
|
putShortMSB(s, strm.adler & 0xffff);
|
||||||
}
|
}
|
||||||
|
@ -1696,9 +1715,7 @@ function deflate(strm, flush) {
|
||||||
/* If avail_out is zero, the application will call deflate again
|
/* If avail_out is zero, the application will call deflate again
|
||||||
* to flush the rest.
|
* to flush the rest.
|
||||||
*/
|
*/
|
||||||
if (s.wrap > 0) {
|
if (s.wrap > 0) { s.wrap = -s.wrap; }
|
||||||
s.wrap = -s.wrap;
|
|
||||||
}
|
|
||||||
/* write the trailer only once! */
|
/* write the trailer only once! */
|
||||||
return s.pending !== 0 ? Z_OK : Z_STREAM_END;
|
return s.pending !== 0 ? Z_OK : Z_STREAM_END;
|
||||||
}
|
}
|
||||||
|
@ -1711,7 +1728,14 @@ function deflateEnd(strm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
status = strm.state.status;
|
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);
|
return err(strm, Z_STREAM_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1720,6 +1744,7 @@ function deflateEnd(strm) {
|
||||||
return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
|
return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* Initializes the compression dictionary from the given byte
|
* Initializes the compression dictionary from the given byte
|
||||||
* sequence without producing any compressed output.
|
* sequence without producing any compressed output.
|
||||||
|
@ -1742,22 +1767,21 @@ function deflateSetDictionary(strm, dictionary) {
|
||||||
s = strm.state;
|
s = strm.state;
|
||||||
wrap = s.wrap;
|
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;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
|
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
|
||||||
if (wrap === 1) {
|
if (wrap === 1) {
|
||||||
/* adler32(strm->adler, dictionary, dictLength); */
|
/* 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 */
|
s.wrap = 0; /* avoid computing Adler-32 in read_buf */
|
||||||
|
|
||||||
/* if dictionary would fill window, just replace the history */
|
/* if dictionary would fill window, just replace the history */
|
||||||
if (dictLength >= s.w_size) {
|
if (dictLength >= s.w_size) {
|
||||||
if (wrap === 0) {
|
if (wrap === 0) { /* already empty otherwise */
|
||||||
/* already empty otherwise */
|
|
||||||
/*** CLEAR_HASH(s); ***/
|
/*** CLEAR_HASH(s); ***/
|
||||||
zero(s.head); // Fill with NIL (= 0);
|
zero(s.head); // Fill with NIL (= 0);
|
||||||
s.strstart = 0;
|
s.strstart = 0;
|
||||||
|
@ -1784,7 +1808,7 @@ function deflateSetDictionary(strm, dictionary) {
|
||||||
n = s.lookahead - (MIN_MATCH - 1);
|
n = s.lookahead - (MIN_MATCH - 1);
|
||||||
do {
|
do {
|
||||||
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
/* 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.prev[str & s.w_mask] = s.head[s.ins_h];
|
||||||
|
|
||||||
|
@ -1808,15 +1832,9 @@ function deflateSetDictionary(strm, dictionary) {
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.deflateInit = deflateInit;
|
|
||||||
exports.deflateInit2 = deflateInit2;
|
export { deflateInit, deflateInit2, deflateReset, deflateResetKeep, deflateSetHeader, deflate, deflateEnd, deflateSetDictionary };
|
||||||
exports.deflateReset = deflateReset;
|
export var deflateInfo = 'pako deflate (from Nodeca project)';
|
||||||
exports.deflateResetKeep = deflateResetKeep;
|
|
||||||
exports.deflateSetHeader = deflateSetHeader;
|
|
||||||
exports.deflate = deflate;
|
|
||||||
exports.deflateEnd = deflateEnd;
|
|
||||||
exports.deflateSetDictionary = deflateSetDictionary;
|
|
||||||
var deflateInfo = exports.deflateInfo = 'pako deflate (from Nodeca project)';
|
|
||||||
|
|
||||||
/* Not implemented
|
/* Not implemented
|
||||||
exports.deflateBound = deflateBound;
|
exports.deflateBound = deflateBound;
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
'use strict';
|
export default function GZheader() {
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = GZheader;
|
|
||||||
function GZheader() {
|
|
||||||
/* true if compressed data believed to be text */
|
/* true if compressed data believed to be text */
|
||||||
this.text = 0;
|
this.text = 0;
|
||||||
/* modification time */
|
/* 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
|
// See state defs from inflate.js
|
||||||
var BAD = 30; /* got a data error -- remain here until reset */
|
var BAD = 30; /* got a data error -- remain here until reset */
|
||||||
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
|
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
|
requires strm.avail_out >= 258 for each loop to avoid checking for
|
||||||
output space.
|
output space.
|
||||||
*/
|
*/
|
||||||
function inflate_fast(strm, start) {
|
export default function inflate_fast(strm, start) {
|
||||||
var state;
|
var state;
|
||||||
var _in; /* local strm.input */
|
var _in; /* local strm.input */
|
||||||
var last; /* have enough input while in < last */
|
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; /* where to copy match from */
|
||||||
var from_source;
|
var from_source;
|
||||||
|
|
||||||
|
|
||||||
var input, output; // JS specific, because we have no pointers
|
var input, output; // JS specific, because we have no pointers
|
||||||
|
|
||||||
/* copy state to local variables */
|
/* copy state to local variables */
|
||||||
|
@ -98,10 +93,12 @@ function inflate_fast(strm, start) {
|
||||||
lmask = (1 << state.lenbits) - 1;
|
lmask = (1 << state.lenbits) - 1;
|
||||||
dmask = (1 << state.distbits) - 1;
|
dmask = (1 << state.distbits) - 1;
|
||||||
|
|
||||||
|
|
||||||
/* decode literals and length/distances until end-of-block or not enough
|
/* decode literals and length/distances until end-of-block or not enough
|
||||||
input data or output space */
|
input data or output space */
|
||||||
|
|
||||||
top: do {
|
top:
|
||||||
|
do {
|
||||||
if (bits < 15) {
|
if (bits < 15) {
|
||||||
hold += input[_in++] << bits;
|
hold += input[_in++] << bits;
|
||||||
bits += 8;
|
bits += 8;
|
||||||
|
@ -111,20 +108,19 @@ function inflate_fast(strm, start) {
|
||||||
|
|
||||||
here = lcode[hold & lmask];
|
here = lcode[hold & lmask];
|
||||||
|
|
||||||
dolen: for (;;) {
|
dolen:
|
||||||
// Goto emulation
|
for (;;) { // Goto emulation
|
||||||
op = here >>> 24/*here.bits*/;
|
op = here >>> 24/*here.bits*/;
|
||||||
hold >>>= op;
|
hold >>>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
op = here >>> 16 & 0xff /*here.op*/;
|
op = (here >>> 16) & 0xff/*here.op*/;
|
||||||
if (op === 0) {
|
if (op === 0) { /* literal */
|
||||||
/* literal */
|
|
||||||
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||||
// "inflate: literal '%c'\n" :
|
// "inflate: literal '%c'\n" :
|
||||||
// "inflate: literal 0x%02x\n", here.val));
|
// "inflate: literal 0x%02x\n", here.val));
|
||||||
output[_out++] = here & 0xffff/*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*/;
|
len = here & 0xffff/*here.val*/;
|
||||||
op &= 15; /* number of extra bits */
|
op &= 15; /* number of extra bits */
|
||||||
if (op) {
|
if (op) {
|
||||||
|
@ -132,7 +128,7 @@ function inflate_fast(strm, start) {
|
||||||
hold += input[_in++] << bits;
|
hold += input[_in++] << bits;
|
||||||
bits += 8;
|
bits += 8;
|
||||||
}
|
}
|
||||||
len += hold & (1 << op) - 1;
|
len += hold & ((1 << op) - 1);
|
||||||
hold >>>= op;
|
hold >>>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
}
|
}
|
||||||
|
@ -145,15 +141,14 @@ function inflate_fast(strm, start) {
|
||||||
}
|
}
|
||||||
here = dcode[hold & dmask];
|
here = dcode[hold & dmask];
|
||||||
|
|
||||||
dodist: for (;;) {
|
dodist:
|
||||||
// goto emulation
|
for (;;) { // goto emulation
|
||||||
op = here >>> 24/*here.bits*/;
|
op = here >>> 24/*here.bits*/;
|
||||||
hold >>>= op;
|
hold >>>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
op = here >>> 16 & 0xff /*here.op*/;
|
op = (here >>> 16) & 0xff/*here.op*/;
|
||||||
|
|
||||||
if (op & 16) {
|
if (op & 16) { /* distance base */
|
||||||
/* distance base */
|
|
||||||
dist = here & 0xffff/*here.val*/;
|
dist = here & 0xffff/*here.val*/;
|
||||||
op &= 15; /* number of extra bits */
|
op &= 15; /* number of extra bits */
|
||||||
if (bits < op) {
|
if (bits < op) {
|
||||||
|
@ -164,7 +159,7 @@ function inflate_fast(strm, start) {
|
||||||
bits += 8;
|
bits += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dist += hold & (1 << op) - 1;
|
dist += hold & ((1 << op) - 1);
|
||||||
//#ifdef INFLATE_STRICT
|
//#ifdef INFLATE_STRICT
|
||||||
if (dist > dmax) {
|
if (dist > dmax) {
|
||||||
strm.msg = 'invalid distance too far back';
|
strm.msg = 'invalid distance too far back';
|
||||||
|
@ -176,8 +171,7 @@ function inflate_fast(strm, start) {
|
||||||
bits -= op;
|
bits -= op;
|
||||||
//Tracevv((stderr, "inflate: distance %u\n", dist));
|
//Tracevv((stderr, "inflate: distance %u\n", dist));
|
||||||
op = _out - beg; /* max distance in output */
|
op = _out - beg; /* max distance in output */
|
||||||
if (dist > op) {
|
if (dist > op) { /* see if copy from window */
|
||||||
/* see if copy from window */
|
|
||||||
op = dist - op; /* distance back in window */
|
op = dist - op; /* distance back in window */
|
||||||
if (op > whave) {
|
if (op > whave) {
|
||||||
if (state.sane) {
|
if (state.sane) {
|
||||||
|
@ -210,11 +204,9 @@ function inflate_fast(strm, start) {
|
||||||
}
|
}
|
||||||
from = 0; // window index
|
from = 0; // window index
|
||||||
from_source = s_window;
|
from_source = s_window;
|
||||||
if (wnext === 0) {
|
if (wnext === 0) { /* very common case */
|
||||||
/* very common case */
|
|
||||||
from += wsize - op;
|
from += wsize - op;
|
||||||
if (op < len) {
|
if (op < len) { /* some from window */
|
||||||
/* some from window */
|
|
||||||
len -= op;
|
len -= op;
|
||||||
do {
|
do {
|
||||||
output[_out++] = s_window[from++];
|
output[_out++] = s_window[from++];
|
||||||
|
@ -222,19 +214,17 @@ function inflate_fast(strm, start) {
|
||||||
from = _out - dist; /* rest from output */
|
from = _out - dist; /* rest from output */
|
||||||
from_source = output;
|
from_source = output;
|
||||||
}
|
}
|
||||||
} else if (wnext < op) {
|
}
|
||||||
/* wrap around window */
|
else if (wnext < op) { /* wrap around window */
|
||||||
from += wsize + wnext - op;
|
from += wsize + wnext - op;
|
||||||
op -= wnext;
|
op -= wnext;
|
||||||
if (op < len) {
|
if (op < len) { /* some from end of window */
|
||||||
/* some from end of window */
|
|
||||||
len -= op;
|
len -= op;
|
||||||
do {
|
do {
|
||||||
output[_out++] = s_window[from++];
|
output[_out++] = s_window[from++];
|
||||||
} while (--op);
|
} while (--op);
|
||||||
from = 0;
|
from = 0;
|
||||||
if (wnext < len) {
|
if (wnext < len) { /* some from start of window */
|
||||||
/* some from start of window */
|
|
||||||
op = wnext;
|
op = wnext;
|
||||||
len -= op;
|
len -= op;
|
||||||
do {
|
do {
|
||||||
|
@ -244,11 +234,10 @@ function inflate_fast(strm, start) {
|
||||||
from_source = output;
|
from_source = output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
/* contiguous in window */
|
else { /* contiguous in window */
|
||||||
from += wnext - op;
|
from += wnext - op;
|
||||||
if (op < len) {
|
if (op < len) { /* some from window */
|
||||||
/* some from window */
|
|
||||||
len -= op;
|
len -= op;
|
||||||
do {
|
do {
|
||||||
output[_out++] = s_window[from++];
|
output[_out++] = s_window[from++];
|
||||||
|
@ -269,10 +258,10 @@ function inflate_fast(strm, start) {
|
||||||
output[_out++] = from_source[from++];
|
output[_out++] = from_source[from++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
from = _out - dist; /* copy direct from output */
|
from = _out - dist; /* copy direct from output */
|
||||||
do {
|
do { /* minimum length is three */
|
||||||
/* minimum length is three */
|
|
||||||
output[_out++] = output[from++];
|
output[_out++] = output[from++];
|
||||||
output[_out++] = output[from++];
|
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 */
|
else if ((op & 64) === 0) { /* 2nd level distance code */
|
||||||
here = dcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)];
|
here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||||
continue dodist;
|
continue dodist;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
strm.msg = 'invalid distance code';
|
strm.msg = 'invalid distance code';
|
||||||
state.mode = BAD;
|
state.mode = BAD;
|
||||||
break top;
|
break top;
|
||||||
|
@ -297,16 +287,17 @@ function inflate_fast(strm, start) {
|
||||||
|
|
||||||
break; // need to emulate goto via "continue"
|
break; // need to emulate goto via "continue"
|
||||||
}
|
}
|
||||||
} else if ((op & 64) === 0) {
|
}
|
||||||
/* 2nd level length code */
|
else if ((op & 64) === 0) { /* 2nd level length code */
|
||||||
here = lcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)];
|
here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||||
continue dolen;
|
continue dolen;
|
||||||
} else if (op & 32) {
|
}
|
||||||
/* end-of-block */
|
else if (op & 32) { /* end-of-block */
|
||||||
//Tracevv((stderr, "inflate: end of block\n"));
|
//Tracevv((stderr, "inflate: end of block\n"));
|
||||||
state.mode = TYPE;
|
state.mode = TYPE;
|
||||||
break top;
|
break top;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
strm.msg = 'invalid literal/length code';
|
strm.msg = 'invalid literal/length code';
|
||||||
state.mode = BAD;
|
state.mode = BAD;
|
||||||
break top;
|
break top;
|
||||||
|
@ -325,8 +316,8 @@ function inflate_fast(strm, start) {
|
||||||
/* update state and return */
|
/* update state and return */
|
||||||
strm.next_in = _in;
|
strm.next_in = _in;
|
||||||
strm.next_out = _out;
|
strm.next_out = _out;
|
||||||
strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
|
strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
|
||||||
strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
|
strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
|
||||||
state.hold = hold;
|
state.hold = hold;
|
||||||
state.bits = bits;
|
state.bits = bits;
|
||||||
return;
|
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";
|
import * as utils from "../utils/common.js";
|
||||||
|
|
||||||
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; } }
|
|
||||||
|
|
||||||
var MAXBITS = 15;
|
var MAXBITS = 15;
|
||||||
var ENOUGH_LENS = 852;
|
var ENOUGH_LENS = 852;
|
||||||
|
@ -21,25 +10,35 @@ var LENS = 1;
|
||||||
var DISTS = 2;
|
var DISTS = 2;
|
||||||
|
|
||||||
var lbase = [ /* Length codes 257..285 base */
|
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 */
|
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 */
|
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 */
|
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;
|
var bits = opts.bits;
|
||||||
//here = opts.here; /* table entry for duplication */
|
//here = opts.here; /* table entry for duplication */
|
||||||
|
|
||||||
var len = 0; /* a code's length in bits */
|
var len = 0; /* a code's length in bits */
|
||||||
var sym = 0; /* index of code symbols */
|
var sym = 0; /* index of code symbols */
|
||||||
var min = 0,
|
var min = 0, max = 0; /* minimum and maximum code lengths */
|
||||||
max = 0; /* minimum and maximum code lengths */
|
|
||||||
var root = 0; /* number of index bits for root table */
|
var root = 0; /* number of index bits for root table */
|
||||||
var curr = 0; /* number of index bits for current table */
|
var curr = 0; /* number of index bits for current table */
|
||||||
var drop = 0; /* code bits to drop for sub-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
|
from their more natural integer increment ordering, and so when the
|
||||||
decoding tables are built in the large loop below, the integer codes
|
decoding tables are built in the large loop below, the integer codes
|
||||||
are incremented backwards.
|
are incremented backwards.
|
||||||
|
|
||||||
This routine assumes, but does not check, that all of the entries in
|
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.
|
lens[] are in the range 0..MAXBITS. The caller must assure this.
|
||||||
1..MAXBITS is interpreted as that code length. zero means that that
|
1..MAXBITS is interpreted as that code length. zero means that that
|
||||||
symbol does not occur in this code.
|
symbol does not occur in this code.
|
||||||
|
|
||||||
The codes are sorted by computing a count of codes for each length,
|
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
|
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
|
sorted table, and then entering the symbols in order in the sorted
|
||||||
table. The sorted table is work[], with that space being provided by
|
table. The sorted table is work[], with that space being provided by
|
||||||
the caller.
|
the caller.
|
||||||
|
|
||||||
The length counts are used for other purposes as well, i.e. finding
|
The length counts are used for other purposes as well, i.e. finding
|
||||||
the minimum and maximum length codes, determining if there are any
|
the minimum and maximum length codes, determining if there are any
|
||||||
codes at all, checking for a valid set of lengths, and looking ahead
|
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 */
|
/* bound code lengths, force root to be within code lengths */
|
||||||
root = bits;
|
root = bits;
|
||||||
for (max = MAXBITS; max >= 1; max--) {
|
for (max = MAXBITS; max >= 1; max--) {
|
||||||
if (count[max] !== 0) {
|
if (count[max] !== 0) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (root > max) {
|
if (root > max) {
|
||||||
root = max;
|
root = max;
|
||||||
}
|
}
|
||||||
if (max === 0) {
|
if (max === 0) { /* no symbols to code at all */
|
||||||
/* no symbols to code at all */
|
|
||||||
//table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
|
//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.bits[opts.table_index] = 1; //here.bits = (var char)1;
|
||||||
//table.val[opts.table_index++] = 0; //here.val = (var short)0;
|
//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.op[opts.table_index] = 64;
|
||||||
//table.bits[opts.table_index] = 1;
|
//table.bits[opts.table_index] = 1;
|
||||||
//table.val[opts.table_index++] = 0;
|
//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;
|
opts.bits = 1;
|
||||||
return 0; /* no symbols, but wait for decoding to report error */
|
return 0; /* no symbols, but wait for decoding to report error */
|
||||||
}
|
}
|
||||||
for (min = 1; min < max; min++) {
|
for (min = 1; min < max; min++) {
|
||||||
if (count[min] !== 0) {
|
if (count[min] !== 0) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (root < min) {
|
if (root < min) {
|
||||||
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,
|
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
|
those top drop + curr - len bits are incremented through all values to
|
||||||
fill the table with replicated entries.
|
fill the table with replicated entries.
|
||||||
|
|
||||||
root is the number of index bits for the root table. When len exceeds
|
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
|
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
|
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
|
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.
|
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
|
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
|
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
|
counts are used for this, and so count[] is decremented as codes are
|
||||||
entered in the tables.
|
entered in the tables.
|
||||||
|
|
||||||
used keeps track of how many table entries have been allocated from the
|
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
|
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 constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
|
||||||
the initial root table size constants. See the comments in inftrees.h
|
the initial root table size constants. See the comments in inftrees.h
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
sym increments through all symbols, and the loop terminates when
|
sym increments through all symbols, and the loop terminates when
|
||||||
all codes of length max, i.e. all codes, have been processed. This
|
all codes of length max, i.e. all codes, have been processed. This
|
||||||
routine permits incomplete codes, so another loop after this one fills
|
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) {
|
if (type === CODES) {
|
||||||
base = extra = work; /* dummy value--not used */
|
base = extra = work; /* dummy value--not used */
|
||||||
end = 19;
|
end = 19;
|
||||||
|
|
||||||
} else if (type === LENS) {
|
} else if (type === LENS) {
|
||||||
base = lbase;
|
base = lbase;
|
||||||
base_index -= 257;
|
base_index -= 257;
|
||||||
extra = lext;
|
extra = lext;
|
||||||
extra_index -= 257;
|
extra_index -= 257;
|
||||||
end = 256;
|
end = 256;
|
||||||
} else {
|
|
||||||
/* DISTS */
|
} else { /* DISTS */
|
||||||
base = dbase;
|
base = dbase;
|
||||||
extra = dext;
|
extra = dext;
|
||||||
end = -1;
|
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 */
|
mask = used - 1; /* mask for comparing low */
|
||||||
|
|
||||||
/* check available table space */
|
/* 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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,25 +231,27 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
||||||
if (work[sym] < end) {
|
if (work[sym] < end) {
|
||||||
here_op = 0;
|
here_op = 0;
|
||||||
here_val = work[sym];
|
here_val = work[sym];
|
||||||
} else if (work[sym] > end) {
|
}
|
||||||
|
else if (work[sym] > end) {
|
||||||
here_op = extra[extra_index + work[sym]];
|
here_op = extra[extra_index + work[sym]];
|
||||||
here_val = base[base_index + work[sym]];
|
here_val = base[base_index + work[sym]];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
here_op = 32 + 64; /* end of block */
|
here_op = 32 + 64; /* end of block */
|
||||||
here_val = 0;
|
here_val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* replicate for those indices with low len bits equal to huff */
|
/* replicate for those indices with low len bits equal to huff */
|
||||||
incr = 1 << len - drop;
|
incr = 1 << (len - drop);
|
||||||
fill = 1 << curr;
|
fill = 1 << curr;
|
||||||
min = fill; /* save offset to next table */
|
min = fill; /* save offset to next table */
|
||||||
do {
|
do {
|
||||||
fill -= incr;
|
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);
|
} while (fill !== 0);
|
||||||
|
|
||||||
/* backwards increment the len-bit code huff */
|
/* backwards increment the len-bit code huff */
|
||||||
incr = 1 << len - 1;
|
incr = 1 << (len - 1);
|
||||||
while (huff & incr) {
|
while (huff & incr) {
|
||||||
incr >>= 1;
|
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 */
|
/* go to next symbol, update count, len */
|
||||||
sym++;
|
sym++;
|
||||||
if (--count[len] === 0) {
|
if (--count[len] === 0) {
|
||||||
if (len === max) {
|
if (len === max) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
len = lens[lens_index + work[sym]];
|
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;
|
left = 1 << curr;
|
||||||
while (curr + drop < max) {
|
while (curr + drop < max) {
|
||||||
left -= count[curr + drop];
|
left -= count[curr + drop];
|
||||||
if (left <= 0) {
|
if (left <= 0) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
curr++;
|
curr++;
|
||||||
left <<= 1;
|
left <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for enough space */
|
/* check for enough space */
|
||||||
used += 1 << curr;
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +301,7 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
||||||
/*table.op[low] = curr;
|
/*table.op[low] = curr;
|
||||||
table.bits[low] = root;
|
table.bits[low] = root;
|
||||||
table.val[low] = next - opts.table_index;*/
|
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.op[next + huff] = 64; /* invalid code marker */
|
||||||
//table.bits[next + huff] = len - drop;
|
//table.bits[next + huff] = len - drop;
|
||||||
//table.val[next + huff] = 0;
|
//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 */
|
/* set return parameters */
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
'use strict';
|
export default {
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = {
|
|
||||||
2: 'need dictionary', /* Z_NEED_DICT 2 */
|
2: 'need dictionary', /* Z_NEED_DICT 2 */
|
||||||
1: 'stream end', /* Z_STREAM_END 1 */
|
1: 'stream end', /* Z_STREAM_END 1 */
|
||||||
0: '', /* Z_OK 0 */
|
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";
|
import * as utils from "../utils/common.js";
|
||||||
|
|
||||||
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; } }
|
|
||||||
|
|
||||||
/* Public constants ==========================================================*/
|
/* Public constants ==========================================================*/
|
||||||
/* ===========================================================================*/
|
/* ===========================================================================*/
|
||||||
|
|
||||||
|
|
||||||
//var Z_FILTERED = 1;
|
//var Z_FILTERED = 1;
|
||||||
//var Z_HUFFMAN_ONLY = 2;
|
//var Z_HUFFMAN_ONLY = 2;
|
||||||
//var Z_RLE = 3;
|
//var Z_RLE = 3;
|
||||||
|
@ -28,11 +18,8 @@ var Z_UNKNOWN = 2;
|
||||||
|
|
||||||
/*============================================================================*/
|
/*============================================================================*/
|
||||||
|
|
||||||
function zero(buf) {
|
|
||||||
var len = buf.length;while (--len >= 0) {
|
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
||||||
buf[len] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// From zutil.h
|
// From zutil.h
|
||||||
|
|
||||||
|
@ -74,6 +61,7 @@ var MAX_BITS = 15;
|
||||||
var Buf_size = 16;
|
var Buf_size = 16;
|
||||||
/* size of bit buffer in bi_buf */
|
/* size of bit buffer in bi_buf */
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
|
@ -103,7 +91,8 @@ var extra_dbits = /* extra bits for each distance code */
|
||||||
var extra_blbits = /* extra bits for each bit length 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];
|
[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 */
|
/* eslint-enable comma-spacing,array-bracket-spacing */
|
||||||
|
|
||||||
/* The lengths of the bit length codes are sent in order of decreasing
|
/* 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);
|
zero(base_dist);
|
||||||
/* First normalized distance for each code (0 = distance of 1) */
|
/* First normalized distance for each code (0 = distance of 1) */
|
||||||
|
|
||||||
|
|
||||||
function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
|
function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
|
||||||
|
|
||||||
this.static_tree = static_tree; /* static tree or NULL */
|
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;
|
this.has_stree = static_tree && static_tree.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var static_l_desc;
|
var static_l_desc;
|
||||||
var static_d_desc;
|
var static_d_desc;
|
||||||
var static_bl_desc;
|
var static_bl_desc;
|
||||||
|
|
||||||
|
|
||||||
function TreeDesc(dyn_tree, stat_desc) {
|
function TreeDesc(dyn_tree, stat_desc) {
|
||||||
this.dyn_tree = dyn_tree; /* the dynamic tree */
|
this.dyn_tree = dyn_tree; /* the dynamic tree */
|
||||||
this.max_code = 0; /* largest code with non zero frequency */
|
this.max_code = 0; /* largest code with non zero frequency */
|
||||||
this.stat_desc = stat_desc; /* the corresponding static tree */
|
this.stat_desc = stat_desc; /* the corresponding static tree */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function d_code(dist) {
|
function d_code(dist) {
|
||||||
return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
|
return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Output a short LSB first on the stream.
|
* Output a short LSB first on the stream.
|
||||||
* IN assertion: there is enough room in pendingBuf.
|
* IN assertion: there is enough room in pendingBuf.
|
||||||
|
@ -185,30 +180,33 @@ function d_code(dist) {
|
||||||
function put_short(s, w) {
|
function put_short(s, w) {
|
||||||
// put_byte(s, (uch)((w) & 0xff));
|
// put_byte(s, (uch)((w) & 0xff));
|
||||||
// put_byte(s, (uch)((ush)(w) >> 8));
|
// put_byte(s, (uch)((ush)(w) >> 8));
|
||||||
s.pending_buf[s.pending++] = w & 0xff;
|
s.pending_buf[s.pending++] = (w) & 0xff;
|
||||||
s.pending_buf[s.pending++] = w >>> 8 & 0xff;
|
s.pending_buf[s.pending++] = (w >>> 8) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send a value on a given number of bits.
|
* Send a value on a given number of bits.
|
||||||
* IN assertion: length <= 16 and value fits in length bits.
|
* IN assertion: length <= 16 and value fits in length bits.
|
||||||
*/
|
*/
|
||||||
function send_bits(s, value, length) {
|
function send_bits(s, value, length) {
|
||||||
if (s.bi_valid > Buf_size - length) {
|
if (s.bi_valid > (Buf_size - length)) {
|
||||||
s.bi_buf |= value << s.bi_valid & 0xffff;
|
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
||||||
put_short(s, s.bi_buf);
|
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;
|
s.bi_valid += length - Buf_size;
|
||||||
} else {
|
} else {
|
||||||
s.bi_buf |= value << s.bi_valid & 0xffff;
|
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
||||||
s.bi_valid += length;
|
s.bi_valid += length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function send_code(s, c, tree) {
|
function send_code(s, c, tree) {
|
||||||
send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);
|
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
|
* Reverse the first len bits of a code, using straightforward code (a faster
|
||||||
* method would use a table)
|
* method would use a table)
|
||||||
|
@ -224,6 +222,7 @@ function bi_reverse(code, len) {
|
||||||
return res >>> 1;
|
return res >>> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Flush the bit buffer, keeping at most 7 bits in it.
|
* 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);
|
put_short(s, s.bi_buf);
|
||||||
s.bi_buf = 0;
|
s.bi_buf = 0;
|
||||||
s.bi_valid = 0;
|
s.bi_valid = 0;
|
||||||
|
|
||||||
} else if (s.bi_valid >= 8) {
|
} else if (s.bi_valid >= 8) {
|
||||||
s.pending_buf[s.pending++] = s.bi_buf & 0xff;
|
s.pending_buf[s.pending++] = s.bi_buf & 0xff;
|
||||||
s.bi_buf >>= 8;
|
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
|
* Compute the optimal bit lengths for a tree and update the total bit length
|
||||||
* for the current block.
|
* for the current block.
|
||||||
|
@ -286,9 +287,7 @@ function gen_bitlen(s, desc)
|
||||||
tree[n * 2 + 1]/*.Len*/ = bits;
|
tree[n * 2 + 1]/*.Len*/ = bits;
|
||||||
/* We overwrite tree[n].Dad which is no longer needed */
|
/* We overwrite tree[n].Dad which is no longer needed */
|
||||||
|
|
||||||
if (n > max_code) {
|
if (n > max_code) { continue; } /* not a leaf node */
|
||||||
continue;
|
|
||||||
} /* not a leaf node */
|
|
||||||
|
|
||||||
s.bl_count[bits]++;
|
s.bl_count[bits]++;
|
||||||
xbits = 0;
|
xbits = 0;
|
||||||
|
@ -301,9 +300,7 @@ function gen_bitlen(s, desc)
|
||||||
s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);
|
s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (overflow === 0) {
|
if (overflow === 0) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trace((stderr,"\nbit length overflow\n"));
|
// Trace((stderr,"\nbit length overflow\n"));
|
||||||
/* This happens for example on obj2 and pic of the Calgary corpus */
|
/* 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: */
|
/* Find the first bit length which could increase: */
|
||||||
do {
|
do {
|
||||||
bits = max_length - 1;
|
bits = max_length - 1;
|
||||||
while (s.bl_count[bits] === 0) {
|
while (s.bl_count[bits] === 0) { bits--; }
|
||||||
bits--;
|
|
||||||
}
|
|
||||||
s.bl_count[bits]--; /* move one leaf down the tree */
|
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[bits + 1] += 2; /* move one overflow item as its brother */
|
||||||
s.bl_count[max_length]--;
|
s.bl_count[max_length]--;
|
||||||
|
@ -332,9 +327,7 @@ function gen_bitlen(s, desc)
|
||||||
n = s.bl_count[bits];
|
n = s.bl_count[bits];
|
||||||
while (n !== 0) {
|
while (n !== 0) {
|
||||||
m = s.heap[--h];
|
m = s.heap[--h];
|
||||||
if (m > max_code) {
|
if (m > max_code) { continue; }
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (tree[m * 2 + 1]/*.Len*/ !== bits) {
|
if (tree[m * 2 + 1]/*.Len*/ !== bits) {
|
||||||
// Trace((stderr,"code %d bits %d->%d\n", m, tree[m].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*/;
|
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
|
* Generate the codes for a given tree and bit counts (which need not be
|
||||||
* optimal).
|
* optimal).
|
||||||
|
@ -367,7 +361,7 @@ function gen_codes(tree, max_code, bl_count)
|
||||||
* without bit reversal.
|
* without bit reversal.
|
||||||
*/
|
*/
|
||||||
for (bits = 1; bits <= MAX_BITS; bits++) {
|
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
|
/* Check that the bit counts in bl_count are consistent. The last code
|
||||||
* must be all ones.
|
* must be all ones.
|
||||||
|
@ -378,9 +372,7 @@ function gen_codes(tree, max_code, bl_count)
|
||||||
|
|
||||||
for (n = 0; n <= max_code; n++) {
|
for (n = 0; n <= max_code; n++) {
|
||||||
var len = tree[n * 2 + 1]/*.Len*/;
|
var len = tree[n * 2 + 1]/*.Len*/;
|
||||||
if (len === 0) {
|
if (len === 0) { continue; }
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Now reverse the bits */
|
/* Now reverse the bits */
|
||||||
tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);
|
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.
|
* Initialize the various 'constant' tables.
|
||||||
*/
|
*/
|
||||||
|
@ -417,7 +410,7 @@ function tr_static_init() {
|
||||||
length = 0;
|
length = 0;
|
||||||
for (code = 0; code < LENGTH_CODES - 1; code++) {
|
for (code = 0; code < LENGTH_CODES - 1; code++) {
|
||||||
base_length[code] = length;
|
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;
|
_length_code[length++] = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,7 +425,7 @@ function tr_static_init() {
|
||||||
dist = 0;
|
dist = 0;
|
||||||
for (code = 0; code < 16; code++) {
|
for (code = 0; code < 16; code++) {
|
||||||
base_dist[code] = dist;
|
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;
|
_dist_code[dist++] = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -440,7 +433,7 @@ function tr_static_init() {
|
||||||
dist >>= 7; /* from now on, all distances are divided by 128 */
|
dist >>= 7; /* from now on, all distances are divided by 128 */
|
||||||
for (; code < D_CODES; code++) {
|
for (; code < D_CODES; code++) {
|
||||||
base_dist[code] = dist << 7;
|
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;
|
_dist_code[256 + dist++] = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,6 +485,7 @@ function tr_static_init() {
|
||||||
//static_init_done = true;
|
//static_init_done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Initialize a new block.
|
* Initialize a new block.
|
||||||
*/
|
*/
|
||||||
|
@ -499,25 +493,21 @@ function init_block(s) {
|
||||||
var n; /* iterates over tree elements */
|
var n; /* iterates over tree elements */
|
||||||
|
|
||||||
/* Initialize the trees. */
|
/* Initialize the trees. */
|
||||||
for (n = 0; n < L_CODES; n++) {
|
for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }
|
||||||
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 < 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.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;
|
||||||
s.opt_len = s.static_len = 0;
|
s.opt_len = s.static_len = 0;
|
||||||
s.last_lit = s.matches = 0;
|
s.last_lit = s.matches = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Flush the bit buffer and align the output on a byte boundary
|
* 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) {
|
if (s.bi_valid > 8) {
|
||||||
put_short(s, s.bi_buf);
|
put_short(s, s.bi_buf);
|
||||||
} else if (s.bi_valid > 0) {
|
} else if (s.bi_valid > 0) {
|
||||||
|
@ -558,7 +548,8 @@ function copy_block(s, buf, len, header)
|
||||||
function smaller(tree, n, m, depth) {
|
function smaller(tree, n, m, depth) {
|
||||||
var _n2 = n * 2;
|
var _n2 = n * 2;
|
||||||
var _m2 = m * 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 */
|
var j = k << 1; /* left son of k */
|
||||||
while (j <= s.heap_len) {
|
while (j <= s.heap_len) {
|
||||||
/* Set j to the smallest of the two sons: */
|
/* 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++;
|
j++;
|
||||||
}
|
}
|
||||||
/* Exit if v is smaller than both sons */
|
/* Exit if v is smaller than both sons */
|
||||||
if (smaller(tree, v, s.heap[j], s.depth)) {
|
if (smaller(tree, v, s.heap[j], s.depth)) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Exchange v with the smallest son */
|
/* Exchange v with the smallest son */
|
||||||
s.heap[k] = s.heap[j];
|
s.heap[k] = s.heap[j];
|
||||||
|
@ -594,6 +584,7 @@ function pqdownheap(s, tree, k)
|
||||||
s.heap[k] = v;
|
s.heap[k] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// inlined manually
|
// inlined manually
|
||||||
// var SMALLEST = 1;
|
// var SMALLEST = 1;
|
||||||
|
|
||||||
|
@ -613,7 +604,7 @@ function compress_block(s, ltree, dtree)
|
||||||
|
|
||||||
if (s.last_lit !== 0) {
|
if (s.last_lit !== 0) {
|
||||||
do {
|
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];
|
lc = s.pending_buf[s.l_buf + lx];
|
||||||
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: */
|
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
||||||
//Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
//Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
||||||
// "pendingBuf overflow");
|
// "pendingBuf overflow");
|
||||||
|
|
||||||
} while (lx < s.last_lit);
|
} while (lx < s.last_lit);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_code(s, END_BLOCK, ltree);
|
send_code(s, END_BLOCK, ltree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
||||||
* Update the total bit length for the current block.
|
* Update the total bit length for the current block.
|
||||||
|
@ -681,6 +674,7 @@ function build_tree(s, desc)
|
||||||
if (tree[n * 2]/*.Freq*/ !== 0) {
|
if (tree[n * 2]/*.Freq*/ !== 0) {
|
||||||
s.heap[++s.heap_len] = max_code = n;
|
s.heap[++s.heap_len] = max_code = n;
|
||||||
s.depth[n] = 0;
|
s.depth[n] = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tree[n * 2 + 1]/*.Len*/ = 0;
|
tree[n * 2 + 1]/*.Len*/ = 0;
|
||||||
}
|
}
|
||||||
|
@ -692,7 +686,7 @@ function build_tree(s, desc)
|
||||||
* two codes of non zero frequency.
|
* two codes of non zero frequency.
|
||||||
*/
|
*/
|
||||||
while (s.heap_len < 2) {
|
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;
|
tree[node * 2]/*.Freq*/ = 1;
|
||||||
s.depth[node] = 0;
|
s.depth[node] = 0;
|
||||||
s.opt_len--;
|
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,
|
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
|
||||||
* establish sub-heaps of increasing lengths:
|
* establish sub-heaps of increasing lengths:
|
||||||
*/
|
*/
|
||||||
for (n = s.heap_len >> 1 /*int /2*/; n >= 1; n--) {
|
for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }
|
||||||
pqdownheap(s, tree, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Construct the Huffman tree by repeatedly combining the least two
|
/* Construct the Huffman tree by repeatedly combining the least two
|
||||||
* frequent nodes.
|
* frequent nodes.
|
||||||
|
@ -736,6 +728,7 @@ function build_tree(s, desc)
|
||||||
/* and insert the new node in the heap */
|
/* and insert the new node in the heap */
|
||||||
s.heap[1/*SMALLEST*/] = node++;
|
s.heap[1/*SMALLEST*/] = node++;
|
||||||
pqdownheap(s, tree, 1/*SMALLEST*/);
|
pqdownheap(s, tree, 1/*SMALLEST*/);
|
||||||
|
|
||||||
} while (s.heap_len >= 2);
|
} while (s.heap_len >= 2);
|
||||||
|
|
||||||
s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];
|
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);
|
gen_codes(tree, max_code, s.bl_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Scan a literal or distance tree to determine the frequencies of the codes
|
* Scan a literal or distance tree to determine the frequencies of the codes
|
||||||
* in the bit length tree.
|
* in the bit length tree.
|
||||||
|
@ -780,16 +774,18 @@ function scan_tree(s, tree, max_code)
|
||||||
|
|
||||||
if (++count < max_count && curlen === nextlen) {
|
if (++count < max_count && curlen === nextlen) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (count < min_count) {
|
} else if (count < min_count) {
|
||||||
s.bl_tree[curlen * 2]/*.Freq*/ += count;
|
s.bl_tree[curlen * 2]/*.Freq*/ += count;
|
||||||
|
|
||||||
} else if (curlen !== 0) {
|
} else if (curlen !== 0) {
|
||||||
|
|
||||||
if (curlen !== prevlen) {
|
if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }
|
||||||
s.bl_tree[curlen * 2] /*.Freq*/++;
|
|
||||||
}
|
|
||||||
s.bl_tree[REP_3_6 * 2]/*.Freq*/++;
|
s.bl_tree[REP_3_6 * 2]/*.Freq*/++;
|
||||||
|
|
||||||
} else if (count <= 10) {
|
} else if (count <= 10) {
|
||||||
s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;
|
s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;
|
s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;
|
||||||
}
|
}
|
||||||
|
@ -800,9 +796,11 @@ function scan_tree(s, tree, max_code)
|
||||||
if (nextlen === 0) {
|
if (nextlen === 0) {
|
||||||
max_count = 138;
|
max_count = 138;
|
||||||
min_count = 3;
|
min_count = 3;
|
||||||
|
|
||||||
} else if (curlen === nextlen) {
|
} else if (curlen === nextlen) {
|
||||||
max_count = 6;
|
max_count = 6;
|
||||||
min_count = 3;
|
min_count = 3;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
max_count = 7;
|
max_count = 7;
|
||||||
min_count = 4;
|
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
|
* Send a literal or distance tree in compressed form, using the codes in
|
||||||
* bl_tree.
|
* bl_tree.
|
||||||
|
@ -841,10 +840,10 @@ function send_tree(s, tree, max_code)
|
||||||
|
|
||||||
if (++count < max_count && curlen === nextlen) {
|
if (++count < max_count && curlen === nextlen) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (count < min_count) {
|
} else if (count < min_count) {
|
||||||
do {
|
do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);
|
||||||
send_code(s, curlen, s.bl_tree);
|
|
||||||
} while (--count !== 0);
|
|
||||||
} else if (curlen !== 0) {
|
} else if (curlen !== 0) {
|
||||||
if (curlen !== prevlen) {
|
if (curlen !== prevlen) {
|
||||||
send_code(s, curlen, s.bl_tree);
|
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?");
|
//Assert(count >= 3 && count <= 6, " 3_6?");
|
||||||
send_code(s, REP_3_6, s.bl_tree);
|
send_code(s, REP_3_6, s.bl_tree);
|
||||||
send_bits(s, count - 3, 2);
|
send_bits(s, count - 3, 2);
|
||||||
|
|
||||||
} else if (count <= 10) {
|
} else if (count <= 10) {
|
||||||
send_code(s, REPZ_3_10, s.bl_tree);
|
send_code(s, REPZ_3_10, s.bl_tree);
|
||||||
send_bits(s, count - 3, 3);
|
send_bits(s, count - 3, 3);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
send_code(s, REPZ_11_138, s.bl_tree);
|
send_code(s, REPZ_11_138, s.bl_tree);
|
||||||
send_bits(s, count - 11, 7);
|
send_bits(s, count - 11, 7);
|
||||||
|
@ -866,9 +867,11 @@ function send_tree(s, tree, max_code)
|
||||||
if (nextlen === 0) {
|
if (nextlen === 0) {
|
||||||
max_count = 138;
|
max_count = 138;
|
||||||
min_count = 3;
|
min_count = 3;
|
||||||
|
|
||||||
} else if (curlen === nextlen) {
|
} else if (curlen === nextlen) {
|
||||||
max_count = 6;
|
max_count = 6;
|
||||||
min_count = 3;
|
min_count = 3;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
max_count = 7;
|
max_count = 7;
|
||||||
min_count = 4;
|
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
|
* Construct the Huffman tree for the bit lengths and return the index in
|
||||||
* bl_order of the last bit length code to send.
|
* bl_order of the last bit length code to send.
|
||||||
|
@ -910,6 +914,7 @@ function build_bl_tree(s) {
|
||||||
return max_blindex;
|
return max_blindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send the header for a block using dynamic Huffman trees: the counts, the
|
* 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.
|
* 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));
|
//Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
||||||
* - TEXT if the two conditions below are satisfied:
|
* - TEXT if the two conditions below are satisfied:
|
||||||
|
@ -964,13 +970,14 @@ function detect_data_type(s) {
|
||||||
|
|
||||||
/* Check for non-textual ("black-listed") bytes. */
|
/* Check for non-textual ("black-listed") bytes. */
|
||||||
for (n = 0; n <= 31; n++, black_mask >>>= 1) {
|
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;
|
return Z_BINARY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for textual ("white-listed") bytes. */
|
/* 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;
|
return Z_TEXT;
|
||||||
}
|
}
|
||||||
for (n = 32; n < LITERALS; n++) {
|
for (n = 32; n < LITERALS; n++) {
|
||||||
|
@ -985,12 +992,14 @@ function detect_data_type(s) {
|
||||||
return Z_BINARY;
|
return Z_BINARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var static_init_done = false;
|
var static_init_done = false;
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Initialize the tree data structures for a new zlib stream.
|
* Initialize the tree data structures for a new zlib stream.
|
||||||
*/
|
*/
|
||||||
function _tr_init(s) {
|
function _tr_init(s)
|
||||||
|
{
|
||||||
|
|
||||||
if (!static_init_done) {
|
if (!static_init_done) {
|
||||||
tr_static_init();
|
tr_static_init();
|
||||||
|
@ -1008,6 +1017,7 @@ function _tr_init(s) {
|
||||||
init_block(s);
|
init_block(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send a stored block
|
* 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 */
|
copy_block(s, buf, stored_len, true); /* with header */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send one empty static block to give enough lookahead for inflate.
|
* Send one empty static block to give enough lookahead for inflate.
|
||||||
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
||||||
|
@ -1031,6 +1042,7 @@ function _tr_align(s) {
|
||||||
bi_flush(s);
|
bi_flush(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Determine the best encoding for the current block: dynamic trees, static
|
* Determine the best encoding for the current block: dynamic trees, static
|
||||||
* trees or store, and output the encoded block to the zip file.
|
* 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);
|
max_blindex = build_bl_tree(s);
|
||||||
|
|
||||||
/* Determine the best encoding. Compute the block lengths in bytes. */
|
/* Determine the best encoding. Compute the block lengths in bytes. */
|
||||||
opt_lenb = s.opt_len + 3 + 7 >>> 3;
|
opt_lenb = (s.opt_len + 3 + 7) >>> 3;
|
||||||
static_lenb = s.static_len + 3 + 7 >>> 3;
|
static_lenb = (s.static_len + 3 + 7) >>> 3;
|
||||||
|
|
||||||
// Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
// Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
||||||
// opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
// opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||||
// s->last_lit));
|
// s->last_lit));
|
||||||
|
|
||||||
if (static_lenb <= opt_lenb) {
|
if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }
|
||||||
opt_lenb = static_lenb;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Assert(buf != (char*)0, "lost buf");
|
// Assert(buf != (char*)0, "lost buf");
|
||||||
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
|
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 */
|
/* 4: two words for the lengths */
|
||||||
|
|
||||||
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
|
/* 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.
|
* transform a block into a stored block.
|
||||||
*/
|
*/
|
||||||
_tr_stored_block(s, buf, stored_len, last);
|
_tr_stored_block(s, buf, stored_len, last);
|
||||||
|
|
||||||
} else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
|
} else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
|
||||||
|
|
||||||
send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
|
send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
|
||||||
compress_block(s, static_ltree, static_dtree);
|
compress_block(s, static_ltree, static_dtree);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
|
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);
|
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;
|
//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.d_buf + s.last_lit * 2 + 1] = dist & 0xff;
|
||||||
|
|
||||||
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
|
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
|
||||||
|
@ -1172,15 +1185,11 @@ function _tr_tally(s, dist, lc)
|
||||||
// }
|
// }
|
||||||
//#endif
|
//#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
|
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
||||||
* on 16 bit machines and because stored blocks are restricted to
|
* on 16 bit machines and because stored blocks are restricted to
|
||||||
* 64K-1 bytes.
|
* 64K-1 bytes.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
exports._tr_init = _tr_init;
|
export { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align };
|
||||||
exports._tr_stored_block = _tr_stored_block;
|
|
||||||
exports._tr_flush_block = _tr_flush_block;
|
|
||||||
exports._tr_tally = _tr_tally;
|
|
||||||
exports._tr_align = _tr_align;
|
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
'use strict';
|
export default function ZStream() {
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = ZStream;
|
|
||||||
function ZStream() {
|
|
||||||
/* next input byte */
|
/* next input byte */
|
||||||
this.input = null; // JS specific, because we have no pointers
|
this.input = null; // JS specific, because we have no pointers
|
||||||
this.next_in = 0;
|
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)
|
function update_modifier(state, code, sc)
|
||||||
{
|
{
|
||||||
var msg = new SpiceMiniData();
|
var msg = new SpiceMiniData();
|
||||||
|
|
Loading…
Reference in a new issue