From 77484ccdf3ea41eb660c01cc50877dbf50566507 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:51:10 +0100 Subject: [PATCH 1/8] Remove duplicate definition of path variable --- src/command-line/add.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command-line/add.js b/src/command-line/add.js index 82596b0..559b6ba 100644 --- a/src/command-line/add.js +++ b/src/command-line/add.js @@ -3,14 +3,15 @@ var bcrypt = require("bcrypt"); var fs = require("fs"); var program = require("commander"); var mkdirp = require("mkdirp"); -var Helper = require("../helper"); + +const HOME = process.env.HOME + "/.shout"; program .command("add ") .description("Add a new user") .action(function(name) { + var path = Helper.resolveHomePath("users"); try { - var path = Helper.resolveHomePath("users"); mkdirp.sync(path); } catch (e) { console.log(""); @@ -20,7 +21,6 @@ program return; } try { - var path = Helper.resolveHomePath("users"); var test = path + "/.test"; fs.mkdirSync(test); fs.rmdirSync(test); From f752d55b37d8096210b0224d850f5b03aea1b051 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:16:07 +0100 Subject: [PATCH 2/8] Add missing semicolon --- src/command-line/start.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command-line/start.js b/src/command-line/start.js index be9bf03..2c97f4a 100644 --- a/src/command-line/start.js +++ b/src/command-line/start.js @@ -13,7 +13,7 @@ program if (!config.public && !users.length) { console.log(""); console.log("No users found!"); - console.log("Create a new user with 'shout add '.") + console.log("Create a new user with 'shout add '."); console.log(""); } else { var host = program.host || process.env.IP || config.host; From f015e4bfd4de516b3cd2b2f8c2a449186b1a8109 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:18:42 +0100 Subject: [PATCH 3/8] Add missing semicolons --- src/client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.js b/src/client.js index fd7fe6d..19717da 100644 --- a/src/client.js +++ b/src/client.js @@ -196,7 +196,7 @@ Client.prototype.input = function(data) { console.log(path + ": " + e); } }); -} +}; Client.prototype.more = function(data) { var client = this; @@ -211,7 +211,7 @@ Client.prototype.more = function(data) { chan: chan.id, messages: messages }); -} +}; Client.prototype.quit = function() { this.networks.forEach(function(network) { From 9b2095fcbcb359840d746601acb9d960c3b9ba75 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:19:07 +0100 Subject: [PATCH 4/8] Fix scope error in ClientManager.loadUser --- src/clientManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clientManager.js b/src/clientManager.js index f863ad0..1197724 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -44,11 +44,11 @@ ClientManager.prototype.loadUser = function(name) { "utf-8" ); json = JSON.parse(json); + return json; } catch(e) { console.log(e); return; } - return json; }; ClientManager.prototype.getUsers = function() { From fe6e592c20af8e3e6d71db9fe9302776c9ea21e4 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:23:36 +0100 Subject: [PATCH 5/8] Add missing semicolon --- client/js/shout.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/js/shout.js b/client/js/shout.js index 5f32483..aed9212 100644 --- a/client/js/shout.js +++ b/client/js/shout.js @@ -143,7 +143,7 @@ $(function() { }) ); sidebar.find(".chan") - .sort(function(a, b) { return $(a).data("id") - $(b).data("id") }) + .sort(function(a, b) { return $(a).data("id") - $(b).data("id"); }) .last() .trigger("click"); }); @@ -464,7 +464,7 @@ $(function() { self.focus(); return false; } - }) + }); }); windows.on("click", ".input", function() { @@ -472,7 +472,7 @@ $(function() { }); forms.on("submit", "form", function(e) { - e.preventDefault() + e.preventDefault(); var event = "auth"; var form = $(this); if (form.closest(".window").attr("id") == "connect") { From 4a3bea1928edb88cd9c1ab9d1e0c533f82663bbf Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:36:59 +0100 Subject: [PATCH 6/8] Use strict equality checking --- client/js/shout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/js/shout.js b/client/js/shout.js index aed9212..c0104a1 100644 --- a/client/js/shout.js +++ b/client/js/shout.js @@ -330,7 +330,7 @@ $(function() { .data("count", "") .empty(); - if (sidebar.find(".highlight").length == 0) { + if (sidebar.find(".highlight").length === 0) { favico.badge(""); } @@ -542,7 +542,7 @@ $(function() { document.addEventListener( "visibilitychange", function() { - if (sidebar.find(".highlight").length == 0) { + if (sidebar.find(".highlight").length === 0) { favico.badge(""); } } From 601cfc380f7d925828633dcca0762feb8bcd85d3 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:37:10 +0100 Subject: [PATCH 7/8] Don't use bare fractions --- client/js/shout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/js/shout.js b/client/js/shout.js index c0104a1..afe135f 100644 --- a/client/js/shout.js +++ b/client/js/shout.js @@ -374,7 +374,7 @@ $(function() { }); chan.css({ transition: "none", - opacity: .4 + opacity: 0.4 }); return false; }); From f101efbd35bd78236b19dcf5f73cde45681f029f Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 13 Sep 2014 18:38:15 +0100 Subject: [PATCH 8/8] Remove duplicate definition of i --- client/js/shout.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/js/shout.js b/client/js/shout.js index afe135f..4e0166b 100644 --- a/client/js/shout.js +++ b/client/js/shout.js @@ -507,13 +507,11 @@ $(function() { var direction = keys.split("+").pop(); switch (direction) { case "up": - var i = Math.max(0, index - 1); - channels.eq(i).click(); + channels.eq(Math.max(0, index - 1)).click(); break; case "down": - var i = Math.min(channels.length, index + 1); - channels.eq(i).click(); + channels.eq(Math.min(channels.length, index + 1)).click(); break; } });