diff --git a/src/auto_archiver/formatters/templates/html_template.html b/src/auto_archiver/formatters/templates/html_template.html index 50acf05..83dab66 100644 --- a/src/auto_archiver/formatters/templates/html_template.html +++ b/src/auto_archiver/formatters/templates/html_template.html @@ -65,11 +65,12 @@ } /* Disable grayscale on hover */ - img:hover, + /* img:hover, video:hover { -webkit-filter: grayscale(0); filter: none; - } + } */ + .collapsible { background-color: #777; @@ -101,57 +102,68 @@

Archived media for {{ url }}

+ {% if title | string | length > 0 %}

title: '{{ title }}'

+ {% endif %}

content {{ media | length }} item(s)

+
+ +
- {% for m in media %} - - + {% for m in media %} + + - - - {% endfor %} + {% endfor %} + + + + + {% endfor %} +
about preview(s)
-
    -
  • key: {{ m.key }}
  • -
  • type: {{ m.mimetype }}
  • +
+
    +
  • key: {{ m.key }}
  • +
  • type: {{ m.mimetype }}
  • - {% for prop in m.properties %} + {% for prop in m.properties %} - {% if m.properties[prop] | is_list %} -

    -
    - {{ prop }}: + {% if m.properties[prop] | is_list %}

    -
    - {% for subprop in m.properties[prop] %} - {% if subprop | is_media %} - {{ macros.display_media(subprop, true, url) }} +
    + {{ prop }}: +

    +
    + {% for subprop in m.properties[prop] %} + {% if subprop | is_media %} + {{ macros.display_media(subprop, true, url) }} -
      - {% for subprop_prop in subprop.properties %} -
    • {{ subprop_prop }}: {{ macros.copy_urlize(subprop.properties[subprop_prop]) }}
    • +
        + {% for subprop_prop in subprop.properties %} +
      • {{ subprop_prop }}: + {{ macros.copy_urlize(subprop.properties[subprop_prop]) }}
      • + {% endfor %} +
      + + {% else %} + {{ subprop }} + {% endif %} {% endfor %} -
    - - {% else %} - {{ subprop }} - {% endif %} - {% endfor %} +
    -
    -

    - {% elif m.properties[prop] | string | length > 1 %} -
  • {{ prop }}: {{ macros.copy_urlize(m.properties[prop]) }}
  • - {% endif %} +

    + {% elif m.properties[prop] | string | length > 1 %} +
  • {{ prop }}: {{ macros.copy_urlize(m.properties[prop]) }}
  • + {% endif %} - {% endfor %} -
-
- {{ macros.display_media(m, true, url) }} -
+ {{ macros.display_media(m, true, url) }} +

metadata

@@ -220,6 +232,49 @@ } }); } + + // logic for enabled/disabled greyscale + // Get references to the checkboxes and images/videos + const safeImageViewCheckbox = document.getElementById('safe-media-view'); + const imagesVideos = document.querySelectorAll('img, video'); + + // Function to toggle grayscale effect + function toggleGrayscale() { + imagesVideos.forEach(element => { + if (safeImageViewCheckbox.checked) { + // Enable grayscale effect + element.style.filter = 'grayscale(1)'; + element.style.webkitFilter = 'grayscale(1)'; + } else { + // Disable grayscale effect + element.style.filter = 'none'; + element.style.webkitFilter = 'none'; + } + }); + } + + // Add event listener to the checkbox to trigger the toggleGrayscale function + safeImageViewCheckbox.addEventListener('change', toggleGrayscale); + + // Handle the hover effect using JavaScript + imagesVideos.forEach(element => { + element.addEventListener('mouseenter', () => { + // Disable grayscale effect on hover + element.style.filter = 'none'; + element.style.webkitFilter = 'none'; + }); + + element.addEventListener('mouseleave', () => { + // Re-enable grayscale effect if checkbox is checked + if (safeImageViewCheckbox.checked) { + element.style.filter = 'grayscale(1)'; + element.style.webkitFilter = 'grayscale(1)'; + } + }); + }); + + // Call the function on page load to apply the initial state + toggleGrayscale(); \ No newline at end of file