Added highlighted messages

This commit is contained in:
Mattias Erming 2014-04-21 17:08:57 +02:00
parent a458ad24b3
commit caec592a71
2 changed files with 18 additions and 2 deletions

View File

@ -196,7 +196,7 @@ h2 {
padding: 0 8px; padding: 0 8px;
} }
#chat .messages { #chat .messages {
border-left: 8px solid #f7f7f9; box-shadow: inset 8px 0 0 #f7f7f9;
bottom: 30px; bottom: 30px;
left: 0; left: 0;
overflow-y: auto; overflow-y: auto;
@ -208,6 +208,7 @@ h2 {
z-index: 0; z-index: 0;
} }
#chat .message { #chat .message {
border-left: 8px solid #f7f7f9;
line-height: 1.4em; line-height: 1.4em;
padding: 0 8px; padding: 0 8px;
} }
@ -229,6 +230,14 @@ h2 {
#chat .message.error { #chat .message.error {
color: #999; 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) { @media screen and (max-device-width: 480px) {
#wrap { #wrap {

View File

@ -269,9 +269,16 @@ function event(event, data) {
case "message": case "message":
var chan = channels.findWhere({name: data[0].to}) || channels.add({type: "query", name: data[0].from}); 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({ chan.get("messages").add({
type: type,
from: data[0].from, from: data[0].from,
text: data[0].message text: text,
}); });
break; break;