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:
Joel Martin
2010-12-10 08:25:36 -06:00
parent 5b0bbd5c12
commit e46719100c
13 changed files with 115 additions and 110 deletions
+10 -10
View File
@@ -47,7 +47,7 @@
function msg(str) {
console.log(str);
var cell = $('messages');
var cell = $D('messages');
cell.innerHTML += str + "\n";
cell.scrollTop = cell.scrollHeight;
}
@@ -68,20 +68,20 @@
test_state = 'failed';
break;
case 'loaded':
$('startButton').disabled = false;
$D('startButton').disabled = false;
break;
}
if (typeof mesg !== 'undefined') {
$('VNC_status').innerHTML = mesg;
$D('VNC_status').innerHTML = mesg;
}
}
function start() {
$('startButton').value = "Running";
$('startButton').disabled = true;
$D('startButton').value = "Running";
$D('startButton').disabled = true;
mode = 'perftest'; // full-speed
passes = $('passes').value;
passes = $D('passes').value;
pass = 1;
encIdx = 0;
@@ -123,8 +123,8 @@
if (pass > passes) {
// We are finished
rfb.get_canvas().stop(); // Shut-off event interception
$('startButton').disabled = false;
$('startButton').value = "Start";
$D('startButton').disabled = false;
$D('startButton').value = "Start";
finish_passes();
return; // We are finished, terminate
}
@@ -189,8 +189,8 @@
enc = encOrder[i];
dbgmsg(" " + enc + ": " + VNC_frame_data_multi[enc].length);
}
rfb = RFB({'target': 'VNC_canvas',
'updateState': updateState});
rfb = new RFB({'target': $D('VNC_canvas'),
'updateState': updateState});
rfb.testMode(send_array);
}
</script>