forked from leftypol/leftypol
Enable filtering by flag name
This commit is contained in:
parent
79156cbbe4
commit
8acc328c91
1 changed files with 21 additions and 2 deletions
|
@ -380,7 +380,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
|
|
||||||
var list = getList();
|
var list = getList();
|
||||||
var postId = $post.find('.post_no').not('[id]').text();
|
var postId = $post.find('.post_no').not('[id]').text();
|
||||||
var name, trip, uid, subject, comment;
|
var name, trip, uid, subject, comment, flag;
|
||||||
var i, length, array, rule, pattern; // temp variables
|
var i, length, array, rule, pattern; // temp variables
|
||||||
|
|
||||||
var boardId = $post.data('board');
|
var boardId = $post.data('board');
|
||||||
|
@ -393,6 +393,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
|
|
||||||
var hasTrip = ($post.find('.trip').length > 0);
|
var hasTrip = ($post.find('.trip').length > 0);
|
||||||
var hasSub = ($post.find('.subject').length > 0);
|
var hasSub = ($post.find('.subject').length > 0);
|
||||||
|
var hasFlag = ($post.find('.flag').length > 0);
|
||||||
|
|
||||||
$post.data('hidden', false);
|
$post.data('hidden', false);
|
||||||
$post.data('hiddenByUid', false);
|
$post.data('hiddenByUid', false);
|
||||||
|
@ -401,6 +402,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
$post.data('hiddenByTrip', false);
|
$post.data('hiddenByTrip', false);
|
||||||
$post.data('hiddenBySubject', false);
|
$post.data('hiddenBySubject', false);
|
||||||
$post.data('hiddenByComment', false);
|
$post.data('hiddenByComment', false);
|
||||||
|
$post.data('hiddenByFlag', false);
|
||||||
|
|
||||||
// add post with matched UID to localList
|
// add post with matched UID to localList
|
||||||
if (hasUID &&
|
if (hasUID &&
|
||||||
|
@ -441,6 +443,8 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
});
|
});
|
||||||
comment = array.join(' ');
|
comment = array.join(' ');
|
||||||
|
|
||||||
|
if (hasFlag)
|
||||||
|
flag = $post.find('.flag').attr('title')
|
||||||
|
|
||||||
for (i = 0, length = list.generalFilter.length; i < length; i++) {
|
for (i = 0, length = list.generalFilter.length; i < length; i++) {
|
||||||
rule = list.generalFilter[i];
|
rule = list.generalFilter[i];
|
||||||
|
@ -472,6 +476,12 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
hide(post);
|
hide(post);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'flag':
|
||||||
|
if (hasFlag && pattern.test(flag)) {
|
||||||
|
$post.data('hiddenByFlag', true);
|
||||||
|
hide(post);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (rule.type) {
|
switch (rule.type) {
|
||||||
|
@ -501,6 +511,13 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
hide(post);
|
hide(post);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'flag':
|
||||||
|
pattern = new RegExp('\\b'+ rule.value+ '\\b');
|
||||||
|
if (hasFlag && pattern.test(flag)) {
|
||||||
|
$post.data('hiddenByFlag', true);
|
||||||
|
hide(post);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,7 +643,8 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
name: 'name',
|
name: 'name',
|
||||||
trip: 'tripcode',
|
trip: 'tripcode',
|
||||||
sub: 'subject',
|
sub: 'subject',
|
||||||
com: 'comment'
|
com: 'comment',
|
||||||
|
flag: 'flag'
|
||||||
};
|
};
|
||||||
|
|
||||||
$ele.empty();
|
$ele.empty();
|
||||||
|
@ -665,6 +683,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
||||||
'<option value="trip">'+_('Tripcode')+'</option>' +
|
'<option value="trip">'+_('Tripcode')+'</option>' +
|
||||||
'<option value="sub">'+_('Subject')+'</option>' +
|
'<option value="sub">'+_('Subject')+'</option>' +
|
||||||
'<option value="com">'+_('Comment')+'</option>' +
|
'<option value="com">'+_('Comment')+'</option>' +
|
||||||
|
'<option value="flag">'+_('Flag')+'</option>' +
|
||||||
'</select>' +
|
'</select>' +
|
||||||
'<input type="text">' +
|
'<input type="text">' +
|
||||||
'<input type="checkbox">' +
|
'<input type="checkbox">' +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue