fixed selection of partial matching tags

This commit is contained in:
2025-06-29 12:54:40 +02:00
parent c671c2a4bc
commit 372b960261
5 changed files with 128 additions and 16 deletions

View File

@@ -320,17 +320,29 @@
const tagcheckboxes = document.querySelectorAll("#tagdropdown input[class='tag']:checked");
tagcheckboxes.forEach((checkbox) => {
const tag = checkbox.parentElement.id.trim().substring(1);
let tag = checkbox.parentElement.id.trim().substring(1);
if (checkbox.parentElement.parentElement.children.length > 1) {
tag += "|"
}
selected_tags.push(tag);
});
console.log(selected_tags);
const urltags = selected_tags.join(",");
const isRecursiveChecked = document.getElementById("recursive").checked;
for (const item of items) {
const tags = item.tags || [];
const include = selected_tags.every(tag => tags.some(t => t.startsWith(tag)));
const include = selected_tags.every(selected => {
const isParent = selected.endsWith('|');
if (isParent) {
return tags.some(t => t.startsWith(selected));
} else {
return tags.includes(selected);
}
});
if (include || selected_tags.length === 0) {
if (!isRecursiveChecked) {