- All state/status updates go through updateState routine which updates the status line also. - Old firefox (and opera) don't support canvas createImageData, so use getImageData as replacement. - Add console.warn and console.error stubs so that firefox without firebug doesn't crap out. - If no WebSockets then error if no flash or if URL is location (flash will refuse to load the object for security reasons).
82 lines
3.1 KiB
HTML
82 lines
3.1 KiB
HTML
<html>
|
|
|
|
<head><title>VNC Client</title></head>
|
|
|
|
<body>
|
|
|
|
Host: <input id='host' style='width:100'>
|
|
Port: <input id='port' style='width:50'>
|
|
Password: <input id='password' type='password' style='width:80'>
|
|
<input id='connectButton' type='button' value='Loading'
|
|
style='width:100px' disabled>
|
|
<br><br>
|
|
|
|
<div id='status'>Loading</div>
|
|
<canvas id="vnc" width="640" height="20"
|
|
style="border-style: dotted; border-width: 1px;">
|
|
Canvas not supported.
|
|
</canvas>
|
|
|
|
<br><br>
|
|
VNC Clipboard:
|
|
<input id='clearButton' type="button" value="Clear"
|
|
onclick="RFB.clipboardClear();"><br>
|
|
<textarea id="clipboard" style="font-size:9;" cols=80 rows=5
|
|
onchange="RFB.clipboardPasteFrom();"
|
|
onfocus="RFB.clipboardFocus=true;"
|
|
onblur="RFB.clipboardFocus=false;"></textarea>
|
|
</body>
|
|
|
|
<!--
|
|
<script type='text/javascript'
|
|
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
|
|
-->
|
|
|
|
<script src="include/mootools.js"></script>
|
|
<script src="include/base64.js"></script>
|
|
<script src="include/des.js"></script>
|
|
<script src="include/util.js"></script>
|
|
<script src="canvas.js"></script>
|
|
<script src="vnc.js"></script>
|
|
|
|
<script>
|
|
var native_ws = true;
|
|
|
|
/* If no builtin websockets then load web_socket.js */
|
|
if (! window.WebSocket) {
|
|
var extra = "<script src='include/web-socket-js/swfobject.js'><\/script>";
|
|
extra += "<script src='include/web-socket-js/FABridge.js'><\/script>";
|
|
extra += "<script src='include/web-socket-js/web_socket.js'><\/script>";
|
|
document.write(extra);
|
|
native_ws = false;
|
|
}
|
|
|
|
window.onload = function() {
|
|
console.log("onload");
|
|
if (native_ws) {
|
|
console.log("Using native WebSockets");
|
|
RFB.updateState('disconnected', 'Disconnected');
|
|
} else {
|
|
console.log("Using web-socket-js flash bridge");
|
|
if ((! Browser.Plugins.Flash) ||
|
|
(Browser.Plugins.Flash.version < 9)) {
|
|
RFB.updateState('failed', "WebSockets or Adobe Flash is required");
|
|
} else if (location.href.substr(0, 7) == "file://") {
|
|
RFB.updateState('failed', "'file://' URL is incompatible with Adobe Flash");
|
|
} else {
|
|
WebSocket.__swfLocation = "include/web-socket-js/WebSocketMain.swf";
|
|
RFB.force_copy = true;
|
|
RFB.updateState('disconnected', 'Disconnected');
|
|
}
|
|
}
|
|
if (RFB.state == 'disconnected') {
|
|
var url = document.location.href;
|
|
$('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
|
|
$('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
|
|
$('password').value = (url.match(/password=([^&#]*)/) || ['',''])[1];
|
|
}
|
|
}
|
|
</script>
|
|
|
|
</html>
|