Skip to content

Commit

Permalink
[BlacklistEnhancer] Add support for ischild, isparent, and lortags
Browse files Browse the repository at this point in the history
  • Loading branch information
bitWolfy committed Jun 29, 2024
1 parent b0af67a commit 8d3a40a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/js/components/post/PostFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ export class PostFilter {
switch (filterType) {
case FilterType.Size:
filter = Util.Size.unformat(filter) + "";
break;
case FilterType.IsParent:
case FilterType.IsChild:
if(!["true", "false", "yes", "no"].includes(filter))
continue;

if(filter == "yes") filter = "true";
else if(filter == "no") filter = "false";

break;
}
filter = filter.toLowerCase();
Expand Down Expand Up @@ -167,6 +176,20 @@ export class PostFilter {
case FilterType.MetaTags:
result = post.tagCategoriesKnown && PostFilterUtils.compareNumbers(post.tags.meta.size, value, filter.comparison)
break;
case FilterType.LoreTags:
result = post.tagCategoriesKnown && PostFilterUtils.compareNumbers(post.tags.lore.size, value, filter.comparison)
break;

case FilterType.IsParent:
result = post.has.children;
if(value == "false") result = !result;
break;
case FilterType.IsChild:
result = post.has.parent;
if(value == "false") result = !result;
break;


default:
result = false;
}
Expand Down Expand Up @@ -303,6 +326,10 @@ enum FilterType {
SpecTags = "spectags",
InvTags = "invtags",
MetaTags = "metatags",
LoreTags = "lortags",

IsParent = "isparent",
IsChild = "ischild",
}

namespace FilterType {
Expand Down

0 comments on commit 8d3a40a

Please sign in to comment.