Fix filter for users with emoji in thier names

This commit is contained in:
8chan 2015-03-09 02:32:02 -07:00 committed by czaks
parent a9b29c7232
commit 4e27112147

View File

@ -61,6 +61,19 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
drawFilterList(); drawFilterList();
} }
function nameSpanToString(el) {
var s = '';
$.each($(el).contents(), function(k,v) {
if (v.nodeName === 'IMG')
s=s+$(v).attr('alt')
if (v.nodeName === '#text')
s=s+v.nodeValue
});
return s.trim();
}
var blacklist = { var blacklist = {
add: { add: {
post: function (boardId, threadId, postId, hideReplies) { post: function (boardId, threadId, postId, hideReplies) {
@ -217,7 +230,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
var postName; var postName;
var postTrip = ''; var postTrip = '';
if (!pageData.forcedAnon) { if (!pageData.forcedAnon) {
postName = (typeof $ele.find('.name').contents()[0] == 'undefined') ? '' : $ele.find('.name').contents()[0].nodeValue.trim(); postName = (typeof $ele.find('.name').contents()[0] == 'undefined') ? '' : nameSpanToString($ele.find('.name')[0]);
postTrip = $ele.find('.trip').text(); postTrip = $ele.find('.trip').text();
} }
@ -404,7 +417,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
// matches generalFilter // matches generalFilter
if (!forcedAnon) if (!forcedAnon)
name = (typeof $post.find('.name').contents()[0] == 'undefined') ? '' : $post.find('.name').contents()[0].nodeValue.trim(); name = (typeof $post.find('.name').contents()[0] == 'undefined') ? '' : nameSpanToString($post.find('.name')[0]);
if (!forcedAnon && hasTrip) if (!forcedAnon && hasTrip)
trip = $post.find('.trip').text(); trip = $post.find('.trip').text();
if (hasSub) if (hasSub)