mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 05:50:22 +00:00
Added ACTION messages
This commit is contained in:
parent
880b9b4104
commit
ea543e90e1
4 changed files with 49 additions and 21 deletions
|
@ -10,6 +10,7 @@ These are the commands currently implemented:
|
|||
- `/join`
|
||||
- `/kick`
|
||||
- `/leave`
|
||||
- `/me`
|
||||
- `/mode`
|
||||
- `/msg`
|
||||
- `/nick`
|
||||
|
|
|
@ -164,6 +164,13 @@ button::-moz-focus-inner {
|
|||
#chat .topic .user {
|
||||
color: #e74c3c;
|
||||
}
|
||||
#chat .action,
|
||||
#chat .action .user {
|
||||
color: #f39c12;
|
||||
}
|
||||
#chat .action .user:before {
|
||||
content: '* ';
|
||||
}
|
||||
#chat .show-more {
|
||||
display: none;
|
||||
margin: 6px 8px 4px 148px;
|
||||
|
|
|
@ -119,14 +119,11 @@ $(function() {
|
|||
chat.on("append", ".messages", function() {
|
||||
var messages = $(this);
|
||||
var id = messages.closest(".window").find(".form").data("target");
|
||||
var badge = $("#channel-" + id + ":not(.active)")
|
||||
.find(".badge");
|
||||
console.log(badge);
|
||||
if (badge.length == 0) {
|
||||
return;
|
||||
}
|
||||
var badge = $("#channel-" + id + ":not(.active) .badge");
|
||||
if (badge.length != 0) {
|
||||
var i = (parseInt(badge.html()) || 0) + 1;
|
||||
badge.html(i);
|
||||
}
|
||||
});
|
||||
|
||||
chat.on("click", ".show-more .btn", function() {
|
||||
|
|
|
@ -133,13 +133,11 @@ function input(data) {
|
|||
);
|
||||
case "msg":
|
||||
var user;
|
||||
var text = _.tail(args, 2).join(" ");
|
||||
var text = args.slice(2).join(" ");
|
||||
if (client) {
|
||||
user = client.me;
|
||||
client.send(args[1], text);
|
||||
}
|
||||
var chan = _.findWhere(network.channels, {name: args[1]});
|
||||
if (typeof chan !== "undefined") {
|
||||
var msg = new Msg({
|
||||
from: user,
|
||||
text: text,
|
||||
|
@ -149,7 +147,6 @@ function input(data) {
|
|||
id: chan.id,
|
||||
msg: msg,
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case "notice":
|
||||
|
@ -158,6 +155,28 @@ function input(data) {
|
|||
}
|
||||
break;
|
||||
|
||||
case "me":
|
||||
if (!args[1]) {
|
||||
break;
|
||||
}
|
||||
var user;
|
||||
var text = args.slice(1).join(" ");
|
||||
if (client) {
|
||||
user = client.me;
|
||||
client.action(chan.name, text);
|
||||
}
|
||||
var msg = new Msg({
|
||||
type: "action",
|
||||
from: user,
|
||||
text: text,
|
||||
});
|
||||
chan.messages.push(msg)
|
||||
sockets.emit("msg", {
|
||||
id: chan.id,
|
||||
msg: msg,
|
||||
});
|
||||
break;
|
||||
|
||||
case "server":
|
||||
case "connect":
|
||||
if (args[1]) {
|
||||
|
@ -360,9 +379,13 @@ function event(e, data) {
|
|||
}
|
||||
var type = "";
|
||||
var text = data.message;
|
||||
if (text.split(" ")[0] === "\u0001ACTION") {
|
||||
type = "action";
|
||||
text = text.replace(/\u0001|ACTION/g, "");
|
||||
}
|
||||
var network = this;
|
||||
text.split(' ').forEach(function(w) {
|
||||
if (w.indexOf(network.client.me) == 0) type = "highlight";
|
||||
if (w.indexOf(network.client.me) == 0) type += " highlight";
|
||||
});
|
||||
var msg = new Msg({
|
||||
type: type || "normal",
|
||||
|
|
Loading…
Reference in a new issue