commit c1f22fed9b23c32095544a5f2d5a7645c429f93f parent 28e2e5e04798543acc30ed0a7d2de7dfa93d6e92 Author: Yohanes Bandung Bondowoso <hi@ybbond.id> Date: Fri, 2 Apr 2021 05:19:38 +0700 refactor: remove lazyimage script, fix remarkbox and goatcounter, fix rss Diffstat:
| M | assets/main.css | | | 9 | +++++++-- |
| M | assets/theme.css | | | 8 | ++++++++ |
| M | content/about/index.md | | | 2 | +- |
| A | layouts/_default/_markup/render-heading.rss.xml | | | 1 | + |
| M | layouts/_default/_markup/render-image.html | | | 78 | ++++++++++++++++++------------------------------------------------------------ |
| A | layouts/_default/_markup/render-image.rss.xml | | | 15 | +++++++++++++++ |
| D | layouts/_default/_markup/render-link.html | | | 54 | ------------------------------------------------------ |
| M | layouts/partials/components/goatcounter.html | | | 95 | ++++++++++++++++++++++++++++++++++++++++++++++--------------------------------- |
| M | layouts/partials/head/auth-links.html | | | 2 | ++ |
| M | layouts/partials/head/head.html | | | 4 | ---- |
| M | layouts/partials/post/remarkbox.html | | | 18 | ++++++++++-------- |
| D | static/lazyImage.js | | | 3 | --- |
12 files changed, 117 insertions(+), 172 deletions(-)
diff --git a/assets/main.css b/assets/main.css @@ -59,7 +59,7 @@ a { a:hover:not(.wm-avatar):not(.no-hover):not(.no-outline):not(.footnote-ref), a#active:not(.no-outline):not(.footnote-ref) { outline-style: solid; - outline-width: 0.3rem; + outline-width: 0.2rem; } a.button { display: inline-block; @@ -86,10 +86,15 @@ time[title] { cursor: help; } +.view-full-size svg { + width: .9em; + height: .9em; +} + .listing__post { width: 100%; display: inline-block; - padding: 0.5rem 0 0.7rem; + padding: 0.3rem 0; } .listing__post__title { margin: 0.01rem; diff --git a/assets/theme.css b/assets/theme.css @@ -55,6 +55,10 @@ outline-color: var(--light-background-hover); } + .view-full-size svg { + fill: var(--light-red); + } + .content ol li span:before { color: var(--light-red); } @@ -140,6 +144,10 @@ outline-color: var(--dark-background-hover); } + .view-full-size svg { + fill: var(--dark-red); + } + .content ol li span:before { color: var(--dark-red); } diff --git a/content/about/index.md b/content/about/index.md @@ -6,7 +6,7 @@ description: "Hi, my name is Yohanes Bandung Bondowoso" People call me **Bandung**. ૮ ・ﻌ・ა - + I am a software engineer that value and strive for good design, privacy and enjoyable services. I like to experiment with development tools or paradigms, to read, try applications, gathering informations to further enhance my expertise at my job and inspirations to make my life easier. diff --git a/layouts/_default/_markup/render-heading.rss.xml b/layouts/_default/_markup/render-heading.rss.xml @@ -0,0 +1 @@ +<h{{ .Level }}>{{ .Text | safeHTML }}</h{{ .Level }}> diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html @@ -7,73 +7,31 @@ {{ if ne .Title "" }} {{ $title = .Title }} {{ end }} -{{ $placeholder := ($image.Resize "48x q20") | images.Filter (images.GaussianBlur 6) }} -{{ $src := $image }} -{{ $src_set := ""}} -{{ $src_set = (print $image.RelPermalink " " $image.Width "w") }} -{{ $src := $image }} - -{{ if ge $image.Width "500"}} -{{ $x_small := $image.Resize "500x" }} -{{ $src_set = (print $src_set ", " $x_small.RelPermalink " 500w") }} -{{ end }} - -{{ if ge $image.Width "800"}} -{{ $small := $image.Resize "800x" }} -{{ $src_set = (print $src_set ", " $small.RelPermalink " 800w") }} -{{ end }} - -{{ if ge $image.Width "1200"}} -{{ $medium := $image.Resize "1200x" }} -{{ $src_set = (print $src_set ", " $medium.RelPermalink " 1200w") }} -{{ end }} - -{{ if gt $image.Width "1500"}} -{{ $large := $image.Resize "1500x" }} -{{ $src_set = (print $src_set ", " $large.RelPermalink " 1500w") }} -{{ end }} - -{{ $figure_class := "image-figure" }} +{{ $width := "400px" }} +{{ $height := "520px" }} +{{- if gt $image.Width $image.Height }} +{{ $width = "520px" }} +{{ $height = "380px" }} +{{- end }} -<noscript> - <style> - figure.lazy { - display: none; - } - </style> - <figure class="{{ $figure_class }}"> - <center> +<figure class="image-figure"> + <center> + <div style="width: {{ $width }};height: {{ $height }};"> <img - src="{{ $src.RelPermalink }}" + src="{{ $image.RelPermalink }}" style="max-width: 100%; height: auto;" - alt={{ $title }} - title={{ $title }} + alt={{ .Text | safeHTML }} + title={{ .Text | safeHTML }} /> <figcaption> - <em>{{ .Text }} - <a title="{{ $title }}" href="{{ $image.RelPermalink }}"> - <i class="no-sup fab fa-font-awesome-flag"></i> - </a> - </em> + <em>{{ .Text | safeHTML }} + <a title="Link to open full image." href="{{ $image.RelPermalink }}" class="view-full-size"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120"><path d="M71.2 48.8c1.6 1.6 4.1 1.6 5.6 0L112 13.6V32c0 2.4 2.2 4.4 4.7 3.9 2-.3 3.3-2.2 3.3-4.2V4c0-2.2-1.8-4-4-4H88.2c-2 0-3.8 1.4-4.2 3.3-.4 2.5 1.6 4.7 4 4.7h18.4L71.2 43.2c-1.6 1.6-1.6 4.1 0 5.6zm20.8-.9V104c0 4.4-3.6 8-8 8H16c-4.4 0-8-3.6-8-8V36c0-4.4 3.6-8 8-8h56.1c1.1 0 2.1-.4 2.8-1.2l5.1-5.1c.6-.6.2-1.7-.7-1.7H12C5.4 20 0 25.4 0 32v76c0 6.6 5.4 12 12 12h76c6.6 0 12-5.4 12-12V40.6c0-.9-1.1-1.3-1.7-.7L93.2 45c-.8.8-1.2 1.8-1.2 2.9z"></path></svg> + </a> + </em> </figcaption> - </center> - </figure> -</noscript> - -<figure class="{{ $figure_class }} lazy"> - <center> - <img class="lazyload" data-sizes="auto" src="{{ $src.RelPermalink }}" - style="max-width: 100%; height: auto;" - srcset="data:image/jpeg;base64,{{ $placeholder.Content | base64Encode }}" data-src="{{ $src.RelPermalink }}" - data-srcset="{{ $src_set }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt={{ $title }} title={{ $title }} /> - <figcaption> - <em>{{ .Text | safeHTML }} - <a title="{{ $title }}" href="{{ $image.RelPermalink }}"> - <i class="no-sup fab fa-font-awesome-flag"></i> - </a> - </em> - </figcaption> + </div> </center> </figure> diff --git a/layouts/_default/_markup/render-image.rss.xml b/layouts/_default/_markup/render-image.rss.xml @@ -0,0 +1,15 @@ +{{ $image := (.Page.Resources.GetMatch .Destination) }} + +<figure> + <center> + <img + src="{{ $image.RelPermalink }}" + style="max-width: 100%; height: auto;" + alt={{ .Text | safeHTML }} + title={{ .Text | safeHTML }} + /> + <figcaption> + <em>{{ .Text | safeHTML }}</em> + </figcaption> + </center> +</figure> diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html @@ -1,54 +0,0 @@ -<a href="{{ .Destination | safeURL }}" - {{ $brand := "font-awesome-flag" }} - {{ $title := .Title }} - - {{ $root := .Page.Site.BaseURL | replaceRE "^https?://(en.|www.|m.)?([^/]+).*" "$2" }} - {{ $domain := .Destination | replaceRE "^https?://(en.|www.|m.)?([^/]+).*" "$2" }} - {{ if eq $domain "github.com" }} - {{ $brand = "github" }} - {{ else if eq $domain "twitter.com" }} - {{ $brand = "twitter" }} - {{ else if eq $domain "patreon.com" }} - {{ $brand = "patreon" }} - {{ else if eq $domain "instagram.com" }} - {{ $brand = "instagram" }} - {{ else if eq $domain "kickstarter.com" }} - {{ $brand = "kickstarter" }} - {{ else if eq $domain "keybase.io" }} - {{ $brand = "keybase" }} - {{ else if eq $domain "openstreetmap.org" }} - {{ $brand = "periscope" }} - {{ else if eq $domain "apps.apple.com" }} - {{ $brand = "app-store" }} - {{ else if eq $domain "apple.stackexchange.com" }} - {{ $brand = "stack-exchange" }} - {{ else if eq $domain "news.ycombinator.com" }} - {{ $brand = "hacker-news" }} - {{ else if eq $domain "git.ybbond.id" }} - {{ $brand = "git-alt" }} - {{ else if or (eq $domain "wikipedia.com") (or (eq $domain "wikipedia.com") (eq $domain "id.wikipedia.org")) }} - {{ $brand = "wikipedia-w" }} - {{ end}} - - {{ $first := truncate 1 "" $domain }} - {{ $slash := (eq $first "/" )}} - {{ $hash := (eq $first "#") }} - {{ $not_internal := (eq true (and (and (ne $first "/") (ne $first "#")) (ne $domain $root))) }} - - {{ if ne .Title "" }} - title="{{ .Title }}" - {{ else if $slash }} - title="Internal link with text: {{ .Text | safeHTML }}" - {{ else if $hash }} - title="Same post link with text: {{ .Text | safeHTML }}" - {{ else }} - title="Link to {{ $domain }} with text: {{ .Text | safeHTML }}" - {{ end }} - data-goatcounter-click="{{ .Text }}" - {{ if strings.HasPrefix .Destination "http" }} - target="_blank" - rel="noreferrer noopener" - {{ else }} - data-rel="prefetch" - {{ end }} ->{{ .Text | safeHTML }}{{if and (ne false $not_internal) (ne $domain "ybbond.goatcounter.com") }} <i class="fab fa-{{ $brand }}"></i>{{ end }}</a> diff --git a/layouts/partials/components/goatcounter.html b/layouts/partials/components/goatcounter.html @@ -4,14 +4,24 @@ window.goatcounter = {endpoint: 'https://stats.ybbond.id/count'} // GoatCounter: https://www.goatcounter.com // This file (and *only* this file) is released under the ISC license: // https://opensource.org/licenses/ISC -(function() { +;(function() { 'use strict'; - if (window.goatcounter && window.goatcounter.vars) // Compatibility + if (window.goatcounter && window.goatcounter.vars) // Compatibility with very old version; do not use. window.goatcounter = window.goatcounter.vars else window.goatcounter = window.goatcounter || {} + // Load settings from data-goatcounter-settings. + var s = document.querySelector('script[data-goatcounter]') + if (s && s.dataset.goatcounterSettings) { + try { var set = JSON.parse(s.dataset.goatcounterSettings) } + catch (err) { console.error('invalid JSON in data-goatcounter-settings: ' + err) } + for (var k in set) + if (['no_onload', 'no_events', 'allow_local', 'allow_frame', 'path', 'title', 'referrer', 'event'].indexOf(k) > -1) + window.goatcounter[k] = set[k] + } + // Get all data we're going to send off to the counter endpoint. var get_data = function(vars) { var data = { @@ -75,7 +85,7 @@ window.goatcounter = {endpoint: 'https://stats.ybbond.id/count'} // Get the endpoint to send requests to. var get_endpoint = function() { - var s = document.querySelector('script[data-goatcounter]'); + var s = document.querySelector('script[data-goatcounter]') if (s && s.dataset.goatcounter) return s.dataset.goatcounter return (goatcounter.endpoint || window.counter) // counter is for compat; don't use. @@ -94,6 +104,14 @@ window.goatcounter = {endpoint: 'https://stats.ybbond.id/count'} return (loc.pathname + loc.search) || '/' } + // Run function after DOM is loaded. + var on_load = function(f) { + if (document.body === null) + document.addEventListener('DOMContentLoaded', function() { f() }, false) + else + f() + } + // Filter some requests that we (probably) don't want to count. goatcounter.filter = function() { if ('visibilityState' in document && (document.visibilityState === 'prerender' || document.visibilityState === 'hidden')) @@ -140,7 +158,7 @@ window.goatcounter = {endpoint: 'https://stats.ybbond.id/count'} img.setAttribute('aria-hidden', 'true') var rm = function() { if (img && img.parentNode) img.parentNode.removeChild(img) } - setTimeout(rm, 3000) // In case the onload isn't triggered. + setTimeout(rm, 10000) // In case the onload isn't triggered. img.addEventListener('load', rm, false) document.body.appendChild(img) } @@ -181,37 +199,39 @@ window.goatcounter = {endpoint: 'https://stats.ybbond.id/count'} // Add a "visitor counter" frame or image. window.goatcounter.visit_count = function(opt) { - opt = opt || {} - opt.type = opt.type || 'html' - opt.append = opt.append || 'body' - opt.path = opt.path || get_path() - opt.attr = opt.attr || {width: '200', height: (opt.no_branding ? '60' : '80')} - - opt.attr['src'] = get_endpoint() + 'er/' + encodeURIComponent(opt.path) + '.' + opt.type + '?' - if (opt.no_branding) opt.attr['src'] += '&no_branding=1' - if (opt.style) opt.attr['src'] += '&style=' + encodeURIComponent(opt.style) - - var tag = {png: 'img', svg: 'img', html: 'iframe'}[opt.type] - if (!tag) - return warn('visit_count: unknown type: ' + opt.type) - - if (opt.type === 'html') { - opt.attr['frameborder'] = '0' - opt.attr['scrolling'] = 'no' - } + on_load(function() { + opt = opt || {} + opt.type = opt.type || 'html' + opt.append = opt.append || 'body' + opt.path = opt.path || get_path() + opt.attr = opt.attr || {width: '200', height: (opt.no_branding ? '60' : '80')} + + opt.attr['src'] = get_endpoint() + 'er/' + encodeURIComponent(opt.path) + '.' + opt.type + '?' + if (opt.no_branding) opt.attr['src'] += '&no_branding=1' + if (opt.style) opt.attr['src'] += '&style=' + encodeURIComponent(opt.style) + + var tag = {png: 'img', svg: 'img', html: 'iframe'}[opt.type] + if (!tag) + return warn('visit_count: unknown type: ' + opt.type) + + if (opt.type === 'html') { + opt.attr['frameborder'] = '0' + opt.attr['scrolling'] = 'no' + } - var d = document.createElement(tag) - for (var k in opt.attr) - d.setAttribute(k, opt.attr[k]) + var d = document.createElement(tag) + for (var k in opt.attr) + d.setAttribute(k, opt.attr[k]) - var p = document.querySelector(opt.append) - if (!p) - return warn('visit_count: append not found: ' + opt.append) - p.appendChild(d) + var p = document.querySelector(opt.append) + if (!p) + return warn('visit_count: append not found: ' + opt.append) + p.appendChild(d) + }) } // Make it easy to skip your own views. - if (location.hash === '#toggle-goatcounter') + if (location.hash === '#toggle-goatcounter') { if (localStorage.getItem('skipgc') === 't') { localStorage.removeItem('skipgc', 't') alert('GoatCounter tracking is now ENABLED in this browser.') @@ -220,19 +240,14 @@ window.goatcounter = {endpoint: 'https://stats.ybbond.id/count'} localStorage.setItem('skipgc', 't') alert('GoatCounter tracking is now DISABLED in this browser until ' + location + ' is loaded again.') } + } - if (!goatcounter.no_onload) { - var go = function() { + if (!goatcounter.no_onload) + on_load(function() { goatcounter.count() if (!goatcounter.no_events) goatcounter.bind_events() - } - - if (document.body === null) - document.addEventListener('DOMContentLoaded', function() { go() }, false) - else - go() - } + }) })(); </script> -<noscript><img src="https://stats.ybbond.id/count?p=/test-img"></noscript> +<noscript><img src="https://stats.ybbond.id/count?p=/test-noscript"></noscript> diff --git a/layouts/partials/head/auth-links.html b/layouts/partials/head/auth-links.html @@ -1,3 +1,5 @@ +<link rel="webmention" href="https://webmention.herokuapp.com/api/webmention" /> + <link rel="webmention" href="https://webmention.io/ybbond.id/webmention" /> <link rel="pingback" href="https://webmention.io/ybbond.id/xmlrpc" /> diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html @@ -16,8 +16,6 @@ {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $rssTitle | safeHTML }} {{ end }} -<script type="application/javascript" src="{{ .Site.BaseURL }}lazyImage.js" async="true"></script> - <style> {{ with resources.Get "fonts.css" | resources.Minify }} {{ .Content | safeCSS }} @@ -44,8 +42,6 @@ {{ .Content | safeCSS }} {{ end }} </style> -<link href="/fontawesome.min.css" rel="stylesheet"> -<link href="/brands.min.css" rel="stylesheet"> <link rel="canonical" href="{{ .Permalink }}" /> diff --git a/layouts/partials/post/remarkbox.html b/layouts/partials/post/remarkbox.html @@ -9,16 +9,19 @@ </div> <script src="https://my.remarkbox.com/static/js/iframe-resizer/iframeResizer.min.js"></script> <script> - var rb_owner_key = "372c6a71-6844-11eb-8f74-040140774501"; - var thread_uri = window.location.href; - var thread_title = window.document.title; - var thread_fragment = window.location.hash; + const rb_owner_key = "372c6a71-6844-11eb-8f74-040140774501"; + let thread_uri = window.location.href; + if (thread_uri.startsWith('http://localhost:1313')) { + thread_uri = 'https://ybbond.id' + thread_uri.substring(21); + } + const thread_title = window.document.title; + const thread_fragment = window.location.hash; // rb owner was here. - var rb_src = "https://my.remarkbox.com/embed" + + const rb_src = "https://my.remarkbox.com/embed" + "?rb_owner_key=" + rb_owner_key + "&thread_title=" + encodeURI(thread_title) + - "&thread_uri=" + encodeURIComponent(thread_uri) + + "&thread_uri=" + encodeURIComponent(thread_uri) + thread_fragment; function create_remarkbox_iframe() { @@ -42,4 +45,4 @@ document.getElementById("remarkbox-iframe") ); </script> -</div>- \ No newline at end of file +</div> diff --git a/static/lazyImage.js b/static/lazyImage.js @@ -1,2 +0,0 @@ -/*! lazysizes - v5.2.0 */ -!function(a,b){var c=b(a,a.document,Date);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}("undefined"!=typeof window?window:{},function(a,b,c){"use strict";var d,e;if(function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};e=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in e||(e[b]=c[b])}(),!b||!b.getElementsByClassName)return{init:function(){},cfg:e,noSupport:!0};var f=b.documentElement,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h].bind(a),k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)})},v=function(a,c,e,f,g){var h=b.createEvent("Event");return e||(e={}),e.instance=d,h.initEvent(c,!f,!g),h.detail=e,a.dispatchEvent(h),h},w=function(b,c){var d;!g&&(d=a.picturefill||e.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),d({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c<e.minSize&&b&&!a._lazysizesWidth;)c=b.offsetWidth,b=b.parentNode;return c},z=function(){var a,c,d=[],e=[],f=d,g=function(){var b=f;for(f=d.length?e:d,a=!0,c=!1;b.length;)b.shift()();a=!1},h=function(d,e){a&&!e?d.apply(this,arguments):(f.push(d),c||(c=!0,(b.hidden?k:l)(g)))};return h._lsFlush=g,h}(),A=function(a,b){return b?function(){z(a)}:function(){var b=this,c=arguments;z(function(){a.apply(b,c)})}},B=function(a){var b,d=0,f=e.throttleDelay,g=e.ricTimeout,h=function(){b=!1,d=c.now(),a()},i=m&&g>49?function(){m(h,{timeout:g}),g!==e.ricTimeout&&(g=e.ricTimeout)}:A(function(){k(h)},!0);return function(a){var e;(a=!0===a)&&(g=33),b||(b=!0,e=f-(c.now()-d),e<0&&(e=0),a||e<9?i():k(i,e))}},C=function(a){var b,d,e=99,f=function(){b=null,a()},g=function(){var a=c.now()-d;a<e?k(g,e-a):(m||f)(f)};return function(){d=c.now(),b||(b=k(g,e))}},D=function(){var g,m,o,p,y,D,F,G,H,I,J,K,L=/^img$/i,M=/^iframe$/i,N="onscroll"in a&&!/(gle|ing)bot/.test(navigator.userAgent),O=0,P=0,Q=0,R=-1,S=function(a){Q--,(!a||Q<0||!a.target)&&(Q=0)},T=function(a){return null==K&&(K="hidden"==x(b.body,"visibility")),K||!("hidden"==x(a.parentNode,"visibility")&&"hidden"==x(a,"visibility"))},U=function(a,c){var d,e=a,g=T(a);for(G-=c,J+=c,H-=c,I+=c;g&&(e=e.offsetParent)&&e!=b.body&&e!=f;)(g=(x(e,"opacity")||1)>0)&&"visible"!=x(e,"overflow")&&(d=e.getBoundingClientRect(),g=I>d.left&&H<d.right&&J>d.top-1&&G<d.bottom+1);return g},V=function(){var a,c,h,j,k,l,n,o,q,r,s,t,u=d.elements;if((p=e.loadMode)&&Q<8&&(a=u.length)){for(c=0,R++;c<a;c++)if(u[c]&&!u[c]._lazyRace)if(!N||d.prematureUnveil&&d.prematureUnveil(u[c]))ba(u[c]);else if((o=u[c][i]("data-expand"))&&(l=1*o)||(l=P),r||(r=!e.expand||e.expand<1?f.clientHeight>500&&f.clientWidth>500?500:370:e.expand,d._defEx=r,s=r*e.expFactor,t=e.hFac,K=null,P<s&&Q<1&&R>2&&p>2&&!b.hidden?(P=s,R=0):P=p>1&&R>1&&Q<6?r:O),q!==l&&(D=innerWidth+l*t,F=innerHeight+l,n=-1*l,q=l),h=u[c].getBoundingClientRect(),(J=h.bottom)>=n&&(G=h.top)<=F&&(I=h.right)>=n*t&&(H=h.left)<=D&&(J||I||H||G)&&(e.loadHidden||T(u[c]))&&(m&&Q<3&&!o&&(p<3||R<4)||U(u[c],l))){if(ba(u[c]),k=!0,Q>9)break}else!k&&m&&!j&&Q<4&&R<4&&p>2&&(g[0]||e.preloadAfterLoad)&&(g[0]||!o&&(J||I||H||G||"auto"!=u[c][i](e.sizesAttr)))&&(j=g[0]||u[c]);j&&!k&&ba(j)}},W=B(V),X=function(a){var b=a.target;if(b._lazyCache)return void delete b._lazyCache;S(a),s(b,e.loadedClass),t(b,e.loadingClass),u(b,Z),v(b,"lazyloaded")},Y=A(X),Z=function(a){Y({target:a.target})},$=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},_=function(a){var b,c=a[i](e.srcsetAttr);(b=e.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},aa=A(function(a,b,c,d,f){var g,h,j,l,m,p;(m=v(a,"lazybeforeunveil",b)).defaultPrevented||(d&&(c?s(a,e.autosizesClass):a.setAttribute("sizes",d)),h=a[i](e.srcsetAttr),g=a[i](e.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),m={target:a},s(a,e.loadingClass),p&&(clearTimeout(o),o=k(S,2500),u(a,Z,!0)),l&&q.call(j.getElementsByTagName("source"),_),h?a.setAttribute("srcset",h):g&&!l&&(M.test(a.nodeName)?$(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,e.lazyClass),z(function(){var b=a.complete&&a.naturalWidth>1;p&&!b||(b&&s(a,"ls-is-cached"),X(m),a._lazyCache=!0,k(function(){"_lazyCache"in a&&delete a._lazyCache},9)),"lazy"==a.loading&&Q--},!0)}),ba=function(a){if(!a._lazyRace){var b,c=L.test(a.nodeName),d=c&&(a[i](e.sizesAttr)||a[i]("sizes")),f="auto"==d;(!f&&m||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,e.errorClass)||!r(a,e.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,Q++,aa(a,b,f,d,c))}},ca=C(function(){e.loadMode=3,W()}),da=function(){3==e.loadMode&&(e.loadMode=2),ca()},ea=function(){if(!m){if(c.now()-y<999)return void k(ea,999);m=!0,e.loadMode=3,W(),j("scroll",da,!0)}};return{_:function(){y=c.now(),d.elements=b.getElementsByClassName(e.lazyClass),g=b.getElementsByClassName(e.lazyClass+" "+e.preloadClass),j("scroll",W,!0),j("resize",W,!0),j("pageshow",function(a){if(a.persisted){var c=b.querySelectorAll("."+e.loadingClass);c.length&&c.forEach&&l(function(){c.forEach(function(a){a.complete&&ba(a)})})}}),a.MutationObserver?new MutationObserver(W).observe(f,{childList:!0,subtree:!0,attributes:!0}):(f[h]("DOMNodeInserted",W,!0),f[h]("DOMAttrModified",W,!0),setInterval(W,999)),j("hashchange",W,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(a){b[h](a,W,!0)}),/d$|^c/.test(b.readyState)?ea():(j("load",ea),b[h]("DOMContentLoaded",W),k(ea,2e4)),d.elements.length?(V(),z._lsFlush()):W()},checkElems:W,unveil:ba,_aLSL:da}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;f<g;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||w(a,c.detail)}),d=function(a,b,d){var e,f=a.parentNode;f&&(d=y(a,f,d),e=v(a,"lazybeforesizes",{width:d,dataAttr:!!b}),e.defaultPrevented||(d=e.detail.width)&&d!==a._lazysizesWidth&&c(a,f,e,d))},f=function(){var b,c=a.length;if(c)for(b=0;b<c;b++)d(a[b])},g=C(f);return{_:function(){a=b.getElementsByClassName(e.autosizesClass),j("resize",g)},checkElems:g,updateElem:d}}(),F=function(){!F.i&&b.getElementsByClassName&&(F.i=!0,E._(),D._())};return k(function(){e.init&&F()}),d={cfg:e,autoSizer:E,loader:D,init:F,uP:w,aC:s,rC:t,hC:r,fire:v,gW:y,rAF:z}});- \ No newline at end of file