mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-15 03:15:01 -05:00
Add support for /me
This commit is contained in:
parent
b612c48fb2
commit
14ac3617ce
1 changed files with 18 additions and 6 deletions
|
@ -42,14 +42,13 @@ function createMessageElement(msg) {
|
|||
};
|
||||
|
||||
line.appendChild(timestamp);
|
||||
line.appendChild(document.createTextNode(" "));
|
||||
|
||||
switch (msg.command) {
|
||||
case "NOTICE":
|
||||
case "PRIVMSG":
|
||||
var text = msg.params[1];
|
||||
|
||||
line.className += " talk";
|
||||
|
||||
var nick = document.createElement("a");
|
||||
nick.href = "#";
|
||||
nick.className = "nick nick-" + (djb2(msg.prefix.name) % 16 + 1);
|
||||
|
@ -59,10 +58,23 @@ function createMessageElement(msg) {
|
|||
switchBuffer(createBuffer(msg.prefix.name));
|
||||
};
|
||||
|
||||
line.appendChild(document.createTextNode(" <"));
|
||||
line.appendChild(nick);
|
||||
line.appendChild(document.createTextNode("> "));
|
||||
line.appendChild(document.createTextNode(text));
|
||||
var actionPrefix = "\001ACTION ";
|
||||
if (text.startsWith(actionPrefix) && text.endsWith("\001")) {
|
||||
var action = text.slice(actionPrefix.length, -1);
|
||||
|
||||
line.className += " me-tell";
|
||||
|
||||
line.appendChild(document.createTextNode("* "));
|
||||
line.appendChild(nick);
|
||||
line.appendChild(document.createTextNode(" " + action));
|
||||
} else {
|
||||
line.className += " talk";
|
||||
|
||||
line.appendChild(document.createTextNode("<"));
|
||||
line.appendChild(nick);
|
||||
line.appendChild(document.createTextNode("> "));
|
||||
line.appendChild(document.createTextNode(text));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
line.appendChild(document.createTextNode(" " + msg.command + " " + msg.params.join(" ")));
|
||||
|
|
Loading…
Reference in a new issue