This commit is contained in:
Mattias Erming 2014-09-14 11:49:42 -07:00
parent 3cf870bc06
commit 66785be200
11 changed files with 44 additions and 42 deletions

View file

@ -454,10 +454,6 @@ button {
height: 100%;
width: 100%;
}
#chat .from_me .text {
color: #999;
}
#chat .msg {
display: table-row;
word-wrap: break-word;
@ -482,7 +478,6 @@ button {
display: table-cell;
padding: 3px 0;
vertical-align: top;
}
#chat .time {
color: #d0dbe2;
@ -510,6 +505,9 @@ button {
#chat .text a {
word-break: break-all;
}
#chat .self .text {
color: #999;
}
#chat .join .type,
#chat .part .type,
#chat .mode .type,

View file

@ -54,28 +54,33 @@ templates['chat'] = template({"1":function(depth0,helpers,partials,data) {
templates['msg'] = template({"1":function(depth0,helpers,partials,data) {
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class=\"msg "
+ escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper)))
+ "\">\n <span class=\"time\">\n "
+ " ";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.self : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += "\">\n <span class=\"time\">\n "
+ escapeExpression(((helpers.tz || (depth0 && depth0.tz) || helperMissing).call(depth0, (depth0 != null ? depth0.time : depth0), {"name":"tz","hash":{},"data":data})))
+ "\n </span>\n <span class=\"from\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.from : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.from : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += " </span>\n <span class=\"text\">\n <em class=\"type\">"
+ escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper)))
+ "</em>\n";
stack1 = ((helpers.equal || (depth0 && depth0.equal) || helperMissing).call(depth0, (depth0 != null ? depth0.type : depth0), "image", {"name":"equal","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data}));
stack1 = ((helpers.equal || (depth0 && depth0.equal) || helperMissing).call(depth0, (depth0 != null ? depth0.type : depth0), "image", {"name":"equal","hash":{},"fn":this.program(6, data),"inverse":this.program(8, data),"data":data}));
if (stack1 != null) { buffer += stack1; }
return buffer + " </span>\n</div>\n";
},"2":function(depth0,helpers,partials,data) {
return "self";
},"4":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <button class=\"user\">"
+ escapeExpression(((helper = (helper = helpers.from || (depth0 != null ? depth0.from : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"from","hash":{},"data":data}) : helper)))
+ "</button>\n";
},"4":function(depth0,helpers,partials,data) {
},"6":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <img src=\""
+ escapeExpression(((helper = (helper = helpers.text || (depth0 != null ? depth0.text : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"text","hash":{},"data":data}) : helper)))
+ "\" class=\"image\">\n";
},"6":function(depth0,helpers,partials,data) {
},"8":function(depth0,helpers,partials,data) {
var stack1, helperMissing=helpers.helperMissing, buffer = " ";
stack1 = ((helpers.uri || (depth0 && depth0.uri) || helperMissing).call(depth0, (depth0 != null ? depth0.text : depth0), {"name":"uri","hash":{},"data":data}));
if (stack1 != null) { buffer += stack1; }

View file

@ -1,9 +1,5 @@
{{#each messages}}
{{#if from_me}}
<div class="msg {{type}} from_me">
{{else}}
<div class="msg {{type}}">
{{/if}}
<div class="msg {{type}} {{#if self}}self{{/if}}">
<span class="time">
{{tz time}}
</span>

View file

@ -26,6 +26,6 @@ function Msg(attr) {
text: "",
time: moment().utc().format("HH:mm:ss"),
type: Msg.Type.MESSAGE,
from_me: false,
self: false
}, attr));
}

View file

@ -25,16 +25,16 @@ module.exports = function(irc, network) {
if (typeof chan === "undefined") {
return;
}
var from_me = false
if (data.from.toLowerCase() == irc.me.toLowerCase() ) {
from_me = true
var self = false;
if (data.from.toLowerCase() == irc.me.toLowerCase()) {
self = true;
}
fetchImage(image, function(name) {
var msg = new Msg({
type: Msg.Type.IMAGE,
from: data.from,
text: "thumbs/" + name,
from_me = from_me
self: self
});
chan.messages.push(msg);
client.emit("msg", {

View file

@ -17,10 +17,6 @@ module.exports = function(irc, network) {
chan: chan
});
}
var from_me = false
if (data.from.toLowerCase() == irc.me.toLowerCase() ) {
from_me = true
}
var users = chan.users;
users.push(new User({name: data.nick}));
chan.sortUsers();
@ -28,10 +24,14 @@ module.exports = function(irc, network) {
chan: chan.id,
users: users
});
var self = false;
if (data.nick.toLowerCase() == irc.me.toLowerCase()) {
self = true;
}
var msg = new Msg({
from: data.nick,
type: Msg.Type.JOIN,
from_me: from_me
self: self
});
chan.messages.push(msg);
client.emit("msg", {

View file

@ -17,15 +17,15 @@ module.exports = function(irc, network) {
chan: chan.id,
users: chan.users
});
var from_me = false
if (data.nick.toLowerCase() == irc.me.toLowerCase() ) {
from_me = true
var self = false;
if (data.nick.toLowerCase() == irc.me.toLowerCase()) {
self = true;
}
var msg = new Msg({
type: Msg.Type.KICK,
from: data.nick,
text: data.client,
from_me: from_me
self: self
});
chan.messages.push(msg);
client.emit("msg", {

View file

@ -30,15 +30,15 @@ module.exports = function(irc, network) {
text.split(" ").forEach(function(w) {
if (w.indexOf(irc.me) === 0) type += " highlight";
});
var from_me = false
if (data.from.toLowerCase() == irc.me.toLowerCase() ) {
from_me = true
var self = false;
if (data.from.toLowerCase() == irc.me.toLowerCase()) {
self = true;
}
var msg = new Msg({
type: type || Msg.Type.MESSAGE,
from: data.from,
text: text,
from_me: from_me
self: self
});
chan.messages.push(msg);
client.emit("msg", {

View file

@ -13,15 +13,15 @@ module.exports = function(irc, network) {
if (nick.indexOf(".") !== -1) {
nick = data.target;
}
var from_me = false
if (nick.toLowerCase() == irc.me.toLowerCase() ) {
from_me = true
var self = false;
if (nick.toLowerCase() == irc.me.toLowerCase()) {
self = true;
}
var msg = new Msg({
type: Msg.Type.MODE,
from: nick,
text: data.mode + " " + data.client,
from_me: from_me
self: self
});
chan.messages.push(msg);
client.emit("msg", {

View file

@ -3,6 +3,7 @@ var Msg = require("../../models/msg");
module.exports = function(irc, network) {
var client = this;
var self = false;
irc.on("nick", function(data) {
if (data["new"] == irc.me) {
var lobby = network.channels[0];
@ -14,6 +15,7 @@ module.exports = function(irc, network) {
chan: lobby.id,
msg: msg
});
self = true;
}
network.channels.forEach(function(chan) {
var user = _.findWhere(chan.users, {name: data.nick});
@ -29,7 +31,8 @@ module.exports = function(irc, network) {
var msg = new Msg({
type: Msg.Type.NICK,
from: data.nick,
text: data["new"]
text: data["new"],
self: self
});
chan.messages.push(msg);
client.emit("msg", {

View file

@ -9,15 +9,15 @@ module.exports = function(irc, network) {
return;
}
var from = data.nick || chan.name;
var from_me = false
if (data.nick.toLowerCase() == irc.me.toLowerCase() ) {
from_me = true
var self = false;
if (from.toLowerCase() == irc.me.toLowerCase()) {
self = true;
}
var msg = new Msg({
type: Msg.Type.TOPIC,
from: from,
text: data.topic,
from_me: from_me,
self: self
});
chan.messages.push(msg);
client.emit("msg", {