mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 02:59:27 +00:00
fixed selection of partial matching tags
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user