mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-09 04:23:01 -05:00
Support |unlink| message
This commit is contained in:
parent
9e29dfd8ed
commit
c2dcaa21e1
|
|
@ -4652,9 +4652,9 @@ function Battle(frame, logFrame, noPreload) {
|
|||
args.shift();
|
||||
var message = args.join('|');
|
||||
if (message.substr(0,2) === '//') {
|
||||
self.log('<div class="chat"><strong style="' + hashColor(toUserid(name)) + '">' + Tools.escapeHTML(name) + ':</strong> <em>' + Tools.parseMessage(message.substr(1)) + '</em></div>', preempt);
|
||||
self.log('<div class="chat"><strong style="' + hashColor(toUserid(name)) + '">' + Tools.escapeHTML(name) + ':</strong> <em>' + Tools.parseMessage(message.substr(1), name) + '</em></div>', preempt);
|
||||
} else if (message.substr(0,4).toLowerCase() === '/me ') {
|
||||
self.log('<div class="chat"><strong style="' + hashColor(toUserid(name)) + '">•</strong> <em>' + Tools.escapeHTML(name) + ' <i>' + Tools.parseMessage(message.substr(4)) + '</i></em></div>', preempt);
|
||||
self.log('<div class="chat"><strong style="' + hashColor(toUserid(name)) + '">•</strong> <em>' + Tools.escapeHTML(name) + ' <i>' + Tools.parseMessage(message.substr(4), name) + '</i></em></div>', preempt);
|
||||
} else if (message.substr(0,14).toLowerCase() === '/data-pokemon ') {
|
||||
self.log('<div class="chat"><ul class=\"utilichart\">'+Chart.pokemonRow(Tools.getTemplate(message.substr(14)),'',{})+'<li style=\"clear:both\"></li></ul></div>', preempt);
|
||||
} else if (message.substr(0,11).toLowerCase() === '/data-item ') {
|
||||
|
|
@ -4664,7 +4664,7 @@ function Battle(frame, logFrame, noPreload) {
|
|||
} else if (message.substr(0,11).toLowerCase() === '/data-move ') {
|
||||
self.log('<div class="chat"><ul class=\"utilichart\">'+Chart.moveRow(Tools.getMove(message.substr(11)),'',{})+'<li style=\"clear:both\"></li></ul></div>', preempt);
|
||||
} else {
|
||||
self.log('<div class="chat"><strong style="' + hashColor(toUserid(name)) + '" class="username" data-name="'+Tools.escapeHTML(name)+'">' + Tools.escapeHTML(name) + ':</strong> <em>' + Tools.parseMessage(message) + '</em></div>', preempt);
|
||||
self.log('<div class="chat"><strong style="' + hashColor(toUserid(name)) + '" class="username" data-name="'+Tools.escapeHTML(name)+'">' + Tools.escapeHTML(name) + ':</strong> <em>' + Tools.parseMessage(message, name) + '</em></div>', preempt);
|
||||
}
|
||||
break;
|
||||
case 'chatmsg':
|
||||
|
|
@ -4680,7 +4680,7 @@ function Battle(frame, logFrame, noPreload) {
|
|||
self.log('<div class="chat">' + Tools.sanitizeHTML(list) + '</div>', preempt);
|
||||
break;
|
||||
case 'pm':
|
||||
self.log('<div class="chat"><strong>' + Tools.escapeHTML(args[1]) + ':</strong> <span class="message-pm"><i style="cursor:pointer" onclick="selectTab(\'lobby\');rooms.lobby.popupOpen(\'' + Tools.escapeHTML(args[2], true) + '\')">(Private to ' + Tools.escapeHTML(args[3]) + ')</i> ' + Tools.parseMessage(args[4]) + '</span>');
|
||||
self.log('<div class="chat"><strong>' + Tools.escapeHTML(args[1]) + ':</strong> <span class="message-pm"><i style="cursor:pointer" onclick="selectTab(\'lobby\');rooms.lobby.popupOpen(\'' + Tools.escapeHTML(args[2], true) + '\')">(Private to ' + Tools.escapeHTML(args[3]) + ')</i> ' + Tools.parseMessage(args[4], args[1]) + '</span>');
|
||||
break;
|
||||
case 'askreg':
|
||||
self.log('<div class="broadcast-blue"><b>Register an account to protect your ladder rating!</b><br /><button name="register" value="'+Tools.escapeHTML(args[1])+'"><b>Register</b></button></div>');
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ var Tools = {
|
|||
return Tools.escapeHTML(formatid);
|
||||
},
|
||||
|
||||
parseMessage: function(str) {
|
||||
parseMessage: function(str, linkclass) {
|
||||
str = Tools.escapeHTML(str);
|
||||
// Don't format console commands (>>).
|
||||
if (str.substr(0, 8) === '>>') return str;
|
||||
|
|
@ -337,8 +337,12 @@ var Tools = {
|
|||
onclick = 'if (window._gaq) _gaq.push([\'_trackEvent\', \'' +
|
||||
event + '\', \'' + Tools.escapeQuotes(fulluri) + '\']);';
|
||||
}
|
||||
if (linkclass) {
|
||||
classbit = ' class="message-link-' + toId(linkclass) + '"';
|
||||
}
|
||||
return '<a href="' + fulluri +
|
||||
'" target="_blank" onclick="' + onclick + '">' + uri + '</a>';
|
||||
'" target="_blank" onclick="' + onclick + '"' + classbit +
|
||||
'>' + uri + '</a>';
|
||||
});
|
||||
// google [blah]
|
||||
// google[blah]
|
||||
|
|
|
|||
|
|
@ -769,6 +769,14 @@
|
|||
this.$chat.append('<div class="notice">' + Tools.sanitizeHTML(row.slice(1).join('|')) + '</div>');
|
||||
break;
|
||||
|
||||
case 'unlink':
|
||||
// note: this message has global effects, but it's handled here
|
||||
// so that it can be included in the scrollback buffer.
|
||||
$('.message-link-' + toId(row[1])).each(function() {
|
||||
$(this).replaceWith($(this).html());
|
||||
});
|
||||
break;
|
||||
|
||||
case '':
|
||||
this.$chat.append('<div class="notice">' + Tools.escapeHTML(row.slice(1).join('|')) + '</div>');
|
||||
break;
|
||||
|
|
@ -916,30 +924,30 @@
|
|||
if (name.charAt(0) !== ' ') clickableName = '<small>' + Tools.escapeHTML(name.charAt(0)) + '</small>'+clickableName;
|
||||
var self = this;
|
||||
var outputChat = function() {
|
||||
self.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + Tools.parseMessage(message) + '</em></div>');
|
||||
self.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + Tools.parseMessage(message, name) + '</em></div>');
|
||||
};
|
||||
var showme = !((Tools.prefs('chatformatting') || {}).hideme);
|
||||
if (pm) {
|
||||
var pmuserid = toUserid(pm);
|
||||
var oName = pm;
|
||||
if (pmuserid === app.user.get('userid')) oName = name;
|
||||
this.$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <span class="message-pm"><i class="pmnote" data-name="' + Tools.escapeHTML(oName) + '">(Private to ' + Tools.escapeHTML(pm) + ')</i> ' + Tools.parseMessage(message) + '</span></div>');
|
||||
this.$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <span class="message-pm"><i class="pmnote" data-name="' + Tools.escapeHTML(oName) + '">(Private to ' + Tools.escapeHTML(pm) + ')</i> ' + Tools.parseMessage(message, name) + '</span></div>');
|
||||
} else if (message.substr(0,4) === '/me ') {
|
||||
message = message.substr(4);
|
||||
if (showme) {
|
||||
this.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + ' <i>' + Tools.parseMessage(message) + '</i></em></div>');
|
||||
this.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + ' <i>' + Tools.parseMessage(message, name) + '</i></em></div>');
|
||||
} else {
|
||||
outputChat();
|
||||
}
|
||||
} else if (message.substr(0,5) === '/mee ') {
|
||||
message = message.substr(5);
|
||||
if (showme) {
|
||||
this.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + '<i>' + Tools.parseMessage(message) + '</i></em></div>');
|
||||
this.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + '<i>' + Tools.parseMessage(message, name) + '</i></em></div>');
|
||||
} else {
|
||||
outputChat();
|
||||
}
|
||||
} else if (message.substr(0,10) === '/announce ') {
|
||||
this.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <span class="message-announce">' + Tools.parseMessage(message.substr(10)) + '</span></div>');
|
||||
this.$chat.append(chatDiv + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <span class="message-announce">' + Tools.parseMessage(message.substr(10), name) + '</span></div>');
|
||||
} else if (message.substr(0,6) === '/warn ') {
|
||||
app.addPopup(RulesPopup, {warning: message.substr(6)});
|
||||
} else if (message.substr(0,14) === '/data-pokemon ') {
|
||||
|
|
|
|||
|
|
@ -93,15 +93,15 @@
|
|||
if (name.substr(0, 1) !== ' ') clickableName = '<small>' + Tools.escapeHTML(name.substr(0, 1)) + '</small>'+clickableName;
|
||||
|
||||
if (message.substr(0,4) === '/me ') {
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + ' <i>' + Tools.parseMessage(message.substr(4)) + '</i></em></div>');
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + ' <i>' + Tools.parseMessage(message.substr(4), name) + '</i></em></div>');
|
||||
} else if (message.substr(0,5) === '/mee ') {
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + '<i>' + Tools.parseMessage(message.substr(5)) + '</i></em></div>');
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">•</strong> <em' + (name.substr(1) === app.user.get('name') ? ' class="mine"' : '') + '>' + clickableName + '<i>' + Tools.parseMessage(message.substr(5), name) + '</i></em></div>');
|
||||
} else if (message.substr(0,8) === '/invite ') {
|
||||
var roomid = toRoomid(message.substr(8));
|
||||
$chat.append('<div class="chat">' + timestamp + '<em>' + clickableName + ' invited you to join the room "'+roomid+'"</em></div>');
|
||||
$chat.append('<div class="notice"><button name="joinRoom" value="'+roomid+'">Join '+roomid+'</button></div>');
|
||||
} else if (message.substr(0,10) === '/announce ') {
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <span class="message-announce">' + Tools.parseMessage(message.substr(10)) + '</span></div>');
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <span class="message-announce">' + Tools.parseMessage(message.substr(10), name) + '</span></div>');
|
||||
} else if (message.substr(0,14) === '/data-pokemon ') {
|
||||
$chat.append('<div class="message"><ul class="utilichart">'+Chart.pokemonRow(Tools.getTemplate(message.substr(14)),'',{})+'<li style=\"clear:both\"></li></ul></div>');
|
||||
} else if (message.substr(0,11) === '/data-item ') {
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
} else {
|
||||
// Normal chat message.
|
||||
if (message.substr(0,2) === '//') message = message.substr(1);
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <em' + (target === oName ? ' class="mine"' : '') + '>' + Tools.parseMessage(message) + '</em></div>');
|
||||
$chat.append('<div class="chat">' + timestamp + '<strong style="' + color + '">' + clickableName + ':</strong> <em' + (target === oName ? ' class="mine"' : '') + '>' + Tools.parseMessage(message, name) + '</em></div>');
|
||||
}
|
||||
|
||||
if (autoscroll) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user