Remove unused var, satisfy linter rules, simplify calls

This commit is contained in:
realies 2017-10-03 23:59:19 +03:00
parent 3890aaad6b
commit 3244ec91e8
2 changed files with 11 additions and 19 deletions

View File

@ -188,17 +188,8 @@ $(function() {
const args = text.substr(1).split(" "); const args = text.substr(1).split(" ");
const cmd = args.shift().toLowerCase(); const cmd = args.shift().toLowerCase();
if (typeof utils.inputCommands[cmd] === "function") { if (typeof utils.inputCommands[cmd] === "function") {
if (cmd === "join") { if (utils.inputCommands[cmd](args)) {
const channel = args.shift(); return;
if (channel !== "") {
if (utils.inputCommands[cmd](channel)) {
return;
}
}
} else {
if (utils.inputCommands[cmd]()) {
return;
}
} }
} }
} }

View File

@ -1,14 +1,13 @@
"use strict"; "use strict";
const $ = require("jquery"); const $ = require("jquery");
const chat = $("#chat");
const input = $("#input"); const input = $("#input");
var serverHash = -1; var serverHash = -1;
var lastMessageId = -1; var lastMessageId = -1;
module.exports = { module.exports = {
inputCommands: { collapse, expand, join }, inputCommands: {collapse, expand, join},
findCurrentNetworkChan, findCurrentNetworkChan,
serverHash, serverHash,
lastMessageId, lastMessageId,
@ -54,12 +53,14 @@ function expand() {
return true; return true;
} }
function join(channel) { function join(args) {
var chan = findCurrentNetworkChan(channel); const channel = args[0];
if (channel) {
if (chan.length) { const chan = findCurrentNetworkChan(channel);
chan.click(); if (chan.length) {
return true; chan.click();
return true;
}
} }
} }