Add utility regexp split function for non-whitespace words

This commit is contained in:
BrokenEagle
2020-03-07 06:10:50 +00:00
parent d1aed303fd
commit 161e776cf7
4 changed files with 15 additions and 14 deletions

View File

@@ -15,8 +15,7 @@ Blacklist.parse_entry = function(string) {
"hits": 0,
"min_score": null
};
var matches = string.match(/\S+/g) || [];
$.each(matches, function(i, tag) {
Utility.regexp_split(string).forEach(function(tag) {
if (tag.charAt(0) === '-') {
entry.exclude.push(tag.slice(1));
} else if (tag.charAt(0) === '~') {
@@ -169,11 +168,11 @@ Blacklist.post_match = function(post, entry) {
var score = parseInt($post.attr("data-score"));
var score_test = entry.min_score === null || score < entry.min_score;
var tags = String($post.attr("data-tags")).match(/\S+/g) || [];
tags = tags.concat(String($post.attr("data-pools")).match(/\S+/g) || []);
var tags = Utility.regexp_split($post.attr("data-tags"));
tags.push(...Utility.regexp_split($post.attr("data-pools")));
tags.push("rating:" + $post.data("rating"));
tags.push("uploaderid:" + $post.attr("data-uploader-id"));
$.each(String($post.data("flags")).match(/\S+/g) || [], function(i, v) {
Utility.regexp_split($post.data("flags")).forEach(function(v) {
tags.push("status:" + v);
});