Merge 3c5fc57833 into 7a6c94b6b9
This commit is contained in:
commit
ed1cddd8be
|
|
@ -1 +1 @@
|
|||
window.onload = UI.load;
|
||||
NoVnc.onload = UI.load;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
/*jslint evil: true */
|
||||
/*global window, document, INCLUDE_URI */
|
||||
|
||||
var NoVnc = {};
|
||||
NoVnc.onload = null;
|
||||
NoVnc.init_scripts = [];
|
||||
|
||||
/*
|
||||
* Load supporting scripts
|
||||
*/
|
||||
|
|
@ -20,13 +24,38 @@ function get_INCLUDE_URI() {
|
|||
* Reference: http://unixpapa.com/js/dyna.html
|
||||
*/
|
||||
function load_scripts(base, files) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
for (var i=0; i<files.length; i++) {
|
||||
function onloadhook () {
|
||||
if (this.initState) //Already initialized
|
||||
return;
|
||||
this.initState = true;
|
||||
NoVnc.init_scripts.splice(0, 1);
|
||||
if (NoVnc.init_scripts.length > 0)
|
||||
start_loading();
|
||||
else if (!!NoVnc.onload) {
|
||||
NoVnc.onload();
|
||||
NoVnc.onload = null;
|
||||
}
|
||||
}
|
||||
function start_loading() {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = base + files[i];
|
||||
script.onload = onloadhook;
|
||||
script.onreadystatechange = function () {
|
||||
if (this.readyState == 'complete' || this.readyState == 'loaded')
|
||||
this.onload();
|
||||
}
|
||||
script.initState = false;
|
||||
script.src = NoVnc.init_scripts[0];
|
||||
head.appendChild(script);
|
||||
}
|
||||
|
||||
var needtokick = (NoVnc.init_scripts.length === 0);
|
||||
for (var i=0; i<files.length; i++) {
|
||||
NoVnc.init_scripts = NoVnc.init_scripts.concat([base + files[i]]);
|
||||
}
|
||||
if (needtokick)
|
||||
start_loading();
|
||||
}
|
||||
|
||||
load_scripts(get_INCLUDE_URI(),
|
||||
|
|
|
|||
|
|
@ -35,23 +35,14 @@ if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
|
|||
|
||||
Websock_native = false;
|
||||
(function () {
|
||||
function get_INCLUDE_URI() {
|
||||
return (typeof INCLUDE_URI !== "undefined") ?
|
||||
INCLUDE_URI : "include/";
|
||||
}
|
||||
|
||||
var start = "<script src='" + get_INCLUDE_URI(),
|
||||
end = "'><\/script>", extra = "";
|
||||
|
||||
window.WEB_SOCKET_SWF_LOCATION = get_INCLUDE_URI() +
|
||||
"web-socket-js/WebSocketMain.swf";
|
||||
if (Util.Engine.trident) {
|
||||
Util.Debug("Forcing uncached load of WebSocketMain.swf");
|
||||
window.WEB_SOCKET_SWF_LOCATION += "?" + Math.random();
|
||||
}
|
||||
extra += start + "web-socket-js/swfobject.js" + end;
|
||||
extra += start + "web-socket-js/web_socket.js" + end;
|
||||
document.write(extra);
|
||||
load_scripts(get_INCLUDE_URI() + "web-socket-js/",
|
||||
["swfobject.js", "web_socket.js"]);
|
||||
}());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
NoVnc.onload = function () {
|
||||
var host, port, password, path, token;
|
||||
|
||||
$D('sendCtrlAltDelButton').style.display = "inline";
|
||||
|
|
|
|||
Loading…
Reference in New Issue