Support |c|USER|/log MESSAGE

The new /log syntax is analogous to /me and /announce

Doing it this way makes it easier to support by bots, and also makes
it not highlight the initiator but still highlight others which is
usually desired.

Closes #760
This commit is contained in:
Guangcong Luo
2016-09-10 15:57:32 -04:00
parent b931fc2202
commit b3e63242b2
2 changed files with 7 additions and 3 deletions

View File

@@ -457,6 +457,8 @@ var Tools = {
];
case 'announce':
return '<div class="chat chatmessage-' + toId(name) + hlClass + mineClass + '">' + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <span class="message-announce">' + Tools.parseMessage(target) + '</span></div>';
case 'log':
return '<div class="chat chatmessage-' + toId(name) + hlClass + mineClass + '">' + timestamp + '<span class="message-log">' + Tools.parseMessage(target) + '</span></div>';
case 'data-pokemon':
var buf = '<li class="result">';
var template = Tools.getTemplate(target);

View File

@@ -1445,9 +1445,11 @@
this.subtleNotifyOnce();
}
if (message.substr(0, 4) === '/me ' || message.substr(0, 5) === '/mee') {
Storage.logChat(this.id, '* ' + name + (message.substr(0, 4) === '/me ' ? ' ' : '') + message);
} else if (message.substr(0, 10) === '/announce ' || message.substr(0, 1) !== '/') {
if (message.slice(0, 4) === '/me ' || message.slice(0, 5) === '/mee') {
Storage.logChat(this.id, '* ' + name + (message.slice(0, 4) === '/me ' ? ' ' : '') + message);
} else if (message.slice(0, 5) === '/log ') {
Storage.logChat(this.id, '' + message.slice(5));
} else {
Storage.logChat(this.id, '' + name + ': ' + message);
}
},