Move actions to templates
This commit is contained in:
parent
1e8ca51d47
commit
2c8c84aec5
@ -201,18 +201,7 @@ $(function() {
|
|||||||
"topic",
|
"topic",
|
||||||
"action",
|
"action",
|
||||||
].indexOf(type) !== -1) {
|
].indexOf(type) !== -1) {
|
||||||
switch (type) {
|
data.msg.template = "actions/" + type;
|
||||||
case "invite": data.msg.formattedAction = "invited " + data.msg.target + " to"; break;
|
|
||||||
case "join": data.msg.formattedAction = "has joined the channel"; break;
|
|
||||||
case "mode": data.msg.formattedAction = "sets mode"; break;
|
|
||||||
case "kick": data.msg.formattedAction = "has kicked"; break;
|
|
||||||
case "nick": data.msg.formattedAction = "is now known as"; break;
|
|
||||||
case "part": data.msg.formattedAction = "has left the channel"; break;
|
|
||||||
case "quit": data.msg.formattedAction = "has quit"; break;
|
|
||||||
case "topic": data.msg.formattedAction = "has changed the topic to:"; break;
|
|
||||||
default: data.msg.formattedAction = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
msg = $(render("msg_action", data.msg));
|
msg = $(render("msg_action", data.msg));
|
||||||
} else {
|
} else {
|
||||||
msg = $(render("msg", data.msg));
|
msg = $(render("msg", data.msg));
|
||||||
|
2
client/views/actions/action.tpl
Normal file
2
client/views/actions/action.tpl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
{{{parse text}}}
|
5
client/views/actions/invite.tpl
Normal file
5
client/views/actions/invite.tpl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<a href="#" class="user">{{from}}</a>
|
||||||
|
invited
|
||||||
|
<a href="#" class="user">{{target}}</a>
|
||||||
|
to
|
||||||
|
{{{parse text}}}
|
3
client/views/actions/join.tpl
Normal file
3
client/views/actions/join.tpl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
<i class="hostmask">({{hostmask}})</i>
|
||||||
|
has joined the channel
|
6
client/views/actions/kick.tpl
Normal file
6
client/views/actions/kick.tpl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
has kicked
|
||||||
|
<a href="#" class="user">{{target}}</a>
|
||||||
|
{{#if text}}
|
||||||
|
<i class="part-reason">({{{parse text}}})</i>
|
||||||
|
{{/if}}
|
3
client/views/actions/mode.tpl
Normal file
3
client/views/actions/mode.tpl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
sets mode
|
||||||
|
{{{parse text}}}
|
3
client/views/actions/nick.tpl
Normal file
3
client/views/actions/nick.tpl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
is now known as
|
||||||
|
<a href="#" class="user">{{mode}}{{text}}</a>
|
6
client/views/actions/part.tpl
Normal file
6
client/views/actions/part.tpl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
<i class="hostmask">({{hostmask}})</i>
|
||||||
|
has left the channel
|
||||||
|
{{#if text}}
|
||||||
|
<i class="part-reason">({{{parse text}}})</i>
|
||||||
|
{{/if}}
|
6
client/views/actions/quit.tpl
Normal file
6
client/views/actions/quit.tpl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
<i class="hostmask">({{hostmask}})</i>
|
||||||
|
has quit
|
||||||
|
{{#if text}}
|
||||||
|
<i class="quit-reason">({{{parse text}}})</i>
|
||||||
|
{{/if}}
|
8
client/views/actions/topic.tpl
Normal file
8
client/views/actions/topic.tpl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{{#if isSetByChan}}
|
||||||
|
The topic is:
|
||||||
|
{{else}}
|
||||||
|
<a href="#" class="user">{{mode}}{{from}}</a>
|
||||||
|
has changed the topic to:
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<span class="new-topic">{{{parse text}}}</span>
|
@ -4,8 +4,6 @@
|
|||||||
</span>
|
</span>
|
||||||
<span class="from"></span>
|
<span class="from"></span>
|
||||||
<span class="text">
|
<span class="text">
|
||||||
<a href="#" class="user">{{mode}}{{from}}</a>
|
{{partial template}}
|
||||||
{{formattedAction}}
|
|
||||||
{{{parse text}}}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,6 +29,7 @@ module.exports = function(irc, network) {
|
|||||||
}
|
}
|
||||||
var msg = new Msg({
|
var msg = new Msg({
|
||||||
from: data.nick,
|
from: data.nick,
|
||||||
|
hostmask: data.hostmask.username + "@" + data.hostmask.hostname,
|
||||||
type: Msg.Type.JOIN,
|
type: Msg.Type.JOIN,
|
||||||
self: self
|
self: self
|
||||||
});
|
});
|
||||||
|
@ -26,15 +26,12 @@ module.exports = function(irc, network) {
|
|||||||
if (data.nick.toLowerCase() === irc.me.toLowerCase()) {
|
if (data.nick.toLowerCase() === irc.me.toLowerCase()) {
|
||||||
self = true;
|
self = true;
|
||||||
}
|
}
|
||||||
var reason = data.message || "";
|
|
||||||
if (reason.length > 0) {
|
|
||||||
reason = " (" + reason + ")";
|
|
||||||
}
|
|
||||||
var msg = new Msg({
|
var msg = new Msg({
|
||||||
type: Msg.Type.KICK,
|
type: Msg.Type.KICK,
|
||||||
mode: mode,
|
mode: mode,
|
||||||
from: from,
|
from: from,
|
||||||
text: data.client + reason,
|
target: data.client,
|
||||||
|
text: data.message || "",
|
||||||
self: self
|
self: self
|
||||||
});
|
});
|
||||||
chan.messages.push(msg);
|
chan.messages.push(msg);
|
||||||
|
@ -21,14 +21,11 @@ module.exports = function(irc, network) {
|
|||||||
client.emit("users", {
|
client.emit("users", {
|
||||||
chan: chan.id
|
chan: chan.id
|
||||||
});
|
});
|
||||||
var reason = data.message || "";
|
|
||||||
if (reason.length > 0) {
|
|
||||||
reason = "(" + reason + ")";
|
|
||||||
}
|
|
||||||
var msg = new Msg({
|
var msg = new Msg({
|
||||||
type: Msg.Type.PART,
|
type: Msg.Type.PART,
|
||||||
mode: chan.getMode(from),
|
mode: chan.getMode(from),
|
||||||
text: reason,
|
text: data.message || "",
|
||||||
|
hostmask:data.hostmask.username + "@" + data.hostmask.hostname,
|
||||||
from: from
|
from: from
|
||||||
});
|
});
|
||||||
chan.messages.push(msg);
|
chan.messages.push(msg);
|
||||||
|
@ -14,14 +14,11 @@ module.exports = function(irc, network) {
|
|||||||
client.emit("users", {
|
client.emit("users", {
|
||||||
chan: chan.id
|
chan: chan.id
|
||||||
});
|
});
|
||||||
var reason = data.message || "";
|
|
||||||
if (reason.length > 0) {
|
|
||||||
reason = "(" + reason + ")";
|
|
||||||
}
|
|
||||||
var msg = new Msg({
|
var msg = new Msg({
|
||||||
type: Msg.Type.QUIT,
|
type: Msg.Type.QUIT,
|
||||||
mode: chan.getMode(from),
|
mode: chan.getMode(from),
|
||||||
text: reason,
|
text: data.message || "",
|
||||||
|
hostmask: data.hostmask.username + "@" + data.hostmask.hostname,
|
||||||
from: from
|
from: from
|
||||||
});
|
});
|
||||||
chan.messages.push(msg);
|
chan.messages.push(msg);
|
||||||
|
@ -16,6 +16,7 @@ module.exports = function(irc, network) {
|
|||||||
mode: chan.getMode(from),
|
mode: chan.getMode(from),
|
||||||
from: from,
|
from: from,
|
||||||
text: topic,
|
text: topic,
|
||||||
|
isSetByChan: from === chan.name,
|
||||||
self: (from.toLowerCase() === irc.me.toLowerCase())
|
self: (from.toLowerCase() === irc.me.toLowerCase())
|
||||||
});
|
});
|
||||||
chan.messages.push(msg);
|
chan.messages.push(msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user