From 372b96026109f0f18cf47ba7b0e5cf6c45bf0681 Mon Sep 17 00:00:00 2001 From: Flo Greistorfer Date: Sun, 29 Jun 2025 12:54:40 +0200 Subject: [PATCH] fixed selection of partial matching tags --- templates/index.html.j2 | 16 +++++- test/example/DSC03470.JPG.xmp | 40 +++++++++++++-- test/example/DSC03508.JPG.xmp | 50 +++++++++++++++++-- test/example/example.jpg.xmp | 36 +++++++++++-- .../000041900001.jpg.xmp | 2 - 5 files changed, 128 insertions(+), 16 deletions(-) diff --git a/templates/index.html.j2 b/templates/index.html.j2 index b18e9d2..2f12526 100644 --- a/templates/index.html.j2 +++ b/templates/index.html.j2 @@ -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) { diff --git a/test/example/DSC03470.JPG.xmp b/test/example/DSC03470.JPG.xmp index 1da6c75..4132bd8 100644 --- a/test/example/DSC03470.JPG.xmp +++ b/test/example/DSC03470.JPG.xmp @@ -1,7 +1,39 @@ - - -stbusilluminateneonneon lightnightsigntrain cartrolleywindowst|busst|illuminatest|neonst|neon lightst|nightst|signst|train carst|trolleyst|window - + + + + + st + bus + illuminate + neon + neon light + night + sign + train car + trolley + window + train + + + + + st|bus + st|illuminate + st|neon + st|neon light + st|night + st|sign + st|train car + st|trolley + st|window + st|train + + + + \ No newline at end of file diff --git a/test/example/DSC03508.JPG.xmp b/test/example/DSC03508.JPG.xmp index 5243d16..303d338 100644 --- a/test/example/DSC03508.JPG.xmp +++ b/test/example/DSC03508.JPG.xmp @@ -1,7 +1,49 @@ - - -stattachbasementbeambuildingceilingequipmentfloorpiperedroomscaffoldtubewarehousewater pipest|attachst|basementst|beamst|buildingst|ceilingst|equipmentst|floorst|pipest|redst|roomst|scaffoldst|tubest|warehousest|water pipe - + + + + + st + attach + basement + beam + building + ceiling + equipment + floor + pipe + red + room + scaffold + tube + warehouse + water pipe + train + + + + + st|attach + st|basement + st|beam + st|building + st|ceiling + st|equipment + st|floor + st|pipe + st|red + st|room + st|scaffold + st|tube + st|warehouse + st|water pipe + st|train + + + + \ No newline at end of file diff --git a/test/example/example.jpg.xmp b/test/example/example.jpg.xmp index d2762fc..fdeaa40 100644 --- a/test/example/example.jpg.xmp +++ b/test/example/example.jpg.xmp @@ -1,7 +1,35 @@ - - -stcloudcloudyevening skyseaskystorm cloudstormysunsunsetst|cloudst|cloudyst|evening skyst|seast|skyst|storm cloudst|stormyst|sunst|sunset - + + + + + st + cloudy + evening sky + sea + sky + storm cloud + stormy + sun + sunset + + + + + st|cloudy + st|evening sky + st|sea + st|sky + st|storm cloud + st|stormy + st|sun + st|sunset + + + + \ No newline at end of file diff --git a/test/example/subfolder/subsubfolder (now with symbols)/000041900001.jpg.xmp b/test/example/subfolder/subsubfolder (now with symbols)/000041900001.jpg.xmp index 463dd2d..ec5054d 100644 --- a/test/example/subfolder/subsubfolder (now with symbols)/000041900001.jpg.xmp +++ b/test/example/subfolder/subsubfolder (now with symbols)/000041900001.jpg.xmp @@ -9,7 +9,6 @@ st cloud - cloudy fly sky @@ -17,7 +16,6 @@ st|cloud - st|cloudy st|fly st|sky