Move commands into constants module

This commit is contained in:
Alistair McKinlay 2017-04-18 08:42:26 +01:00 committed by Alistair McKinlay
parent 52814113a9
commit 2e286849fc
2 changed files with 39 additions and 33 deletions

37
client/js/constants.js Normal file
View file

@ -0,0 +1,37 @@
"use strict";
const commands = [
"/away",
"/back",
"/banlist",
"/close",
"/connect",
"/deop",
"/devoice",
"/disconnect",
"/invite",
"/join",
"/kick",
"/leave",
"/me",
"/mode",
"/msg",
"/nick",
"/notice",
"/op",
"/part",
"/query",
"/quit",
"/raw",
"/say",
"/send",
"/server",
"/slap",
"/topic",
"/voice",
"/whois"
];
module.exports = {
commands: commands
};

View file

@ -15,40 +15,9 @@ const helpers_roundBadgeNumber = require("./libs/handlebars/roundBadgeNumber");
const slideoutMenu = require("./libs/slideout");
const templates = require("../views");
const socket = require("./socket");
const constants = require("./constants");
$(function() {
var commands = [
"/away",
"/back",
"/banlist",
"/close",
"/connect",
"/deop",
"/devoice",
"/disconnect",
"/invite",
"/join",
"/kick",
"/leave",
"/me",
"/mode",
"/msg",
"/nick",
"/notice",
"/op",
"/part",
"/query",
"/quit",
"/raw",
"/say",
"/send",
"/server",
"/slap",
"/topic",
"/voice",
"/whois"
];
var sidebar = $("#sidebar, #footer");
var chat = $("#chat");
@ -1422,7 +1391,7 @@ $(function() {
}
function complete(word) {
var words = commands.slice();
var words = constants.commands.slice();
var users = chat.find(".active").find(".users");
var nicks = users.data("nicks");