From caec592a719c16d2b6ab4f3178b098492efb833a Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Mon, 21 Apr 2014 17:08:57 +0200 Subject: [PATCH] Added highlighted messages --- client/css/style.css | 11 ++++++++++- lib/server.js | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index 6c2fb68..8bcdcb0 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -196,7 +196,7 @@ h2 { padding: 0 8px; } #chat .messages { - border-left: 8px solid #f7f7f9; + box-shadow: inset 8px 0 0 #f7f7f9; bottom: 30px; left: 0; overflow-y: auto; @@ -208,6 +208,7 @@ h2 { z-index: 0; } #chat .message { + border-left: 8px solid #f7f7f9; line-height: 1.4em; padding: 0 8px; } @@ -229,6 +230,14 @@ h2 { #chat .message.error { color: #999; } +#chat .message.highlight { + background: #fcf8e3; + border-left-color: #faebcc; + color: #8a6d3b; +} +#chat .message.highlight .type { + display: none; +} @media screen and (max-device-width: 480px) { #wrap { diff --git a/lib/server.js b/lib/server.js index 1433812..013b3a6 100644 --- a/lib/server.js +++ b/lib/server.js @@ -269,9 +269,16 @@ function event(event, data) { case "message": var chan = channels.findWhere({name: data[0].to}) || channels.add({type: "query", name: data[0].from}); + var type = ""; + var text = data[0].message; + var network = this; + text.split(" ").forEach(function(w) { + if (w == network.get("client").me) type = "highlight"; + }); chan.get("messages").add({ + type: type, from: data[0].from, - text: data[0].message + text: text, }); break;