JSLint. RFB obj to rfb.js; vnc.js the 'loader'.

Move the whole RFB object to rfb.js. vnc.js is now just the loader
file. This allows an integrating project to easily replace vnc.js with
an alternate loader mechanism (or just do it directly in the html
file). Thanks for the idea primalmotion (http://github.com/primalmotion).

Also, JSLint the various files.
This commit is contained in:
Joel Martin
2010-07-22 10:54:47 -05:00
parent 19463eac1f
commit a7a8962676
5 changed files with 1646 additions and 1650 deletions
+7 -27
View File
@@ -8,21 +8,10 @@
"use strict";
/*jslint white: false, bitwise: false */
/*global window, $, Util */
/*global window, $, Util, Base64 */
var Canvas, Canvas_native;
(function () {
var pre, start = "<script src='", end = "'><\/script>";
if (document.createElement('canvas').getContext) {
Canvas_native = true;
} else {
pre = (typeof VNC_uri_prefix !== "undefined") ?
VNC_uri_prefix : "include/";
//document.write(start + pre + "excanvas.js" + end);
Canvas_native = false;
}
}());
// Globals defined here
var Canvas;
// Everything namespaced inside Canvas
Canvas = {
@@ -145,21 +134,12 @@ onMouseDisable: function (e) {
init: function (id) {
var c, imgTest, tval, i, curTest, curSave;
var c, imgTest, tval, i, curDat, curSave;
Util.Debug(">> Canvas.init");
Canvas.id = id;
c = $(Canvas.id);
if (Canvas_native) {
Util.Info("Using native canvas");
// Use default Canvas functions
} else {
Util.Warn("Using excanvas canvas emulation");
//G_vmlCanvasManager.init(c);
//G_vmlCanvasManager.initElement(c);
}
if (! c.getContext) { throw("No getContext method"); }
Canvas.ctx = c.getContext('2d');
@@ -392,7 +372,7 @@ _rgbxImageData: function(x, y, width, height, arr, offset) {
// really slow fallback if we don't have imageData
_rgbxImageFill: function(x, y, width, height, arr, offset) {
var sx = 0, sy = 0;
var i, j, sx = 0, sy = 0;
for (i=0, j=offset; i < (width * height); i+=1, j+=4) {
Canvas.fillRect(x+sx, y+sy, 1, 1, [arr[j+0], arr[j+1], arr[j+2]]);
sx += 1;
@@ -419,7 +399,7 @@ _cmapImageData: function(x, y, width, height, arr, offset) {
},
_cmapImageFill: function(x, y, width, height, arr, offset) {
var sx = 0, sy = 0;
var i, j, sx = 0, sy = 0, cmap;
cmap = Canvas.colourMap;
for (i=0, j=offset; i < (width * height); i+=1, j+=1) {
Canvas.fillRect(x+sx, y+sy, 1, 1, [arr[j]]);
@@ -568,7 +548,7 @@ isCursor: function() {
return Canvas.cursor_uri;
},
changeCursor: function(pixels, mask, hotx, hoty, w, h) {
var cur = [], cmap, IHDRsz, ANDsz, XORsz, url, idx, x, y;
var cur = [], cmap, rgb, IHDRsz, ANDsz, XORsz, url, idx, alpha, x, y;
//Util.Debug(">> changeCursor, x: " + hotx + ", y: " + hoty + ", w: " + w + ", h: " + h);
if (!Canvas.cursor_uri) {