mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Nested bogus folders + back button
This commit is contained in:
@ -69,6 +69,20 @@ export class FilterHelper {
|
||||
return data.filter(entity => fuzzySearchResults.includes(entity.uid));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given entity is tagged with the given tag ID.
|
||||
* @param {object} entity Searchable entity
|
||||
* @param {string} tagId Tag ID to check
|
||||
* @returns {boolean} Whether the entity is tagged with the given tag ID
|
||||
*/
|
||||
isElementTagged(entity, tagId) {
|
||||
const isCharacter = entity.type === 'character';
|
||||
const lookupValue = isCharacter ? entity.item.avatar : String(entity.id);
|
||||
const isTagged = Array.isArray(tag_map[lookupValue]) && tag_map[lookupValue].includes(tagId);
|
||||
|
||||
return isTagged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a tag filter to the data.
|
||||
* @param {any[]} data The data to filter.
|
||||
@ -82,19 +96,12 @@ export class FilterHelper {
|
||||
return data;
|
||||
}
|
||||
|
||||
function isElementTagged(entity, tagId) {
|
||||
const isCharacter = entity.type === 'character';
|
||||
const lookupValue = isCharacter ? entity.item.avatar : String(entity.id);
|
||||
const isTagged = Array.isArray(tag_map[lookupValue]) && tag_map[lookupValue].includes(tagId);
|
||||
return isTagged;
|
||||
}
|
||||
|
||||
function getIsTagged(entity) {
|
||||
const tagFlags = selected.map(tagId => isElementTagged(entity, tagId));
|
||||
const getIsTagged = (entity) => {
|
||||
const tagFlags = selected.map(tagId => this.isElementTagged(entity, tagId));
|
||||
const trueFlags = tagFlags.filter(x => x);
|
||||
const isTagged = TAG_LOGIC_AND ? tagFlags.length === trueFlags.length : trueFlags.length > 0;
|
||||
|
||||
const excludedTagFlags = excluded.map(tagId => isElementTagged(entity, tagId));
|
||||
const excludedTagFlags = excluded.map(tagId => this.isElementTagged(entity, tagId));
|
||||
const isExcluded = excludedTagFlags.includes(true);
|
||||
|
||||
if (isExcluded) {
|
||||
|
Reference in New Issue
Block a user