diff --git a/.version b/.version index fbafd6b..e2bdf6e 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.7.2 \ No newline at end of file +2.7.3 \ No newline at end of file diff --git a/StaticGalleryBuilder.code-workspace b/StaticGalleryBuilder.code-workspace index 6dd3605..207a831 100644 --- a/StaticGalleryBuilder.code-workspace +++ b/StaticGalleryBuilder.code-workspace @@ -38,8 +38,8 @@ "-n", "-m", "--reverse-sort", - // "--regenerate-thumbnails", - // "--reread-metadata", + "--regenerate-thumbnails", + "--reread-metadata", "--folderthumbnails" ], "console": "integratedTerminal", diff --git a/templates/index.html.j2 b/templates/index.html.j2 index b45bfea..6b27f1b 100644 --- a/templates/index.html.j2 +++ b/templates/index.html.j2 @@ -85,22 +85,6 @@ {% if images %} {%- set ns = namespace(count = 0) -%}
- {%- for image in images %} -
-
- {{ image.name }} - {%- set ns.count = ns.count + 1 %} -
{{ image.name }} - {%- if image.tiff %} - TIFF - {%- endif %} - {%- if image.raw %} - RAW - {%- endif %} -
-
-
- {%- endfor %}
{%- endif %} {% if license %} @@ -123,14 +107,14 @@ {%- endif %} Made with StaticGalleryBuilder {{ version }} by {{ logo }}. - + {%- endif %} {%- else %} {%- endif %} {% if images %} @@ -175,12 +159,13 @@ var items = [ {%- for image in images %} {%- if image.exifdata.DateTime %} - { src: "{{ image.url }}", w: {{ image.width }}, h: {{ image.height }}, msrc: "{{ image.thumbnail }}", tags: "{{ image.tags }}", title: "Captured: {{ image.exifdata.DateTime }}" }, + { name: "{{ image.name }}", tiff: "{{ image.tiff }}", raw: "{{ image.raw }}", src: "{{ image.url }}", w: {{ image.width }}, h: {{ image.height }}, msrc: "{{ image.thumbnail }}", tags: "{{ image.tags }}", title: "Captured: {{ image.exifdata.DateTime }}" }, {%- else %} - { src: "{{ image.url }}", w: {{ image.width }}, h: {{ image.height }}, msrc: "{{ image.thumbnail }}", tags: "{{ image.tags }}" }, + { name: "{{ image.name }}", tiff: "{{ image.tiff }}", raw: "{{ image.raw }}", src: "{{ image.url }}", w: {{ image.width }}, h: {{ image.height }}, msrc: "{{ image.thumbnail }}", tags: "{{ image.tags }}" }, {%- endif %} {%- endfor %} ]; + var shown = []; var re = /pid=(\d+)/; var controllers = {} @@ -188,15 +173,10 @@ var options = { index: img }; - var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); + var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, shown, options); gallery.init(); } - - if (re.test(window.location.href)) { - var pid = window.location.href.match(re)[1]; - openSwipe(parseInt(pid)); - } - + let totopbutton = document.getElementById("totop"); window.onscroll = function () { scrollFunction() }; @@ -213,6 +193,25 @@ window.scrollTo({ top: 0, behavior: 'smooth' }) } + window.onload = function () { filter() }; + + function updateImageList() { + var str = "" + var imagelist = document.getElementById("imagelist"); + shown.forEach((item, index) => { + str += '
' + item.name; + if (item.tiff != "") { + str += ' TIFF'; + } + if (item.raw != "") { + str += ' RAW'; + } + str += '
'; + }); + + imagelist.innerHTML = str; + } + function prefetch(img) { const controller = new AbortController() const signal = controller.signal @@ -230,36 +229,37 @@ delete controllers[img]; } - {%- if tags|length > 0 %} function filter() { var selected_tags = []; - var tagdropdown, imagelist, figures, i, j, tags, incl; + var tagdropdown, tags, incl; + shown = []; tagdropdown = document.getElementById("tagdropdown").getElementsByTagName("li"); - for (i = 0; i < tagdropdown.length; i++) { + for (var i = 0; i < tagdropdown.length; i++) { if (tagdropdown[i].firstChild.firstChild.checked) { selected_tags.push([tagdropdown[i].innerText]) } } - imagelist = document.getElementById("imagelist"); - figures = imagelist.getElementsByTagName("div"); - for (i = 0; i < figures.length; i++) { - tags = items[i].tags; + items.forEach((item, index) => { + tags = item.tags; incl = true; - for (j = 0; j < selected_tags.length; j++) { - if (tags.indexOf(selected_tags[j]) == -1) { + selected_tags.forEach((tag) => { + if (tags.indexOf(tag) == -1) { incl = false; } + }); + if (incl | selected_tags == []) { + shown.push(item) } - if (incl || selected_tags == []) { - figures[i].style.display = ""; - } else { - figures[i].style.display = "none"; - } + }); + updateImageList(); + + if (re.test(window.location.href)) { + var pid = window.location.href.match(re)[1]; + console.log(pid); + console.log(shown); + openSwipe(parseInt(pid)); } } - - filter() - {%- endif %} {%- endif %} diff --git a/templates/license.html.j2 b/templates/license.html.j2 index 670396b..397b57a 100644 --- a/templates/license.html.j2 +++ b/templates/license.html.j2 @@ -54,14 +54,14 @@ {%- endif %} Made with StaticGalleryBuilder {{ version }} by {{ logo }}. - + {%- endif %} {%- else %} {%- endif %} \ No newline at end of file diff --git a/test/example/DSC03470.JPG.xmp b/test/example/DSC03470.JPG.xmp index e184ae5..cb5551a 100644 --- a/test/example/DSC03470.JPG.xmp +++ b/test/example/DSC03470.JPG.xmp @@ -2,6 +2,6 @@ -busilluminateneonneon lightnightsigntrain cartrolleywindow|bus|illuminate|neon|neon light|night|sign|train car|trolley|window +busilluminateneonpassenger trainneon lightnightsigntrain cartrolleywindow|bus|illuminate|neon|neon light|night|sign|train car|trolley|window \ No newline at end of file