From f088b726fac027688f426708937644e5fd4a9809 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Sat, 22 Mar 2014 21:37:09 +0100 Subject: [PATCH] Smaller event footprint --- client/css/style.css | 10 +++++++--- client/index.html | 4 ++-- lib/models.js | 2 +- lib/server.js | 18 ++++++++++-------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index 84acfddb..3632c799 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -194,10 +194,14 @@ h2 { color: #f00; } #chat .message .text { - color: #999; + color: inherit; } -#chat .message.normal .text { - color: #000; +#chat .message.join, +#chat .message.part, +#chat .message.nick, +#chat .message.quit, +#chat .message.notice { + color: #999; } @media screen and (max-width: 480px) { diff --git a/client/index.html b/client/index.html index 9e81d0f3..6456cbb6 100644 --- a/client/index.html +++ b/client/index.html @@ -57,7 +57,7 @@ diff --git a/lib/models.js b/lib/models.js index dae9f348..a2586129 100644 --- a/lib/models.js +++ b/lib/models.js @@ -48,7 +48,7 @@ models.Message = Backbone.Model.extend({ time: "", user: "", text: "", - type: "normal" + type: "" }, initialize: function() { this.set("time", moment().format("HH:mm")); diff --git a/lib/server.js b/lib/server.js index 6829d138..694fe68c 100644 --- a/lib/server.js +++ b/lib/server.js @@ -24,8 +24,8 @@ Server.prototype.listen = function(port) { this.sockets = io.listen(http, {log: false}).sockets; this.sockets.on("connection", function(socket) { - socket.emit("NETWORKS", self.networks); socket.on("input", function(input) { handleInput.call(self, input); }); + socket.emit("NETWORKS", self.networks); }); if (config.autoConnect) { @@ -264,7 +264,7 @@ function handleEvent(argv) { if (typeof user !== "undefined") { mode = user.get("mode"); } - + channel.get("messages").add( new models.Message({ mode: mode, @@ -278,7 +278,7 @@ function handleEvent(argv) { var from = argv.nick ? argv.nick : "-!-"; channels.first().get("messages").add(new models.Message({ user: from, - text: "notice: " + argv.args[1], + text: argv.args[1], type: "notice" })); break; @@ -308,7 +308,7 @@ function handleEvent(argv) { messages.add( new models.Message({ user: argv.nick, - text: "join", + text: channel.get("name"), type: "join" }) ); @@ -330,7 +330,7 @@ function handleEvent(argv) { messages.add( new models.Message({ user: argv.nick, - text: "part", + text: channel.get("name"), type: "part" }) ); @@ -356,7 +356,7 @@ function handleEvent(argv) { messages.add(new models.Message({ user: argv.nick, - text: "changed name to " + argv.args[0], + text: argv.args[0], type: "nick" })); }); @@ -396,7 +396,6 @@ function handleEvent(argv) { case "QUIT": var message = new models.Message({ user: argv.nick, - text: "quit", type: "quit" }); @@ -420,7 +419,7 @@ function handleEvent(argv) { messages.add( new models.Message({ user: argv.nick, - text: "sets mode: " + argv.args[1] + " " + target, + text: argv.args[1] + " " + target, type: "mode" }) ); @@ -556,4 +555,7 @@ function handleEvent(argv) { break; } + + // Debug + console.log(argv); }