mirror of https://github.com/calzoneman/sync.git
Match word boundaries for nick highlight (#819)
This commit is contained in:
parent
1ec3eab0dc
commit
08f9feef74
|
@ -1655,7 +1655,7 @@ function addChatMessage(data) {
|
||||||
|
|
||||||
var isHighlight = false;
|
var isHighlight = false;
|
||||||
if (CLIENT.name && data.username != CLIENT.name) {
|
if (CLIENT.name && data.username != CLIENT.name) {
|
||||||
if (data.msg.toLowerCase().indexOf(CLIENT.name.toLowerCase()) != -1) {
|
if (highlightsMe(data.msg)) {
|
||||||
div.addClass("nick-highlight");
|
div.addClass("nick-highlight");
|
||||||
isHighlight = true;
|
isHighlight = true;
|
||||||
}
|
}
|
||||||
|
@ -1664,6 +1664,11 @@ function addChatMessage(data) {
|
||||||
pingMessage(isHighlight, data.username, $(div.children()[2]).text());
|
pingMessage(isHighlight, data.username, $(div.children()[2]).text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function highlightsMe(message) {
|
||||||
|
// TODO: distinguish between text and HTML attributes as noted in #819
|
||||||
|
return message.match(new RegExp("(^|\\b)" + CLIENT.name + "($|\\b)", "gi"));
|
||||||
|
}
|
||||||
|
|
||||||
function trimChatBuffer() {
|
function trimChatBuffer() {
|
||||||
var maxSize = window.CHATMAXSIZE;
|
var maxSize = window.CHATMAXSIZE;
|
||||||
if (!maxSize || typeof maxSize !== "number")
|
if (!maxSize || typeof maxSize !== "number")
|
||||||
|
|
Loading…
Reference in New Issue