mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 07:35:22 +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';
|
||||||
|
|
||||||
|
@ -41,40 +35,45 @@ Localizer.prototype = {
|
||||||
userLanguages = [navigator.language || navigator.userLanguage];
|
userLanguages = [navigator.language || navigator.userLanguage];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < userLanguages.length; i++) {
|
for (var i = 0;i < userLanguages.length;i++) {
|
||||||
var userLang = userLanguages[i];
|
var userLang = userLanguages[i];
|
||||||
userLang = userLang.toLowerCase();
|
userLang = userLang.toLowerCase();
|
||||||
userLang = userLang.replace("_", "-");
|
userLang = userLang.replace("_", "-");
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First pass: perfect match
|
// First pass: perfect match
|
||||||
for (var j = 0; j < supportedLanguages.length; j++) {
|
for (var j = 0;j < supportedLanguages.length;j++) {
|
||||||
var supLang = supportedLanguages[j];
|
var supLang = supportedLanguages[j];
|
||||||
supLang = supLang.toLowerCase();
|
supLang = supLang.toLowerCase();
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second pass: fallback
|
// Second pass: fallback
|
||||||
for (var j = 0; j < supportedLanguages.length; j++) {
|
for (var j = 0;j < supportedLanguages.length;j++) {
|
||||||
supLang = supportedLanguages[j];
|
supLang = supportedLanguages[j];
|
||||||
supLang = supLang.toLowerCase();
|
supLang = supLang.toLowerCase();
|
||||||
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,31 +120,39 @@ 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < elem.childNodes.length; i++) {
|
for (var i = 0;i < elem.childNodes.length;i++) {
|
||||||
var node = elem.childNodes[i];
|
var node = elem.childNodes[i];
|
||||||
if (node.nodeType === node.ELEMENT_NODE) {
|
if (node.nodeType === node.ELEMENT_NODE) {
|
||||||
process(node, enabled);
|
process(node, enabled);
|
||||||
|
@ -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);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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,
|
||||||
totrot = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28],
|
50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31 ],
|
||||||
z = 0x0,
|
totrot = [ 1, 2, 4, 6, 8,10,12,14,15,17,19,21,23,25,27,28],
|
||||||
a,
|
z = 0x0, a,b,c,d,e,f, SP1,SP2,SP3,SP4,SP5,SP6,SP7,SP8,
|
||||||
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,
|
||||||
a = 1 << 20;b = 1 << 31;c = a | b;d = 1 << 5;e = 1 << 15;f = d | e;
|
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,
|
||||||
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|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,
|
||||||
a = 1 << 17;b = 1 << 27;c = a | b;d = 1 << 3;e = 1 << 9;f = d | e;
|
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];
|
||||||
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<<20; b=1<<31; c=a|b; d=1<<5; e=1<<15; f=d|e;
|
||||||
a = 1 << 13;b = 1 << 23;c = a | b;d = 1 << 0;e = 1 << 7;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,
|
||||||
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|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,
|
||||||
a = 1 << 25;b = 1 << 30;c = a | b;d = 1 << 8;e = 1 << 19;f = d | e;
|
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,
|
||||||
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];
|
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 << 22;b = 1 << 29;c = a | b;d = 1 << 4;e = 1 << 14;f = d | e;
|
a=1<<17; b=1<<27; c=a|b; d=1<<3; e=1<<9; 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];
|
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,
|
||||||
a = 1 << 21;b = 1 << 26;c = a | b;d = 1 << 1;e = 1 << 11;f = d | e;
|
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,
|
||||||
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];
|
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,
|
||||||
a = 1 << 18;b = 1 << 28;c = a | b;d = 1 << 6;e = 1 << 12;f = d | e;
|
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];
|
||||||
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];
|
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];
|
||||||
|
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];
|
||||||
|
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];
|
||||||
|
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];
|
||||||
|
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];
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
@ -279,5 +266,6 @@ 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;
|
||||||
|
|
||||||
|
@ -69,7 +53,7 @@ function Display(target) {
|
||||||
this._backbuffer = document.createElement('canvas');
|
this._backbuffer = document.createElement('canvas');
|
||||||
this._drawCtx = this._backbuffer.getContext('2d');
|
this._drawCtx = this._backbuffer.getContext('2d');
|
||||||
|
|
||||||
this._damageBounds = { left: 0, top: 0,
|
this._damageBounds = { left:0, top:0,
|
||||||
right: this._backbuffer.width,
|
right: this._backbuffer.width,
|
||||||
bottom: this._backbuffer.height };
|
bottom: this._backbuffer.height };
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
@ -174,9 +154,11 @@ Display.prototype = {
|
||||||
this.flip();
|
this.flip();
|
||||||
},
|
},
|
||||||
|
|
||||||
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;
|
||||||
|
@ -253,24 +235,24 @@ Display.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Track what parts of the visible canvas that need updating
|
// Track what parts of the visible canvas that need updating
|
||||||
_damage: function (x, y, w, h) {
|
_damage: function(x, y, w, h) {
|
||||||
if (x < this._damageBounds.left) {
|
if (x < this._damageBounds.left) {
|
||||||
this._damageBounds.left = x;
|
this._damageBounds.left = x;
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Update the visible canvas with the contents of the
|
// Update the visible canvas with the contents of the
|
||||||
// rendering canvas
|
// rendering canvas
|
||||||
flip: function (from_queue) {
|
flip: function(from_queue) {
|
||||||
if (this._renderQ.length !== 0 && !from_queue) {
|
if (this._renderQ.length !== 0 && !from_queue) {
|
||||||
this._renderQ_push({
|
this._renderQ_push({
|
||||||
'type': 'flip'
|
'type': 'flip'
|
||||||
|
@ -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;
|
||||||
|
@ -327,11 +311,11 @@ Display.prototype = {
|
||||||
this.flip();
|
this.flip();
|
||||||
},
|
},
|
||||||
|
|
||||||
pending: function () {
|
pending: function() {
|
||||||
return this._renderQ.length > 0;
|
return this._renderQ.length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
flush: function () {
|
flush: function() {
|
||||||
if (this._renderQ.length === 0) {
|
if (this._renderQ.length === 0) {
|
||||||
this.onflush();
|
this.onflush();
|
||||||
} else {
|
} else {
|
||||||
|
@ -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,14 +446,14 @@ 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);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
blitRgbImage: function (x, y, width, height, arr, offset, from_queue) {
|
blitRgbImage: function (x, y , width, height, arr, offset, from_queue) {
|
||||||
if (this._renderQ.length !== 0 && !from_queue) {
|
if (this._renderQ.length !== 0 && !from_queue) {
|
||||||
// NB(directxman12): it's technically more performant here to use preallocated arrays,
|
// NB(directxman12): it's technically more performant here to use preallocated arrays,
|
||||||
// but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
|
// but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -613,7 +601,7 @@ Display.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_resume_renderQ: function () {
|
_resume_renderQ: function() {
|
||||||
// "this" is the object that is ready, not the
|
// "this" is the object that is ready, not the
|
||||||
// display object
|
// display object
|
||||||
this.removeEventListener('load', this._noVNC_display._resume_renderQ);
|
this.removeEventListener('load', this._noVNC_display._resume_renderQ);
|
||||||
|
@ -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,13 +14,13 @@ 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
|
||||||
|
|
||||||
'Backspace': 'Backspace',
|
'Backspace': 'Backspace',
|
||||||
|
|
||||||
// 3.1.1.2. Functional Keys
|
// 3.1.1.2. Functional Keys
|
||||||
|
|
||||||
'AltLeft': 'Alt',
|
'AltLeft': 'Alt',
|
||||||
'AltRight': 'Alt', // This could also be 'AltGraph'
|
'AltRight': 'Alt', // This could also be 'AltGraph'
|
||||||
|
@ -41,7 +36,7 @@ exports.default = {
|
||||||
'Tab': 'Tab',
|
'Tab': 'Tab',
|
||||||
// FIXME: Japanese/Korean keys
|
// FIXME: Japanese/Korean keys
|
||||||
|
|
||||||
// 3.1.2. Control Pad Section
|
// 3.1.2. Control Pad Section
|
||||||
|
|
||||||
'Delete': 'Delete',
|
'Delete': 'Delete',
|
||||||
'End': 'End',
|
'End': 'End',
|
||||||
|
@ -51,20 +46,20 @@ exports.default = {
|
||||||
'PageDown': 'PageDown',
|
'PageDown': 'PageDown',
|
||||||
'PageUp': 'PageUp',
|
'PageUp': 'PageUp',
|
||||||
|
|
||||||
// 3.1.3. Arrow Pad Section
|
// 3.1.3. Arrow Pad Section
|
||||||
|
|
||||||
'ArrowDown': 'ArrowDown',
|
'ArrowDown': 'ArrowDown',
|
||||||
'ArrowLeft': 'ArrowLeft',
|
'ArrowLeft': 'ArrowLeft',
|
||||||
'ArrowRight': 'ArrowRight',
|
'ArrowRight': 'ArrowRight',
|
||||||
'ArrowUp': 'ArrowUp',
|
'ArrowUp': 'ArrowUp',
|
||||||
|
|
||||||
// 3.1.4. Numpad Section
|
// 3.1.4. Numpad Section
|
||||||
|
|
||||||
'NumLock': 'NumLock',
|
'NumLock': 'NumLock',
|
||||||
'NumpadBackspace': 'Backspace',
|
'NumpadBackspace': 'Backspace',
|
||||||
'NumpadClear': 'Clear',
|
'NumpadClear': 'Clear',
|
||||||
|
|
||||||
// 3.1.5. Function Section
|
// 3.1.5. Function Section
|
||||||
|
|
||||||
'Escape': 'Escape',
|
'Escape': 'Escape',
|
||||||
'F1': 'F1',
|
'F1': 'F1',
|
||||||
|
@ -106,7 +101,7 @@ exports.default = {
|
||||||
'ScrollLock': 'ScrollLock',
|
'ScrollLock': 'ScrollLock',
|
||||||
'Pause': 'Pause',
|
'Pause': 'Pause',
|
||||||
|
|
||||||
// 3.1.6. Media Keys
|
// 3.1.6. Media Keys
|
||||||
|
|
||||||
'BrowserBack': 'BrowserBack',
|
'BrowserBack': 'BrowserBack',
|
||||||
'BrowserFavorites': 'BrowserFavorites',
|
'BrowserFavorites': 'BrowserFavorites',
|
||||||
|
@ -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
|
||||||
|
@ -240,7 +232,7 @@ Mouse.prototype = {
|
||||||
} else {
|
} else {
|
||||||
y = e.clientY - bounds.top;
|
y = e.clientY - bounds.top;
|
||||||
}
|
}
|
||||||
this._pos = { x: x, y: y };
|
this._pos = {x:x, y:y};
|
||||||
},
|
},
|
||||||
|
|
||||||
// ===== PUBLIC METHODS =====
|
// ===== PUBLIC METHODS =====
|
||||||
|
@ -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
|
||||||
|
@ -103,7 +95,7 @@ function setCapture(elem) {
|
||||||
_captureIndex++;
|
_captureIndex++;
|
||||||
|
|
||||||
// Track cursor and get initial cursor
|
// Track cursor and get initial cursor
|
||||||
_captureObserver.observe(elem, { attributes: true });
|
_captureObserver.observe(elem, {attributes:true});
|
||||||
_captureElemChanged();
|
_captureElemChanged();
|
||||||
|
|
||||||
captureElem.style.display = "";
|
captureElem.style.display = "";
|
||||||
|
@ -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;
|
||||||
|
@ -126,7 +119,7 @@ function releaseCapture() {
|
||||||
|
|
||||||
// There might be events already queued, so we need to wait for
|
// There might be events already queued, so we need to wait for
|
||||||
// them to flush. E.g. contextmenu in Microsoft Edge
|
// them to flush. E.g. contextmenu in Microsoft Edge
|
||||||
window.setTimeout(function (expected) {
|
window.setTimeout(function(expected) {
|
||||||
// Only clear it if it's the expected grab (i.e. no one
|
// Only clear it if it's the expected grab (i.e. no one
|
||||||
// else has initiated a new grab)
|
// else has initiated a new grab)
|
||||||
if (_captureIndex === expected) {
|
if (_captureIndex === expected) {
|
||||||
|
|
|
@ -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
|
||||||
|
@ -14,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||||
var EventTargetMixin = {
|
var EventTargetMixin = {
|
||||||
_listeners: null,
|
_listeners: null,
|
||||||
|
|
||||||
addEventListener: function (type, callback) {
|
addEventListener: function(type, callback) {
|
||||||
if (!this._listeners) {
|
if (!this._listeners) {
|
||||||
this._listeners = new Map();
|
this._listeners = new Map();
|
||||||
}
|
}
|
||||||
|
@ -24,14 +19,14 @@ var EventTargetMixin = {
|
||||||
this._listeners.get(type).add(callback);
|
this._listeners.get(type).add(callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEventListener: function (type, callback) {
|
removeEventListener: function(type, callback) {
|
||||||
if (!this._listeners || !this._listeners.has(type)) {
|
if (!this._listeners || !this._listeners.has(type)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._listeners.get(type).delete(callback);
|
this._listeners.get(type).delete(callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
dispatchEvent: function (event) {
|
dispatchEvent: function(event) {
|
||||||
if (!this._listeners || !this._listeners.has(event.type)) {
|
if (!this._listeners || !this._listeners.has(event.type)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -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)) {
|
||||||
|
@ -45,10 +39,10 @@ if (typeof Object.assign != 'function') {
|
||||||
|
|
||||||
/* CustomEvent constructor (taken from MDN) */
|
/* CustomEvent constructor (taken from MDN) */
|
||||||
(function () {
|
(function () {
|
||||||
function CustomEvent(event, params) {
|
function CustomEvent ( event, params ) {
|
||||||
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
||||||
var evt = document.createEvent('CustomEvent');
|
var evt = document.createEvent( 'CustomEvent' );
|
||||||
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
|
||||||
return evt;
|
return evt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
476
static/js/novnc/vendor/pako/lib/zlib/deflate.js
vendored
476
static/js/novnc/vendor/pako/lib/zlib/deflate.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -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 */
|
||||||
|
|
161
static/js/novnc/vendor/pako/lib/zlib/inffast.js
vendored
161
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,16 +37,16 @@ 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 */
|
||||||
var _out; /* local strm.output */
|
var _out; /* local strm.output */
|
||||||
var beg; /* inflate()'s initial strm.output */
|
var beg; /* inflate()'s initial strm.output */
|
||||||
var end; /* while out < end, enough space available */
|
var end; /* while out < end, enough space available */
|
||||||
//#ifdef INFLATE_STRICT
|
//#ifdef INFLATE_STRICT
|
||||||
var dmax; /* maximum distance from zlib header */
|
var dmax; /* maximum distance from zlib header */
|
||||||
//#endif
|
//#endif
|
||||||
var wsize; /* window size or zero if not using window */
|
var wsize; /* window size or zero if not using window */
|
||||||
var whave; /* valid bytes in the window */
|
var whave; /* valid bytes in the window */
|
||||||
var wnext; /* window write index */
|
var wnext; /* window write index */
|
||||||
|
@ -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 */
|
||||||
|
@ -84,9 +79,9 @@ function inflate_fast(strm, start) {
|
||||||
output = strm.output;
|
output = strm.output;
|
||||||
beg = _out - (start - strm.avail_out);
|
beg = _out - (start - strm.avail_out);
|
||||||
end = _out + (strm.avail_out - 257);
|
end = _out + (strm.avail_out - 257);
|
||||||
//#ifdef INFLATE_STRICT
|
//#ifdef INFLATE_STRICT
|
||||||
dmax = state.dmax;
|
dmax = state.dmax;
|
||||||
//#endif
|
//#endif
|
||||||
wsize = state.wsize;
|
wsize = state.wsize;
|
||||||
whave = state.whave;
|
whave = state.whave;
|
||||||
wnext = state.wnext;
|
wnext = state.wnext;
|
||||||
|
@ -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,28 +108,27 @@ 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) {
|
||||||
if (bits < op) {
|
if (bits < op) {
|
||||||
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,16 +141,15 @@ 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) {
|
||||||
hold += input[_in++] << bits;
|
hold += input[_in++] << bits;
|
||||||
|
@ -164,20 +159,19 @@ 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';
|
||||||
state.mode = BAD;
|
state.mode = BAD;
|
||||||
break top;
|
break top;
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
hold >>>= op;
|
hold >>>= op;
|
||||||
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) {
|
||||||
|
@ -186,35 +180,33 @@ function inflate_fast(strm, start) {
|
||||||
break top;
|
break top;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (!) This block is disabled in zlib defailts,
|
// (!) This block is disabled in zlib defailts,
|
||||||
// don't enable it for binary compatibility
|
// don't enable it for binary compatibility
|
||||||
//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||||
// if (len <= op - whave) {
|
// if (len <= op - whave) {
|
||||||
// do {
|
// do {
|
||||||
// output[_out++] = 0;
|
// output[_out++] = 0;
|
||||||
// } while (--len);
|
// } while (--len);
|
||||||
// continue top;
|
// continue top;
|
||||||
// }
|
// }
|
||||||
// len -= op - whave;
|
// len -= op - whave;
|
||||||
// do {
|
// do {
|
||||||
// output[_out++] = 0;
|
// output[_out++] = 0;
|
||||||
// } while (--op > whave);
|
// } while (--op > whave);
|
||||||
// if (op === 0) {
|
// if (op === 0) {
|
||||||
// from = _out - dist;
|
// from = _out - dist;
|
||||||
// do {
|
// do {
|
||||||
// output[_out++] = output[from++];
|
// output[_out++] = output[from++];
|
||||||
// } while (--len);
|
// } while (--len);
|
||||||
// continue top;
|
// continue top;
|
||||||
// }
|
// }
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
|
550
static/js/novnc/vendor/pako/lib/zlib/inflate.js
vendored
550
static/js/novnc/vendor/pako/lib/zlib/inflate.js
vendored
File diff suppressed because it is too large
Load diff
105
static/js/novnc/vendor/pako/lib/zlib/inftrees.js
vendored
105
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;
|
||||||
|
@ -20,26 +9,36 @@ var CODES = 0;
|
||||||
var LENS = 1;
|
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 */
|
||||||
|
@ -53,7 +52,7 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
|
||||||
var next; /* next available space in table */
|
var next; /* next available space in table */
|
||||||
var base = null; /* base value table to use */
|
var base = null; /* base value table to use */
|
||||||
var base_index = 0;
|
var base_index = 0;
|
||||||
// var shoextra; /* extra bits table to use */
|
// var shoextra; /* extra bits table to use */
|
||||||
var end; /* use base and extra for symbol > end */
|
var end; /* use base and extra for symbol > end */
|
||||||
var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
||||||
var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
||||||
|
@ -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 */
|
||||||
|
|
333
static/js/novnc/vendor/pako/lib/zlib/trees.js
vendored
333
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
|
||||||
*/
|
*/
|
||||||
|
@ -95,15 +83,16 @@ var REPZ_11_138 = 18;
|
||||||
|
|
||||||
/* eslint-disable comma-spacing,array-bracket-spacing */
|
/* eslint-disable comma-spacing,array-bracket-spacing */
|
||||||
var extra_lbits = /* extra bits for each length code */
|
var extra_lbits = /* extra bits for each length code */
|
||||||
[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];
|
[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];
|
||||||
|
|
||||||
var extra_dbits = /* extra bits for each distance code */
|
var extra_dbits = /* extra bits for each distance code */
|
||||||
[0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
|
[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];
|
||||||
|
|
||||||
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,51 +154,59 @@ 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.
|
||||||
*/
|
*/
|
||||||
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.
|
||||||
|
@ -274,36 +275,32 @@ function gen_bitlen(s, desc)
|
||||||
/* In a first pass, compute the optimal bit lengths (which may
|
/* In a first pass, compute the optimal bit lengths (which may
|
||||||
* overflow in the case of the bit length tree).
|
* overflow in the case of the bit length tree).
|
||||||
*/
|
*/
|
||||||
tree[s.heap[s.heap_max] * 2 + 1] /*.Len*/ = 0; /* root of the heap */
|
tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */
|
||||||
|
|
||||||
for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
|
for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
|
||||||
n = s.heap[h];
|
n = s.heap[h];
|
||||||
bits = tree[tree[n * 2 + 1] /*.Dad*/ * 2 + 1] /*.Len*/ + 1;
|
bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;
|
||||||
if (bits > max_length) {
|
if (bits > max_length) {
|
||||||
bits = max_length;
|
bits = max_length;
|
||||||
overflow++;
|
overflow++;
|
||||||
}
|
}
|
||||||
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;
|
||||||
if (n >= base) {
|
if (n >= base) {
|
||||||
xbits = extra[n - base];
|
xbits = extra[n - base];
|
||||||
}
|
}
|
||||||
f = tree[n * 2] /*.Freq*/;
|
f = tree[n * 2]/*.Freq*/;
|
||||||
s.opt_len += f * (bits + xbits);
|
s.opt_len += f * (bits + xbits);
|
||||||
if (has_stree) {
|
if (has_stree) {
|
||||||
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,19 +327,18 @@ 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*/;
|
||||||
tree[m * 2 + 1] /*.Len*/ = bits;
|
tree[m * 2 + 1]/*.Len*/ = bits;
|
||||||
}
|
}
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* 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.
|
||||||
|
@ -377,18 +371,17 @@ function gen_codes(tree, max_code, bl_count)
|
||||||
//Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
//Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
//Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
//Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
||||||
// n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
|
// n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Initialize the various 'constant' tables.
|
* Initialize the various 'constant' tables.
|
||||||
*/
|
*/
|
||||||
|
@ -405,19 +398,19 @@ function tr_static_init() {
|
||||||
//if (static_init_done) return;
|
//if (static_init_done) return;
|
||||||
|
|
||||||
/* For some embedded targets, global variables are not initialized: */
|
/* For some embedded targets, global variables are not initialized: */
|
||||||
/*#ifdef NO_INIT_GLOBAL_POINTERS
|
/*#ifdef NO_INIT_GLOBAL_POINTERS
|
||||||
static_l_desc.static_tree = static_ltree;
|
static_l_desc.static_tree = static_ltree;
|
||||||
static_l_desc.extra_bits = extra_lbits;
|
static_l_desc.extra_bits = extra_lbits;
|
||||||
static_d_desc.static_tree = static_dtree;
|
static_d_desc.static_tree = static_dtree;
|
||||||
static_d_desc.extra_bits = extra_dbits;
|
static_d_desc.extra_bits = extra_dbits;
|
||||||
static_bl_desc.extra_bits = extra_blbits;
|
static_bl_desc.extra_bits = extra_blbits;
|
||||||
#endif*/
|
#endif*/
|
||||||
|
|
||||||
/* Initialize the mapping length (0..255) -> length code (0..28) */
|
/* Initialize the mapping length (0..255) -> length code (0..28) */
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -453,22 +446,22 @@ function tr_static_init() {
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
while (n <= 143) {
|
while (n <= 143) {
|
||||||
static_ltree[n * 2 + 1] /*.Len*/ = 8;
|
static_ltree[n * 2 + 1]/*.Len*/ = 8;
|
||||||
n++;
|
n++;
|
||||||
bl_count[8]++;
|
bl_count[8]++;
|
||||||
}
|
}
|
||||||
while (n <= 255) {
|
while (n <= 255) {
|
||||||
static_ltree[n * 2 + 1] /*.Len*/ = 9;
|
static_ltree[n * 2 + 1]/*.Len*/ = 9;
|
||||||
n++;
|
n++;
|
||||||
bl_count[9]++;
|
bl_count[9]++;
|
||||||
}
|
}
|
||||||
while (n <= 279) {
|
while (n <= 279) {
|
||||||
static_ltree[n * 2 + 1] /*.Len*/ = 7;
|
static_ltree[n * 2 + 1]/*.Len*/ = 7;
|
||||||
n++;
|
n++;
|
||||||
bl_count[7]++;
|
bl_count[7]++;
|
||||||
}
|
}
|
||||||
while (n <= 287) {
|
while (n <= 287) {
|
||||||
static_ltree[n * 2 + 1] /*.Len*/ = 8;
|
static_ltree[n * 2 + 1]/*.Len*/ = 8;
|
||||||
n++;
|
n++;
|
||||||
bl_count[8]++;
|
bl_count[8]++;
|
||||||
}
|
}
|
||||||
|
@ -480,8 +473,8 @@ function tr_static_init() {
|
||||||
|
|
||||||
/* The static distance tree is trivial: */
|
/* The static distance tree is trivial: */
|
||||||
for (n = 0; n < D_CODES; n++) {
|
for (n = 0; n < D_CODES; n++) {
|
||||||
static_dtree[n * 2 + 1] /*.Len*/ = 5;
|
static_dtree[n * 2 + 1]/*.Len*/ = 5;
|
||||||
static_dtree[n * 2] /*.Code*/ = bi_reverse(n, 5);
|
static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now data ready and we can init static trees
|
// Now data ready and we can init static trees
|
||||||
|
@ -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) {
|
||||||
|
@ -544,9 +534,9 @@ function copy_block(s, buf, len, header)
|
||||||
put_short(s, len);
|
put_short(s, len);
|
||||||
put_short(s, ~len);
|
put_short(s, ~len);
|
||||||
}
|
}
|
||||||
// while (len--) {
|
// while (len--) {
|
||||||
// put_byte(s, *buf++);
|
// put_byte(s, *buf++);
|
||||||
// }
|
// }
|
||||||
utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);
|
utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);
|
||||||
s.pending += len;
|
s.pending += len;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
@ -678,11 +671,12 @@ function build_tree(s, desc)
|
||||||
s.heap_max = HEAP_SIZE;
|
s.heap_max = HEAP_SIZE;
|
||||||
|
|
||||||
for (n = 0; n < elems; n++) {
|
for (n = 0; n < elems; n++) {
|
||||||
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,13 +686,13 @@ 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--;
|
||||||
|
|
||||||
if (has_stree) {
|
if (has_stree) {
|
||||||
s.static_len -= stree[node * 2 + 1] /*.Len*/;
|
s.static_len -= stree[node * 2 + 1]/*.Len*/;
|
||||||
}
|
}
|
||||||
/* node is 0 or 1 so it does not have extra bits */
|
/* node is 0 or 1 so it does not have extra bits */
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
@ -718,27 +710,28 @@ function build_tree(s, desc)
|
||||||
do {
|
do {
|
||||||
//pqremove(s, tree, n); /* n = node of least frequency */
|
//pqremove(s, tree, n); /* n = node of least frequency */
|
||||||
/*** pqremove ***/
|
/*** pqremove ***/
|
||||||
n = s.heap[1 /*SMALLEST*/];
|
n = s.heap[1/*SMALLEST*/];
|
||||||
s.heap[1 /*SMALLEST*/] = s.heap[s.heap_len--];
|
s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];
|
||||||
pqdownheap(s, tree, 1 /*SMALLEST*/);
|
pqdownheap(s, tree, 1/*SMALLEST*/);
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
m = s.heap[1 /*SMALLEST*/]; /* m = node of next least frequency */
|
m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */
|
||||||
|
|
||||||
s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */
|
s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */
|
||||||
s.heap[--s.heap_max] = m;
|
s.heap[--s.heap_max] = m;
|
||||||
|
|
||||||
/* Create a new node father of n and m */
|
/* Create a new node father of n and m */
|
||||||
tree[node * 2] /*.Freq*/ = tree[n * 2] /*.Freq*/ + tree[m * 2] /*.Freq*/;
|
tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;
|
||||||
s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
|
s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
|
||||||
tree[n * 2 + 1] /*.Dad*/ = tree[m * 2 + 1] /*.Dad*/ = node;
|
tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;
|
||||||
|
|
||||||
/* 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*/];
|
||||||
|
|
||||||
/* At this point, the fields freq and dad are set. We can now
|
/* At this point, the fields freq and dad are set. We can now
|
||||||
* generate the bit lengths.
|
* generate the bit lengths.
|
||||||
|
@ -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.
|
||||||
|
@ -762,7 +756,7 @@ function scan_tree(s, tree, max_code)
|
||||||
var prevlen = -1; /* last emitted length */
|
var prevlen = -1; /* last emitted length */
|
||||||
var curlen; /* length of current code */
|
var curlen; /* length of current code */
|
||||||
|
|
||||||
var nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */
|
var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */
|
||||||
|
|
||||||
var count = 0; /* repeat count of the current code */
|
var count = 0; /* repeat count of the current code */
|
||||||
var max_count = 7; /* max repeat count */
|
var max_count = 7; /* max repeat count */
|
||||||
|
@ -772,26 +766,28 @@ function scan_tree(s, tree, max_code)
|
||||||
max_count = 138;
|
max_count = 138;
|
||||||
min_count = 3;
|
min_count = 3;
|
||||||
}
|
}
|
||||||
tree[(max_code + 1) * 2 + 1] /*.Len*/ = 0xffff; /* guard */
|
tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */
|
||||||
|
|
||||||
for (n = 0; n <= max_code; n++) {
|
for (n = 0; n <= max_code; n++) {
|
||||||
curlen = nextlen;
|
curlen = nextlen;
|
||||||
nextlen = tree[(n + 1) * 2 + 1] /*.Len*/;
|
nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;
|
||||||
|
|
||||||
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*/++;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
@ -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.
|
||||||
|
@ -823,7 +822,7 @@ function send_tree(s, tree, max_code)
|
||||||
var prevlen = -1; /* last emitted length */
|
var prevlen = -1; /* last emitted length */
|
||||||
var curlen; /* length of current code */
|
var curlen; /* length of current code */
|
||||||
|
|
||||||
var nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */
|
var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */
|
||||||
|
|
||||||
var count = 0; /* repeat count of the current code */
|
var count = 0; /* repeat count of the current code */
|
||||||
var max_count = 7; /* max repeat count */
|
var max_count = 7; /* max repeat count */
|
||||||
|
@ -837,14 +836,14 @@ function send_tree(s, tree, max_code)
|
||||||
|
|
||||||
for (n = 0; n <= max_code; n++) {
|
for (n = 0; n <= max_code; n++) {
|
||||||
curlen = nextlen;
|
curlen = nextlen;
|
||||||
nextlen = tree[(n + 1) * 2 + 1] /*.Len*/;
|
nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;
|
||||||
|
|
||||||
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.
|
||||||
|
@ -898,7 +902,7 @@ function build_bl_tree(s) {
|
||||||
* 3 but the actual value used is 4.)
|
* 3 but the actual value used is 4.)
|
||||||
*/
|
*/
|
||||||
for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
|
for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
|
||||||
if (s.bl_tree[bl_order[max_blindex] * 2 + 1] /*.Len*/ !== 0) {
|
if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
@ -930,7 +935,7 @@ function send_all_trees(s, lcodes, dcodes, blcodes)
|
||||||
send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
|
send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
|
||||||
for (rank = 0; rank < blcodes; rank++) {
|
for (rank = 0; rank < blcodes; rank++) {
|
||||||
//Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
|
//Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
|
||||||
send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1] /*.Len*/, 3);
|
send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);
|
||||||
}
|
}
|
||||||
//Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
|
//Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
|
||||||
|
|
||||||
|
@ -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,17 +970,18 @@ 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++) {
|
||||||
if (s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {
|
if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {
|
||||||
return Z_TEXT;
|
return Z_TEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -1136,7 +1149,7 @@ function _tr_tally(s, dist, lc)
|
||||||
|
|
||||||
if (dist === 0) {
|
if (dist === 0) {
|
||||||
/* lc is the unmatched char */
|
/* lc is the unmatched char */
|
||||||
s.dyn_ltree[lc * 2] /*.Freq*/++;
|
s.dyn_ltree[lc * 2]/*.Freq*/++;
|
||||||
} else {
|
} else {
|
||||||
s.matches++;
|
s.matches++;
|
||||||
/* Here, lc is the match length - MIN_MATCH */
|
/* Here, lc is the match length - MIN_MATCH */
|
||||||
|
@ -1145,42 +1158,38 @@ function _tr_tally(s, dist, lc)
|
||||||
// (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
|
// (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
|
||||||
// (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
|
// (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
|
||||||
|
|
||||||
s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2] /*.Freq*/++;
|
s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;
|
||||||
s.dyn_dtree[d_code(dist) * 2] /*.Freq*/++;
|
s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (!) This block is disabled in zlib defailts,
|
// (!) This block is disabled in zlib defailts,
|
||||||
// don't enable it for binary compatibility
|
// don't enable it for binary compatibility
|
||||||
|
|
||||||
//#ifdef TRUNCATE_BLOCK
|
//#ifdef TRUNCATE_BLOCK
|
||||||
// /* Try to guess if it is profitable to stop the current block here */
|
// /* Try to guess if it is profitable to stop the current block here */
|
||||||
// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
|
// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
|
||||||
// /* Compute an upper bound for the compressed length */
|
// /* Compute an upper bound for the compressed length */
|
||||||
// out_length = s.last_lit*8;
|
// out_length = s.last_lit*8;
|
||||||
// in_length = s.strstart - s.block_start;
|
// in_length = s.strstart - s.block_start;
|
||||||
//
|
//
|
||||||
// for (dcode = 0; dcode < D_CODES; dcode++) {
|
// for (dcode = 0; dcode < D_CODES; dcode++) {
|
||||||
// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
|
// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
|
||||||
// }
|
// }
|
||||||
// out_length >>>= 3;
|
// out_length >>>= 3;
|
||||||
// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
||||||
// // s->last_lit, in_length, out_length,
|
// // s->last_lit, in_length, out_length,
|
||||||
// // 100L - out_length*100L/in_length));
|
// // 100L - out_length*100L/in_length));
|
||||||
// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
|
// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//#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;
|
|
||||||
|
|
12
static/js/novnc/vendor/pako/lib/zlib/zstream.js
vendored
12
static/js/novnc/vendor/pako/lib/zlib/zstream.js
vendored
|
@ -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;
|
||||||
|
@ -20,11 +14,11 @@ function ZStream() {
|
||||||
/* total number of bytes output so far */
|
/* total number of bytes output so far */
|
||||||
this.total_out = 0;
|
this.total_out = 0;
|
||||||
/* last error message, NULL if no error */
|
/* last error message, NULL if no error */
|
||||||
this.msg = '' /*Z_NULL*/;
|
this.msg = ''/*Z_NULL*/;
|
||||||
/* not visible by applications */
|
/* not visible by applications */
|
||||||
this.state = null;
|
this.state = null;
|
||||||
/* best guess about the data type: binary or text */
|
/* best guess about the data type: binary or text */
|
||||||
this.data_type = 2 /*Z_UNKNOWN*/;
|
this.data_type = 2/*Z_UNKNOWN*/;
|
||||||
/* adler32 value of the uncompressed data */
|
/* adler32 value of the uncompressed data */
|
||||||
this.adler = 0;
|
this.adler = 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