From 81b75086d4ca21d0fe338ae70f4979ab51409ded Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Sun, 4 May 2014 02:33:05 +0200 Subject: [PATCH] Improved rendering speed --- client/css/style.css | 46 ++++++++++++++++++++++++++++++-------------- client/index.html | 46 ++++++++++++++++++++++++++------------------ lib/server.js | 21 +++++++++++--------- 3 files changed, 71 insertions(+), 42 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index 63fe5f86..eb844068 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -11,6 +11,12 @@ h1, h2 { margin: 0; } +ul, +li { + list-style: none; + margin: 0; + padding: 0; +} a { color: #1abc9c; text-decoration: none; @@ -133,6 +139,20 @@ button::-moz-focus-inner { font: 13px "Consolas", monospace; height: 100%; } +#chat form { + bottom: 0; + height: 35px; + position: absolute; + right: 0; + left: 0; +} +#chat form .input { + border: 0; + border-top: 1px solid #bdc3c7; + height: 35px; + padding: 0 10px; + width: 100%; +} #chat .lobby .messages, #chat .query .messages { right: 0; @@ -235,27 +255,25 @@ button::-moz-focus-inner { right: 0; width: 160px; } +#chat .users li { + display: table-row; + text-align: left; +} + #chat .users .user { - display: block; padding: 4px 12px; + text-align: left; + width: 160px; } #chat .count { background: #ecf0f1; color: #aeb6bf; margin-bottom: 4px; +} +#chat .count span { + display: block; padding: 10px 12px; } -#chat .form { - bottom: 0; - height: 35px; - position: absolute; - right: 0; - left: 0; -} -#chat .input { - border: 0; - border-top: 1px solid #bdc3c7; - height: 35px; - padding: 0 10px; - width: 100%; +#chat .count + li .user { + padding-top: 8px } diff --git a/client/index.html b/client/index.html index 41af48da..f80704dd 100644 --- a/client/index.html +++ b/client/index.html @@ -58,51 +58,59 @@ {{#each windows}}
-
-
+
    +
  • -
+ {{partial "messages"}} -
-
+ +
    {{partial "users"}} -
+
-
- + +
{{/each}} diff --git a/lib/server.js b/lib/server.js index edd1709d..453a2402 100644 --- a/lib/server.js +++ b/lib/server.js @@ -138,15 +138,18 @@ function input(data) { user = client.me; client.send(args[1], text); } - var msg = new Msg({ - from: user, - text: text, - }); - chan.messages.push(msg) - sockets.emit("msg", { - id: chan.id, - msg: msg, - }); + var chan = _.findWhere(network.channels, {name: args[1]}); + if (typeof chan !== "undefined") { + var msg = new Msg({ + from: user, + text: text, + }); + chan.messages.push(msg) + sockets.emit("msg", { + id: chan.id, + msg: msg, + }); + } break; case "notice":