From 824639a6aedc77b389ed68649e2f83c4d29daffe Mon Sep 17 00:00:00 2001 From: Digital Studium Date: Sun, 23 Jul 2023 19:02:45 +0300 Subject: [PATCH] Add lozad --- static/js/lozad.min.js | 13 +++++++++++++ templates/components/head.j2 | 2 +- templates/components/image.j2 | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 static/js/lozad.min.js diff --git a/static/js/lozad.min.js b/static/js/lozad.min.js new file mode 100644 index 0000000..138739a --- /dev/null +++ b/static/js/lozad.min.js @@ -0,0 +1,13 @@ +/*! lozad.js - v1.16.0 - 2020-09-06 +* https://github.com/ApoorvSaxena/lozad.js +* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict"; +/** + * Detect IE browser + * @const {boolean} + * @private + */var g="undefined"!=typeof document&&document.documentMode,f={rootMargin:"0px",threshold:0,load:function(t){if("picture"===t.nodeName.toLowerCase()){var e=t.querySelector("img"),r=!1;null===e&&(e=document.createElement("img"),r=!0),g&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),r&&t.append(e)}if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){for(var a=t.children,o=void 0,i=0;i<=a.length-1;i++)(o=a[i].getAttribute("data-src"))&&(a[i].src=o);t.load()}t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));var n=",";if(t.getAttribute("data-background-delimiter")&&(n=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage="url('"+t.getAttribute("data-background-image").split(n).join("'),url('")+"')";else if(t.getAttribute("data-background-image-set")){var d=t.getAttribute("data-background-image-set").split(n),u=d[0].substr(0,d[0].indexOf(" "))||d[0];// Substring before ... 1x +u=-1===u.indexOf("url(")?"url("+u+")":u,1===d.length?t.style.backgroundImage=u:t.setAttribute("style",(t.getAttribute("style")||"")+"background-image: "+u+"; background-image: -webkit-image-set("+d+"); background-image: image-set("+d+")")}t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))},loaded:function(){}};function A(t){t.setAttribute("data-loaded",!0)}var m=function(t){return"true"===t.getAttribute("data-loaded")},v=function(t){var e=1 {{ title }} - + {% for include in config['css_includes'] %} diff --git a/templates/components/image.j2 b/templates/components/image.j2 index 368c228..a2bf796 100644 --- a/templates/components/image.j2 +++ b/templates/components/image.j2 @@ -2,10 +2,10 @@

{% if home or section %} - {{ image_title }} + {{ image_title }} {% else %} - {{ image_title }} + {{ image_title }} {% endif %}

{% endif %} \ No newline at end of file