implement nick highlight feature in chat

This commit is contained in:
Stefan Breunig 2013-02-05 15:33:15 +01:00
parent 7f7d716d2b
commit 6c6cd10827
4 changed files with 22 additions and 3 deletions

View File

@ -155,6 +155,10 @@ function boot() {
// necessary data has been loaded.
urlPortal = getURLParam('pguid');
// load only once
var n = window.PLAYER['nickname'];
window.PLAYER['nickMatcher'] = new RegExp('\\b('+n+')\\b');
$('#sidebar').show();
}

View File

@ -365,7 +365,10 @@ window.chat.renderPlayerMsgsTo = function(isFaction, data, isOldMsgs, dupCheckAr
window.setPlayerName(pguid, nick); // free nick name resolves
}
if(markup[0] === 'TEXT') msg = markup[1].plain.autoLink();
if(markup[0] === 'TEXT') {
msg = markup[1].plain.autoLink();
msg = msg.replace(window.PLAYER['nickMatcher'], '<em>$1</em>');
}
if(!isFaction && markup[0] === 'SECURE') {
nick = null;

View File

@ -106,6 +106,11 @@ a:hover {
border-bottom: 0;
}
#em {
color: red;
font-style: normal;
}
#chat.expand {
height:auto;
top: 25px;

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id ingress-intel-total-conversion@breunigs
// @name intel map total conversion
// @version 0.2-2013-02-05-150753
// @version 0.2-2013-02-05-153309
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js
@ -848,6 +848,10 @@ function boot() {
// necessary data has been loaded.
urlPortal = getURLParam('pguid');
// load only once
var n = window.PLAYER['nickname'];
window.PLAYER['nickMatcher'] = new RegExp('\\b('+n+')\\b');
$('#sidebar').show();
}
@ -1236,7 +1240,10 @@ window.chat.renderPlayerMsgsTo = function(isFaction, data, isOldMsgs, dupCheckAr
window.setPlayerName(pguid, nick); // free nick name resolves
}
if(markup[0] === 'TEXT') msg = markup[1].plain.autoLink();
if(markup[0] === 'TEXT') {
msg = markup[1].plain.autoLink();
msg = msg.replace(window.PLAYER['nickMatcher'], '<em>$1</em>');
}
if(!isFaction && markup[0] === 'SECURE') {
nick = null;