Răsfoiți Sursa

Linting.

Switched to using: http://www.jshint.com/
Joel Martin 13 ani în urmă
părinte
comite
ff4bfcb773
6 a modificat fișierele cu 26 adăugiri și 22 ștergeri
  1. 3 3
      include/display.js
  2. 1 1
      include/rfb.js
  3. 12 11
      include/ui.js
  4. 1 1
      include/util.js
  5. 6 3
      include/websock.js
  6. 3 3
      include/webutil.js

+ 3 - 3
include/display.js

@@ -386,10 +386,10 @@ that.getCleanDirtyReset = function() {
 // Translate viewport coordinates to absolute coordinates
 // Translate viewport coordinates to absolute coordinates
 that.absX = function(x) {
 that.absX = function(x) {
     return x + viewport.x;
     return x + viewport.x;
-}
+};
 that.absY = function(y) {
 that.absY = function(y) {
     return y + viewport.y;
     return y + viewport.y;
-}
+};
 
 
 
 
 that.resize = function(width, height) {
 that.resize = function(width, height) {
@@ -492,7 +492,7 @@ that.subTile = function(x, y, w, h, color) {
 // Draw the current tile to the screen
 // Draw the current tile to the screen
 that.finishTile = function() {
 that.finishTile = function() {
     if (conf.prefer_js) {
     if (conf.prefer_js) {
-        c_ctx.putImageData(tile, tile_x - viewport.x, tile_y - viewport.y)
+        c_ctx.putImageData(tile, tile_x - viewport.x, tile_y - viewport.y);
     }
     }
     // else: No-op, if not prefer_js then already done by setSubTile
     // else: No-op, if not prefer_js then already done by setSubTile
 };
 };

+ 1 - 1
include/rfb.js

@@ -1339,7 +1339,7 @@ scan_tight_imgQ = function() {
         imgQ = FBU.imgQ;
         imgQ = FBU.imgQ;
         while ((imgQ.length > 0) && (imgQ[0].img.complete)) {
         while ((imgQ.length > 0) && (imgQ[0].img.complete)) {
             data = imgQ.shift();
             data = imgQ.shift();
-            if (data['type'] === 'fill') {
+            if (data.type === 'fill') {
                 display.fillRect(data.x, data.y, data.width, data.height, data.color);
                 display.fillRect(data.x, data.y, data.width, data.height, data.color);
             } else {
             } else {
                 ctx.drawImage(data.img, data.x, data.y);
                 ctx.drawImage(data.img, data.x, data.y);

+ 12 - 11
include/ui.js

@@ -190,16 +190,16 @@ forceSetting: function(name, val) {
 // Show the clipboard panel
 // Show the clipboard panel
 toggleClipboardPanel: function() {
 toggleClipboardPanel: function() {
     //Close settings if open
     //Close settings if open
-    if (UI.settingsOpen == true) {
+    if (UI.settingsOpen === true) {
         UI.settingsApply();
         UI.settingsApply();
         UI.closeSettingsMenu();
         UI.closeSettingsMenu();
     }
     }
     //Close connection settings if open
     //Close connection settings if open
-    if (UI.connSettingsOpen == true) {
+    if (UI.connSettingsOpen === true) {
         UI.toggleConnectPanel();
         UI.toggleConnectPanel();
     }
     }
     //Toggle Clipboard Panel
     //Toggle Clipboard Panel
-    if (UI.clipboardOpen == true) {
+    if (UI.clipboardOpen === true) {
         $D('noVNC_clipboard').style.display = "none";
         $D('noVNC_clipboard').style.display = "none";
         $D('clipboardButton').className = "noVNC_status_button";
         $D('clipboardButton').className = "noVNC_status_button";
         UI.clipboardOpen = false;
         UI.clipboardOpen = false;
@@ -213,17 +213,17 @@ toggleClipboardPanel: function() {
 // Show the connection settings panel/menu
 // Show the connection settings panel/menu
 toggleConnectPanel: function() {
 toggleConnectPanel: function() {
     //Close connection settings if open
     //Close connection settings if open
-    if (UI.settingsOpen == true) {
+    if (UI.settingsOpen === true) {
         UI.settingsApply();
         UI.settingsApply();
         UI.closeSettingsMenu();
         UI.closeSettingsMenu();
         $D('connectButton').className = "noVNC_status_button";
         $D('connectButton').className = "noVNC_status_button";
     }
     }
-    if (UI.clipboardOpen == true) {
+    if (UI.clipboardOpen === true) {
         UI.toggleClipboardPanel();
         UI.toggleClipboardPanel();
     }
     }
 
 
     //Toggle Connection Panel
     //Toggle Connection Panel
-    if (UI.connSettingsOpen == true) {
+    if (UI.connSettingsOpen === true) {
         $D('noVNC_controls').style.display = "none";
         $D('noVNC_controls').style.display = "none";
         $D('connectButton').className = "noVNC_status_button";
         $D('connectButton').className = "noVNC_status_button";
         UI.connSettingsOpen = false;
         UI.connSettingsOpen = false;
@@ -265,11 +265,11 @@ toggleSettingsPanel: function() {
 
 
 // Open menu
 // Open menu
 openSettingsMenu: function() {
 openSettingsMenu: function() {
-    if (UI.clipboardOpen == true) {
+    if (UI.clipboardOpen === true) {
         UI.toggleClipboardPanel();
         UI.toggleClipboardPanel();
     }
     }
     //Close connection settings if open
     //Close connection settings if open
-    if (UI.connSettingsOpen == true) {
+    if (UI.connSettingsOpen === true) {
         UI.toggleConnectPanel();
         UI.toggleConnectPanel();
     }
     }
     $D('noVNC_settings').style.display = "block";
     $D('noVNC_settings').style.display = "block";
@@ -366,6 +366,7 @@ updateState: function(rfb, state, oldstate, msg) {
             break;
             break;
         case 'disconnected':
         case 'disconnected':
             $D('noVNC_logo').style.display = "block";
             $D('noVNC_logo').style.display = "block";
+            // Fall through
         case 'loaded':
         case 'loaded':
             klass = "noVNC_status_normal";
             klass = "noVNC_status_normal";
             break;
             break;
@@ -574,11 +575,11 @@ setViewDrag: function(drag) {
 
 
 // On touch devices, show the OS keyboard
 // On touch devices, show the OS keyboard
 showKeyboard: function() {
 showKeyboard: function() {
-    if(UI.keyboardVisible == false) {
+    if(UI.keyboardVisible === false) {
         $D('keyboardinput').focus();
         $D('keyboardinput').focus();
         UI.keyboardVisible = true;
         UI.keyboardVisible = true;
         $D('showKeyboard').className = "noVNC_status_button_selected";
         $D('showKeyboard').className = "noVNC_status_button_selected";
-    } else if(UI.keyboardVisible == true) {
+    } else if(UI.keyboardVisible === true) {
         $D('keyboardinput').blur();
         $D('keyboardinput').blur();
         $D('showKeyboard').className = "noVNC_status_button";
         $D('showKeyboard').className = "noVNC_status_button";
         UI.keyboardVisible = false;
         UI.keyboardVisible = false;
@@ -590,7 +591,7 @@ keyInputBlur: function() {
     //Weird bug in iOS if you change keyboardVisible
     //Weird bug in iOS if you change keyboardVisible
     //here it does not actually occur so next time
     //here it does not actually occur so next time
     //you click keyboard icon it doesnt work.
     //you click keyboard icon it doesnt work.
-    setTimeout("UI.setKeyboard()",100)
+    setTimeout(function() { UI.setKeyboard(); },100);
 },
 },
 
 
 setKeyboard: function() {
 setKeyboard: function() {

+ 1 - 1
include/util.js

@@ -159,7 +159,7 @@ Util.conf_defaults = function(cfg, api, defaults, arr) {
         Util.conf_default(cfg, api, defaults, arr[i][0], arr[i][1],
         Util.conf_default(cfg, api, defaults, arr[i][0], arr[i][1],
                 arr[i][2], arr[i][3], arr[i][4]);
                 arr[i][2], arr[i][3], arr[i][4]);
     }
     }
-}
+};
 
 
 
 
 /*
 /*

+ 6 - 3
include/websock.js

@@ -14,6 +14,9 @@
  * read binary data off of the receive queue.
  * read binary data off of the receive queue.
  */
  */
 
 
+/*jslint browser: true, bitwise: false, plusplus: false */
+/*global Util, Base64 */
+
 
 
 // Load Flash WebSocket emulator if needed
 // Load Flash WebSocket emulator if needed
 
 
@@ -38,11 +41,11 @@ if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
         var start = "<script src='" + get_INCLUDE_URI(),
         var start = "<script src='" + get_INCLUDE_URI(),
             end = "'><\/script>", extra = "";
             end = "'><\/script>", extra = "";
 
 
-        WEB_SOCKET_SWF_LOCATION = get_INCLUDE_URI() +
+        window.WEB_SOCKET_SWF_LOCATION = get_INCLUDE_URI() +
                     "web-socket-js/WebSocketMain.swf";
                     "web-socket-js/WebSocketMain.swf";
         if (Util.Engine.trident) {
         if (Util.Engine.trident) {
             Util.Debug("Forcing uncached load of WebSocketMain.swf");
             Util.Debug("Forcing uncached load of WebSocketMain.swf");
-            WEB_SOCKET_SWF_LOCATION += "?" + Math.random();
+            window.WEB_SOCKET_SWF_LOCATION += "?" + Math.random();
         }
         }
         extra += start + "web-socket-js/swfobject.js" + end;
         extra += start + "web-socket-js/swfobject.js" + end;
         extra += start + "web-socket-js/web_socket.js" + end;
         extra += start + "web-socket-js/web_socket.js" + end;
@@ -87,7 +90,7 @@ function get_rQi() {
 }
 }
 function set_rQi(val) {
 function set_rQi(val) {
     rQi = val;
     rQi = val;
-};
+}
 
 
 function rQlen() {
 function rQlen() {
     return rQ.length - rQi;
     return rQ.length - rQi;

+ 3 - 3
include/webutil.js

@@ -8,7 +8,7 @@
 
 
 "use strict";
 "use strict";
 /*jslint bitwise: false, white: false */
 /*jslint bitwise: false, white: false */
-/*global window, document */
+/*global Util, window, document */
 
 
 // Globals defined here
 // Globals defined here
 var WebUtil = {}, $D;
 var WebUtil = {}, $D;
@@ -42,8 +42,8 @@ WebUtil.init_logging = function() {
          /logging=([A-Za-z0-9\._\-]*)/) ||
          /logging=([A-Za-z0-9\._\-]*)/) ||
          ['', Util._log_level])[1];
          ['', Util._log_level])[1];
     
     
-    Util.init_logging()
-}
+    Util.init_logging();
+};
 WebUtil.init_logging();
 WebUtil.init_logging();