Rename message property
This commit is contained in:
parent
9e860b14d7
commit
6366fd38a2
@ -114,7 +114,7 @@
|
||||
<div class="time">{{time}}</div>
|
||||
<div class="user">{{from}}</div>
|
||||
<div class="type">{{type}}</div>
|
||||
<div class="text">{{message}}</div>
|
||||
<div class="text">{{text}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</script>
|
||||
|
@ -28,10 +28,10 @@ models.Users = Backbone.Collection.extend({
|
||||
|
||||
models.Message = Backbone.Model.extend({
|
||||
defaults: {
|
||||
type: "",
|
||||
time: "",
|
||||
from: "-!-",
|
||||
message: "",
|
||||
type: "",
|
||||
time: "",
|
||||
from: "-!-",
|
||||
text: "",
|
||||
},
|
||||
initialize: function() {
|
||||
this.set("time", require("moment")().format("HH:mm"));
|
||||
|
@ -121,7 +121,7 @@ function input(json) {
|
||||
}
|
||||
channel.get("messages").add({
|
||||
from: user,
|
||||
message: message,
|
||||
text: message,
|
||||
});
|
||||
break;
|
||||
|
||||
@ -244,7 +244,7 @@ function event(event, data) {
|
||||
|
||||
chan.get("messages").add({
|
||||
from: data[0].nick,
|
||||
message: data[0].client,
|
||||
text: data[0].client,
|
||||
type: "kick",
|
||||
});
|
||||
break;
|
||||
@ -254,7 +254,7 @@ function event(event, data) {
|
||||
if (typeof chan !== "undefined") {
|
||||
chan.get("messages").add({
|
||||
from: data[0].nick,
|
||||
message: data[0].mode + " " + data[0].client,
|
||||
text: data[0].mode + " " + data[0].client,
|
||||
type: "mode",
|
||||
});
|
||||
}
|
||||
@ -263,7 +263,7 @@ function event(event, data) {
|
||||
case "motd":
|
||||
var messages = data[0].motd;
|
||||
messages.forEach(function(msg) {
|
||||
channels.first().get("messages").add({message: msg});
|
||||
channels.first().get("messages").add({text: msg});
|
||||
});
|
||||
break;
|
||||
|
||||
@ -271,7 +271,7 @@ function event(event, data) {
|
||||
var chan = channels.findWhere({name: data[0].to}) || channels.add({type: "query", name: data[0].from});
|
||||
chan.get("messages").add({
|
||||
from: data[0].from,
|
||||
message: data[0].message
|
||||
text: data[0].message
|
||||
});
|
||||
break;
|
||||
|
||||
@ -288,7 +288,7 @@ function event(event, data) {
|
||||
case "nick":
|
||||
if (data[0].new == this.get("client").me) {
|
||||
channels.first().get("messages").add({
|
||||
message: "You're now known as " + data[0]["new"],
|
||||
text: "You're now known as " + data[0]["new"],
|
||||
});
|
||||
}
|
||||
channels.each(function(chan) {
|
||||
@ -303,17 +303,21 @@ function event(event, data) {
|
||||
|
||||
chan.get("messages").add({
|
||||
from: data[0].nick,
|
||||
message: data[0]["new"],
|
||||
text: data[0]["new"],
|
||||
type: "nick",
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "notice":
|
||||
case "notice":
|
||||
if (data[0].to = "*") {
|
||||
data[0].from = "-!-";
|
||||
}
|
||||
channels.first().get("messages").add(data[0]);
|
||||
channels.first().get("messages").add({
|
||||
type: "notice",
|
||||
from: data[0].from,
|
||||
text: data[0].message,
|
||||
});
|
||||
break;
|
||||
|
||||
case "part":
|
||||
@ -351,15 +355,15 @@ function event(event, data) {
|
||||
var from = data[0].nick || chan.get("name");
|
||||
chan.get("messages").add({
|
||||
from: from,
|
||||
message: data[0].topic,
|
||||
text: data[0].topic,
|
||||
type: "topic",
|
||||
});
|
||||
break;
|
||||
|
||||
case "welcome":
|
||||
channels.first().get("messages").add([
|
||||
{message: "You're now connected to " + this.get("host")},
|
||||
{message: "You're now known as " + data[0]}
|
||||
{text: "You're now connected to " + this.get("host")},
|
||||
{text: "You're now known as " + data[0]}
|
||||
]);
|
||||
break;
|
||||
|
||||
@ -367,7 +371,7 @@ function event(event, data) {
|
||||
if (data[1] == null) {
|
||||
channels.first().get("messages").add({
|
||||
type: "error",
|
||||
message: data[0]
|
||||
text: data[0]
|
||||
});
|
||||
break;
|
||||
}
|
||||
@ -379,7 +383,7 @@ function event(event, data) {
|
||||
for (var k in data[1]) {
|
||||
if (i++ == 5) break;
|
||||
chan.get("messages").add({
|
||||
message: k + ": " + data[1][k]
|
||||
text: k + ": " + data[1][k]
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user