From: Jack Allnutt Date: Fri, 18 Nov 2011 13:19:41 +0000 (+0000) Subject: JSLinting X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f93aafe55ed1906e2e127b80b21fbd2519982f61;p=KiwiIRC.git JSLinting --- diff --git a/client/js/front.events.js b/client/js/front.events.js index bbe81c8..05bca87 100644 --- a/client/js/front.events.js +++ b/client/js/front.events.js @@ -123,7 +123,7 @@ kiwi.front.events = { onTopicSetBy: function (e, data) { var when, tab = Tabview.getTab(data.channel); if (tab) { - when = new Date(data.when*1000).toLocaleString(); + when = new Date(data.when * 1000).toLocaleString(); tab.addMsg(null, '', 'Topic set by ' + data.nick + ' at ' + when, 'topic'); } }, @@ -291,7 +291,7 @@ kiwi.front.events = { } else { msg = f(data.attempts) + ' attempt at reconnecting in ' + secs + ' second' + (((secs > 1) || (secs === 0)) ? 's' : '') + '...'; } - + err_box.text(msg); }, /** diff --git a/client/js/front.js b/client/js/front.js index 15b89c9..1e4a2e2 100644 --- a/client/js/front.js +++ b/client/js/front.js @@ -464,20 +464,20 @@ kiwi.front = { * Sort the window list */ sortWindowList: function () { - var win_list = $('#kiwi .windowlist ul'); - var listitems = win_list.children('li').get(); + var win_list = $('#kiwi .windowlist ul'), + listitems = win_list.children('li').get(); listitems.sort(function (a, b) { - if (a == Tabview.getServerTab().tab[0]) { + if (a === Tabview.getServerTab().tab[0]) { return -1; } - if (b == Tabview.getServerTab().tab[0]) { + if (b === Tabview.getServerTab().tab[0]) { return 1; } - var compA = $(a).text().toUpperCase(); - var compB = $(b).text().toUpperCase(); + var compA = $(a).text().toUpperCase(), + compB = $(b).text().toUpperCase(); return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; - }) + }); $.each(listitems, function(idx, itm) { win_list.append(itm); @@ -1540,11 +1540,13 @@ Tabview.getTab = function (name) { var tab; // Make sure we actually have a name - if (typeof name !== 'string') return null; + if (typeof name !== 'string') { + return null; + } // Go through each tabview and pick out the matching one $.each(kiwi.front.tabviews, function (i, item) { - if (item.name.toLowerCase() == name.toLowerCase()) { + if (item.name.toLowerCase() === name.toLowerCase()) { tab = item; return false; } diff --git a/client/js/front.ui.js b/client/js/front.ui.js index 37dbbf6..7a44755 100644 --- a/client/js/front.ui.js +++ b/client/js/front.ui.js @@ -52,7 +52,7 @@ kiwi.front.ui = { var windows, meta, num, msg, data, self; windows = $('#windows'); - if (navigator.appVersion.indexOf("Mac") != -1) { + if (navigator.appVersion.indexOf("Mac") !== -1) { meta = e.ctrlKey; } else { meta = e.altKey; @@ -259,7 +259,7 @@ kiwi.front.ui = { preventRefresh: function () { $(document).keydown(function (e) { // meta + r || F5 - if ((e.metaKey && e.which == 82) || e.which == 116) { + if ((e.metaKey && e.which === 82) || e.which === 116) { e.preventDefault(); e.stopPropagation(); @@ -432,7 +432,7 @@ kiwi.front.ui = { s, current_s, next_s; - b.css({display: 'block', position: 'absolute', height:'100%', width:'100%'}); + b.css({display: 'block', position: 'absolute', height: '100%', width: '100%'}); $('#kiwi').append(b); /** @@ -442,29 +442,29 @@ kiwi.front.ui = { var b = 3, ret = {}; ret.top = el.offset().top; ret.left = el.offset().left; - ret.width = parseInt(el.outerWidth(true), 10) - (b*2); - ret.height = parseInt(el.outerHeight(true), 10) - (b*2); + ret.width = parseInt(el.outerWidth(true), 10) - (b * 2); + ret.height = parseInt(el.outerHeight(true), 10) - (b * 2); return ret; }; s = [ - function(){ + function () { b.animate(bounds($('#kiwi .msginput')), 2000, '', next_s); }, - function(){ + function () { b.animate(bounds($('#kiwi .userlist')), 2000, '', next_s); }, - function(){ + function () { b.animate(bounds($('#panel1')), 2000, '', next_s); }, - function(){ + function () { b.animate(bounds($('#kiwi .cur_topic')), 2000, '', next_s); }, - function(){ + function () { b.animate(bounds($('#kiwi .windowlist')), 2000, '', next_s); } ]; diff --git a/client/js/gateway.js b/client/js/gateway.js index 4295f0e..37fec1a 100644 --- a/client/js/gateway.js +++ b/client/js/gateway.js @@ -238,10 +238,10 @@ kiwi.gateway = { request: request, type: type, target: target, - params: params, + params: params } }; - + kiwi.gateway.sendData(data, callback); }, @@ -349,7 +349,7 @@ kiwi.gateway = { * @param {Function} callback A callback function */ raw: function (data, callback) { - var data = { + data = { method: 'raw', args: { data: data @@ -382,14 +382,14 @@ kiwi.gateway = { * @param {Function} callback A callback function */ kiwi: function (target, data, callback) { - var data = { + data = { method: 'kiwi', args: { target: target, data: data } }; - + kiwi.gateway.sendData(data, callback); - }, + } };