From cd81360ae961cb352395a0eb31b4ee80e0493f2a Mon Sep 17 00:00:00 2001 From: Darren Date: Thu, 22 Sep 2011 23:21:48 +0100 Subject: [PATCH] Merge --- js/front.js | 13 +++++++++---- js/gateway.js | 3 +-- js/util.js | 27 +++++++++++++++------------ node/app.js | 2 ++ node/client/index.html.jade | 4 ++-- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/js/front.js b/js/front.js index 2f7160f..93d296c 100644 --- a/js/front.js +++ b/js/front.js @@ -274,8 +274,9 @@ kiwi.front = { // Update msg if it's been changed by any plugins msg = plugin_event.command.toString(); - console.log("running " + msg); + if (msg.substring(0, 1) === '/') { + console.log("running " + msg); parts = msg.split(' '); switch (parts[0].toLowerCase()) { case '/j': @@ -536,7 +537,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 +578,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 +591,7 @@ kiwi.front = { case 5: return 'Fifth'; case 6: return 'Sixth'; case 7: return 'Seventh'; - default: return 'Next' + default: return 'Next'; } }; diff --git a/js/gateway.js b/js/gateway.js index f181fcb..65782f5 100644 --- a/js/gateway.js +++ b/js/gateway.js @@ -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 diff --git a/js/util.js b/js/util.js index 1a3e4bc..e7c07c2 100644 --- a/js/util.js +++ b/js/util.js @@ -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); + }; +} /* diff --git a/node/app.js b/node/app.js index 0bf3781..cf024c0 100644 --- a/node/app.js +++ b/node/app.js @@ -602,6 +602,7 @@ this.httpHandler = function (request, response) { response.statusCode = 304; } else { response.setHeader('Etag', kiwi.cache.html[hash].hash); + response.setHeader('Content-type', 'text/html'); response.write(kiwi.cache.html[hash].html); } response.end(); @@ -616,6 +617,7 @@ this.httpHandler = function (request, response) { response.statusCode = 304; } else { response.setHeader('Etag', hash2); + response.setHeader('Content-type', 'text/html'); response.write(html); } } else { diff --git a/node/client/index.html.jade b/node/client/index.html.jade index e7eb904..49b597f 100644 --- a/node/client/index.html.jade +++ b/node/client/index.html.jade @@ -1,5 +1,5 @@ !!! 5 -html(xmlns="http://www.w3.org/1999/xhtml", lang="en-gb") +html(lang="en-gb") head meta(http-equiv="Content-Type", content="text/html; charset=utf-8") @@ -197,4 +197,4 @@ html(xmlns="http://www.w3.org/1999/xhtml", lang="en-gb") | | Message | Info - | \ No newline at end of file + | -- 2.25.1