Make whois a client template
This commit is contained in:
parent
c4d628db49
commit
a61973a156
@ -840,6 +840,12 @@ button,
|
||||
color: #2ecc40;
|
||||
}
|
||||
|
||||
#chat .whois .from:before {
|
||||
font-family: FontAwesome;
|
||||
content: "\f007";
|
||||
color: #2ecc40;
|
||||
}
|
||||
|
||||
#chat .nick .from:before {
|
||||
font-family: FontAwesome;
|
||||
content: "\f007";
|
||||
|
@ -210,7 +210,6 @@ $(function() {
|
||||
}
|
||||
|
||||
var chan = chat.find(target);
|
||||
var from = data.msg.from;
|
||||
var msg;
|
||||
|
||||
if ([
|
||||
@ -223,6 +222,7 @@ $(function() {
|
||||
"quit",
|
||||
"topic",
|
||||
"action",
|
||||
"whois",
|
||||
].indexOf(type) !== -1) {
|
||||
data.msg.template = "actions/" + type;
|
||||
msg = $(render("msg_action", data.msg));
|
||||
@ -238,7 +238,7 @@ $(function() {
|
||||
if ((type === "message" || type === "action") && chan.hasClass("channel")) {
|
||||
var nicks = chan.find(".users").data("nicks");
|
||||
if (nicks) {
|
||||
var find = nicks.indexOf(from);
|
||||
var find = nicks.indexOf(data.msg.from);
|
||||
if (find !== -1 && typeof move === "function") {
|
||||
move(nicks, find, 0);
|
||||
}
|
||||
|
26
client/views/actions/whois.tpl
Normal file
26
client/views/actions/whois.tpl
Normal file
@ -0,0 +1,26 @@
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
<i class="hostmask">({{whois.username}}@{{whois.hostname}})</i>:
|
||||
<b>{{whois.realname}}</b>
|
||||
</div>
|
||||
{{#if whois.channels}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
is on the following channels:
|
||||
{{#each whois.channels}}
|
||||
{{{parse this}}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if whois.server}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
is connected to {{whois.server}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if whois.away}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
is away <i>({{whois.away}})</i>
|
||||
</div>
|
||||
{{/if}}
|
@ -20,27 +20,14 @@ module.exports = function(irc, network) {
|
||||
chan: chan
|
||||
});
|
||||
}
|
||||
var prefix = {
|
||||
hostname: "from",
|
||||
realname: "is",
|
||||
channels: "on",
|
||||
server: "using"
|
||||
};
|
||||
for (var k in data) {
|
||||
var key = prefix[k];
|
||||
if (!key || data[k].toString() === "") {
|
||||
continue;
|
||||
}
|
||||
var msg = new Msg({
|
||||
type: Msg.Type.WHOIS,
|
||||
from: data.nickname,
|
||||
text: key + " " + data[k]
|
||||
whois: data
|
||||
});
|
||||
chan.messages.push(msg);
|
||||
client.emit("msg", {
|
||||
chan: chan.id,
|
||||
msg: msg
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user