Linting & wrapping some utility functions on the String prototype so they don't clobb...
authorJack Allnutt <m2ys4u@Gmail.com>
Thu, 22 Sep 2011 01:57:00 +0000 (02:57 +0100)
committerJack Allnutt <m2ys4u@Gmail.com>
Thu, 22 Sep 2011 01:57:00 +0000 (02:57 +0100)
js/front.js
js/gateway.js
js/util.js
node/app.js

index 2f7160fc4a5497b2f1f4afd76105eee355181b18..0dae4a5ead1d2d95e3201518481fac9cb72109f6 100644 (file)
@@ -536,7 +536,9 @@ kiwi.front = {
                 // Rejoin channels
                 channels = '';
                 $.each(kiwi.front.tabviews, function (i, tabview) {
-                    if (tabview.name == 'server') return;
+                    if (tabview.name === 'server') {
+                        return;
+                    }
                     channels += tabview.name + ',';
                 });
                 console.log('Rejoining: ' + channels);
@@ -575,7 +577,9 @@ kiwi.front = {
         var err_box, f, msg;
 
         err_box = $('.messages .msg.error.disconnect .text');
-        if (!err_box) return;
+        if (!err_box) {
+            return;
+        }
 
         f = function (num) {
             switch (num) {
@@ -586,7 +590,7 @@ kiwi.front = {
             case 5: return 'Fifth';
             case 6: return 'Sixth';
             case 7: return 'Seventh';
-            default: return 'Next'
+            default: return 'Next';
             }
         };
 
index f181fcb582b8891388985fd70f2475788f6561ae..65782f5783bc60ab5ee148caf4c81509952919fe 100644 (file)
@@ -25,8 +25,7 @@ kiwi.gateway = {
                 'try multiple transports': true,
                 'connect timeout': 3000,
                 'max reconnection attempts': 7,
-                'reconnection delay': 2000,
-
+                'reconnection delay': 2000
             });
             kiwi.gateway.socket.on('connect_failed', function (reason) {
                 // TODO: When does this even actually get fired? I can't find a case! ~Darren
index 1a3e4bcbfc43405f800a616c6ff5c3e1c9bf1044..e7c07c296370e64b114b0a2da2ddeaf9a846a020 100644 (file)
@@ -40,19 +40,22 @@ function randomString(string_length) {
     return randomstring;
 }
 
-String.prototype.trim = function () {
-    return this.replace(/^\s+|\s+$/g, "");
-};
-
-String.prototype.lpad = function (length, character) {
-    var padding = "",
-        i;
-    for (i = 0; i < length; i++) {
-        padding += character;
-    }
-    return (padding + this).slice(-length);
-};
+if (typeof String.prototype.trim === 'undefined') {
+    String.prototype.trim = function () {
+        return this.replace(/^\s+|\s+$/g, "");
+    };
+}
 
+if (typeof String.prototype.lpad === 'undefined') {
+    String.prototype.lpad = function (length, character) {
+        var padding = "",
+            i;
+        for (i = 0; i < length; i++) {
+            padding += character;
+        }
+        return (padding + this).slice(-length);
+    };
+}
 
 
 /*
index 633de3903b3aa8e40d6aca9186ea86c3842e11eb..ed1b70d7b3448b946cbc29269aad34a261fb2cb6 100644 (file)
@@ -588,13 +588,13 @@ this.httpHandler = function (request, response) {
 
             response.setHeader('X-Generated-By', 'KiwiIRC');
             hash = crypto.createHash('md5').update(touchscreen ? 't' : 'f')
-                                            .update(debug ? 't' : 'f')
-                                            .update(server_set ? 't' : 'f')
-                                            .update(server)
-                                            .update(nick)
-                                            .update(agent)
-                                            .update(JSON.stringify(kiwi.config))
-                                            .digest('base64');
+                .update(debug ? 't' : 'f')
+                .update(server_set ? 't' : 'f')
+                .update(server)
+                .update(nick)
+                .update(agent)
+                .update(JSON.stringify(kiwi.config))
+                .digest('base64');
             if (kiwi.cache.html[hash]) {
                 if (request.headers['if-none-match'] === kiwi.cache.html[hash].hash) {
                     response.statusCode = 304;