Merge pull request #577 from kotarou3/blacklists
Use OR instead of AND when excluding tags for blacklist.
This commit is contained in:
@@ -98,15 +98,7 @@
|
|||||||
tags.push("rating:" + $post.data("rating"));
|
tags.push("rating:" + $post.data("rating"));
|
||||||
tags.push("user:" + $post.data("user"));
|
tags.push("user:" + $post.data("user"));
|
||||||
|
|
||||||
if (blacklist.require.length > 0 || blacklist.exclude.length > 0) {
|
return Danbooru.is_subset(tags, blacklist.require) && !Danbooru.intersect(tags, blacklist.exclude).length;
|
||||||
if (blacklist.require.length === 0 || Danbooru.is_subset(tags, blacklist.require)) {
|
|
||||||
if (blacklist.exclude.length === 0 || (!Danbooru.is_subset(tags, blacklist.exclude))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Blacklist.post_hide = function(post) {
|
Danbooru.Blacklist.post_hide = function(post) {
|
||||||
|
|||||||
@@ -23,6 +23,24 @@
|
|||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Danbooru.intersect = function(a, b) {
|
||||||
|
a = a.slice(0).sort();
|
||||||
|
b = b.slice(0).sort();
|
||||||
|
var result = [];
|
||||||
|
while (a.length > 0 && b.length > 0)
|
||||||
|
{
|
||||||
|
if (a[0] < b[0]) {
|
||||||
|
a.shift();
|
||||||
|
} else if (a[0] > b[0]) {
|
||||||
|
b.shift();
|
||||||
|
} else {
|
||||||
|
result.push(a.shift());
|
||||||
|
b.shift();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Danbooru.without = function(array, element) {
|
Danbooru.without = function(array, element) {
|
||||||
var temp = [];
|
var temp = [];
|
||||||
$.each(array, function(i, v) {
|
$.each(array, function(i, v) {
|
||||||
|
|||||||
Reference in New Issue
Block a user