Merge pull request #126 from yuvipanda/code-cleanup-1

Minor code cleanup
This commit is contained in:
Mattias Erming 2014-09-13 23:25:19 +02:00
commit edc572b0f8
5 changed files with 15 additions and 17 deletions

View File

@ -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("");
}
}

View File

@ -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) {

View File

@ -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() {

View File

@ -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 <name>")
.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);

View File

@ -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 <name>'.")
console.log("Create a new user with 'shout add <name>'.");
console.log("");
} else {
var host = program.host || process.env.IP || config.host;