Merge branch 'master' into highlighter
This commit is contained in:
commit
e1991ea8f6
44
code/chat.js
44
code/chat.js
@ -241,12 +241,12 @@ window.chat.renderFull = function(oldMsgsWereAdded) {
|
|||||||
// common
|
// common
|
||||||
//
|
//
|
||||||
|
|
||||||
window.chat.writeDataToHash = function(newData, storageHash, skipSecureMsgs) {
|
window.chat.writeDataToHash = function(newData, storageHash, isPublicChannel) {
|
||||||
$.each(newData.result, function(ind, json) {
|
$.each(newData.result, function(ind, json) {
|
||||||
// avoid duplicates
|
// avoid duplicates
|
||||||
if(json[0] in storageHash.data) return true;
|
if(json[0] in storageHash.data) return true;
|
||||||
|
|
||||||
var skipThisEntry = false;
|
var isSecureMessage = false;
|
||||||
var msgToPlayer = false;
|
var msgToPlayer = false;
|
||||||
|
|
||||||
var time = json[1];
|
var time = json[1];
|
||||||
@ -259,10 +259,7 @@ window.chat.writeDataToHash = function(newData, storageHash, skipSecureMsgs) {
|
|||||||
if (storageHash.newestTimestamp === -1 || storageHash.newestTimestamp < time) storageHash.newestTimestamp = time;
|
if (storageHash.newestTimestamp === -1 || storageHash.newestTimestamp < time) storageHash.newestTimestamp = time;
|
||||||
|
|
||||||
//remove "Your X on Y was destroyed by Z" from the faction channel
|
//remove "Your X on Y was destroyed by Z" from the faction channel
|
||||||
if (systemNarrowcast && !skipSecureMsgs) {
|
if (systemNarrowcast && !isPublicChannel) return true;
|
||||||
//NOTE: skipSecureMsgs is being used as a "is public channel" flag here
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var msg = '', nick = '', pguid;
|
var msg = '', nick = '', pguid;
|
||||||
$.each(json[2].plext.markup, function(ind, markup) {
|
$.each(json[2].plext.markup, function(ind, markup) {
|
||||||
@ -306,13 +303,34 @@ window.chat.writeDataToHash = function(newData, storageHash, skipSecureMsgs) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SECURE':
|
case 'SECURE':
|
||||||
if(skipSecureMsgs) {
|
//NOTE: we won't add the '[secure]' string here - it'll be handled below instead
|
||||||
skipThisEntry = true;
|
isSecureMessage = true;
|
||||||
return false; // breaks $.each
|
break;
|
||||||
}
|
|
||||||
|
default:
|
||||||
|
//handle unknown types by outputting the plain text version, marked with it's type
|
||||||
|
msg += $('<div/>').text(markup[0]+':<'+markup[1].plain+'>').html();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(skipThisEntry) return true;
|
|
||||||
|
|
||||||
|
//skip secure messages on the public channel
|
||||||
|
if (isPublicChannel && isSecureMessage) return true;
|
||||||
|
|
||||||
|
//skip public messages (e.g. @player mentions) on the secure channel
|
||||||
|
if ((!isPublicChannel) && (!isSecureMessage)) return true;
|
||||||
|
|
||||||
|
|
||||||
|
//NOTE: these two are currently redundant with the above two tests - but code can change...
|
||||||
|
//from the server, private channel messages are flagged with a SECURE string '[secure] ', and appear in
|
||||||
|
//both the public and private channels
|
||||||
|
//we don't include this '[secure]' text above, as it's redundant in the faction-only channel
|
||||||
|
//let's add it here though if we have a secure message in the public channel, or the reverse if a non-secure in the faction one
|
||||||
|
if (isPublicChannel && isSecureMessage) msg = '<span style="color: #f66">[secure]</span> ' + msg;
|
||||||
|
//and, add the reverse - a 'public' marker to messages in the private channel
|
||||||
|
if ((!isPublicChannel) && (!isSecureMessage)) msg = '<span style="color: #ff6">[public]</span> ' + msg;
|
||||||
|
|
||||||
|
|
||||||
// format: timestamp, autogenerated, HTML message, player guid
|
// format: timestamp, autogenerated, HTML message, player guid
|
||||||
storageHash.data[json[0]] = [json[1], auto, chat.renderMsg(msg, nick, time, team, msgToPlayer, systemNarrowcast), pguid];
|
storageHash.data[json[0]] = [json[1], auto, chat.renderMsg(msg, nick, time, team, msgToPlayer, systemNarrowcast), pguid];
|
||||||
@ -378,7 +396,9 @@ window.chat.renderMsg = function(msg, nick, time, team, msgToPlayer, systemNarro
|
|||||||
{
|
{
|
||||||
msg = '<div class="system_narrowcast">' + msg + '</div>';
|
msg = '<div class="system_narrowcast">' + msg + '</div>';
|
||||||
}
|
}
|
||||||
var s = 'style="cursor:pointer; color:'+COLORS[team]+'"';
|
var color = COLORS[team];
|
||||||
|
if (nick === window.PLAYER.nickname) color = '#fd6'; //highlight things said/done by the player in a unique colour (similar to @player mentions from others in the chat text itself)
|
||||||
|
var s = 'style="cursor:pointer; color:'+color+'"';
|
||||||
var title = nick.length >= 8 ? 'title="'+nick+'" class="help"' : '';
|
var title = nick.length >= 8 ? 'title="'+nick+'" class="help"' : '';
|
||||||
var i = ['<span class="invisep"><</span>', '<span class="invisep">></span>'];
|
var i = ['<span class="invisep"><</span>', '<span class="invisep">></span>'];
|
||||||
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" onclick="window.chat.addNickname(\'@' + nick + '\')" ' + s + '>'+ nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
|
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" onclick="window.chat.addNickname(\'@' + nick + '\')" ' + s + '>'+ nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
|
||||||
|
@ -58,7 +58,7 @@ window.renderPortalDetails = function(guid) {
|
|||||||
$('#portaldetails')
|
$('#portaldetails')
|
||||||
.attr('class', TEAM_TO_CSS[getTeam(d)])
|
.attr('class', TEAM_TO_CSS[getTeam(d)])
|
||||||
.html(''
|
.html(''
|
||||||
+ '<h3>'+d.portalV2.descriptiveText.TITLE+'</h3>'
|
+ '<h3 ondblclick="renderPortalDetails(null);">'+d.portalV2.descriptiveText.TITLE+'</h3>'
|
||||||
// help cursor via “.imgpreview img”
|
// help cursor via “.imgpreview img”
|
||||||
+ '<div class="imgpreview" '+imgTitle+' style="background-image: url('+img+')">'
|
+ '<div class="imgpreview" '+imgTitle+' style="background-image: url('+img+')">'
|
||||||
+ '<img class="hide" src="'+img+'"/>'
|
+ '<img class="hide" src="'+img+'"/>'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user