Make compatible with jQuery. Slight API change.
Rename the $() selector to $D() so that it doesn't collide with the jQuery name. The API change is that the 'target' option for Canvas and RFB objects must now be a DOM Canvas element. A string is no longer accepted because this requires that a DOM lookup is done and the Canvas and RFB should have no UI code in them. Modularity.
This commit is contained in:
+10
-10
@@ -34,7 +34,7 @@
|
||||
|
||||
function message(str) {
|
||||
console.log(str);
|
||||
cell = $('messages');
|
||||
cell = $D('messages');
|
||||
cell.innerHTML += str + "\n";
|
||||
cell.scrollTop = cell.scrollHeight;
|
||||
}
|
||||
@@ -65,7 +65,7 @@
|
||||
function init_ws() {
|
||||
console.log(">> init_ws");
|
||||
var scheme = "ws://";
|
||||
if ($('encrypt').checked) {
|
||||
if ($D('encrypt').checked) {
|
||||
scheme = "wss://";
|
||||
}
|
||||
var uri = scheme + host + ":" + port;
|
||||
@@ -97,8 +97,8 @@
|
||||
|
||||
function connect() {
|
||||
console.log(">> connect");
|
||||
host = $('host').value;
|
||||
port = $('port').value;
|
||||
host = $D('host').value;
|
||||
port = $D('port').value;
|
||||
if ((!host) || (!port)) {
|
||||
console.log("must set host and port");
|
||||
return;
|
||||
@@ -109,8 +109,8 @@
|
||||
}
|
||||
init_ws();
|
||||
|
||||
$('connectButton').value = "Stop";
|
||||
$('connectButton').onclick = disconnect;
|
||||
$D('connectButton').value = "Stop";
|
||||
$D('connectButton').onclick = disconnect;
|
||||
console.log("<< connect");
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@
|
||||
ws.close();
|
||||
}
|
||||
|
||||
$('connectButton').value = "Start";
|
||||
$('connectButton').onclick = connect;
|
||||
$D('connectButton').value = "Start";
|
||||
$D('connectButton').onclick = connect;
|
||||
console.log("<< disconnect");
|
||||
}
|
||||
|
||||
@@ -143,8 +143,8 @@
|
||||
WebSocket.__initialize();
|
||||
}
|
||||
var url = document.location.href;
|
||||
$('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
|
||||
$('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
|
||||
$D('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
|
||||
$D('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user