diff --git a/client/js/shout.js b/client/js/shout.js index 5f32483..4e0166b 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"); }); @@ -330,7 +330,7 @@ $(function() { .data("count", "") .empty(); - if (sidebar.find(".highlight").length == 0) { + if (sidebar.find(".highlight").length === 0) { favico.badge(""); } @@ -374,7 +374,7 @@ $(function() { }); chan.css({ transition: "none", - opacity: .4 + opacity: 0.4 }); return false; }); @@ -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") { @@ -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; } }); @@ -542,7 +540,7 @@ $(function() { document.addEventListener( "visibilitychange", function() { - if (sidebar.find(".highlight").length == 0) { + if (sidebar.find(".highlight").length === 0) { favico.badge(""); } } 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) { 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() { 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); 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;