mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-23 07:13:52 -05:00
Remove uses of loading-attribute-polyfill
Remains to be seen if we still need to remove/conditionally add load=lazy
This commit is contained in:
parent
b8ea84ade4
commit
cc63a6f0d8
@ -1,6 +0,0 @@
|
||||
/*
|
||||
* Loading attribute polyfill - https://github.com/mfranzke/loading-attribute-polyfill
|
||||
* @license Copyright(c) 2019 by Maximilian Franzke
|
||||
* Credits for the initial kickstarter / script to @Sora2455, and supported by @cbirdsong, @eklingen, @DaPo, @nextgenthemes, @diogoterremoto, @dracos, @Flimm, @TomS- and @vinyfc93 - many thanks for that !
|
||||
*/
|
||||
!function(e,t){"use strict";var r,a,o={rootMargin:"256px 0px",threshold:.01,lazyImage:'img[loading="lazy"]',lazyIframe:'iframe[loading="lazy"]'},n={loading:"loading"in HTMLImageElement.prototype&&"loading"in HTMLIFrameElement.prototype,scrolling:"onscroll"in window};function i(e){var t,r,a=[];"picture"===e.parentNode.tagName.toLowerCase()&&(t=e.parentNode,(r=t.querySelector("source[data-lazy-remove]"))&&t.removeChild(r),a=Array.prototype.slice.call(e.parentNode.querySelectorAll("source"))),a.push(e),a.forEach((function(e){e.hasAttribute("data-lazy-srcset")&&(e.setAttribute("srcset",e.getAttribute("data-lazy-srcset")),e.removeAttribute("data-lazy-srcset"))})),e.setAttribute("src",e.getAttribute("data-lazy-src")),e.removeAttribute("data-lazy-src")}function c(e){var t=document.createElement("div");for(t.innerHTML=function(e){var t=e.textContent||e.innerHTML,a="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 "+((t.match(/width=['"](\d+)['"]/)||!1)[1]||1)+" "+((t.match(/height=['"](\d+)['"]/)||!1)[1]||1)+"%27%3E%3C/svg%3E";return!n.loading&&n.scrolling&&(void 0===r?t=t.replace(/(?:\r\n|\r|\n|\t| )src=/g,' lazyload="1" src='):("picture"===e.parentNode.tagName.toLowerCase()&&(t='<source srcset="'+a+'" data-lazy-remove="true"></source>'+t),t=t.replace(/(?:\r\n|\r|\n|\t| )srcset=/g," data-lazy-srcset=").replace(/(?:\r\n|\r|\n|\t| )src=/g,' src="'+a+'" data-lazy-src='))),t}(e);t.firstChild;)n.loading||!n.scrolling||void 0===r||!t.firstChild.tagName||"img"!==t.firstChild.tagName.toLowerCase()&&"iframe"!==t.firstChild.tagName.toLowerCase()||r.observe(t.firstChild),e.parentNode.insertBefore(t.firstChild,e);e.parentNode.removeChild(e)}function d(){document.querySelectorAll("noscript."+e).forEach(c),void 0!==window.matchMedia&&window.matchMedia("print").addListener((function(e){e.matches&&document.querySelectorAll(o.lazyImage+"[data-lazy-src],"+o.lazyIframe+"[data-lazy-src]").forEach((function(e){i(e)}))}))}"undefined"!=typeof NodeList&&NodeList.prototype&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),"IntersectionObserver"in window&&(r=new IntersectionObserver((function(e,t){e.forEach((function(e){if(0!==e.intersectionRatio){var r=e.target;t.unobserve(r),i(r)}}))}),o)),a="requestAnimationFrame"in window?window.requestAnimationFrame:function(e){e()},/comp|inter/.test(document.readyState)?a(d):"addEventListener"in document?document.addEventListener("DOMContentLoaded",(function(){a(d)})):document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&&d()}))}("loading-lazy");
|
@ -46,7 +46,6 @@
|
||||
<script type="text/javascript" src="{% static 'js/intercooler.js' %}"></script>
|
||||
<script type="application/javascript" src="{% static 'js/mousetrap.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/jquery.magnific-popup.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/loading-attribute-polyfill.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/brutaldon-enhancements.js' %}"></script>
|
||||
{% block page_scripts %}
|
||||
{% endblock %}
|
||||
@ -187,12 +186,10 @@
|
||||
</div>
|
||||
<div class="level-right">
|
||||
{% if preferences.theme.is_brutalist %}
|
||||
<noscript class="loading-lazy">
|
||||
<img loading="lazy" class="level-item" src="{% static '/images/lynx.gif' %}"
|
||||
alt="Lynx Now!">
|
||||
<img loading="lazy" class="level-item" src="{% static '/images/now9.gif' %}"
|
||||
alt="Netscape Now!">
|
||||
</noscript>
|
||||
{% endif %}
|
||||
<a class="level-item is-size-7" href="{% url "privacy" %}">
|
||||
Privacy
|
||||
|
@ -71,11 +71,9 @@
|
||||
{% if toot.card.image %}
|
||||
<div class="column is-one-third">
|
||||
<a href="{{ toot.card.url }}">
|
||||
<noscript class="loading-lazy">
|
||||
<img loading="lazy" alt="{{ toot.card.title }}"
|
||||
src="{{ toot.card.image }}"
|
||||
class="is-max-128">
|
||||
</noscript>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -100,7 +98,6 @@
|
||||
{% if media.type == "image" %}
|
||||
<figure class="column attachment-image">
|
||||
<a href="{{ media.url }}">
|
||||
<noscript class="loading-lazy">
|
||||
{% if toot.sensitive and not preferences.preview_sensitive %}
|
||||
<img loading="lazy" src="{% static "images/sensitive.png" %}"
|
||||
{% else %}
|
||||
@ -117,7 +114,6 @@
|
||||
title="{{ media.description }}"
|
||||
{% endif %}
|
||||
class="image is-max-256">
|
||||
</noscript>
|
||||
</a>
|
||||
</figure>
|
||||
{% else %}
|
||||
@ -126,7 +122,6 @@
|
||||
poster="{{ media.preview_url }}">
|
||||
<source src="{{ media.url }}" type="video/mp4">
|
||||
<a href="{{ media.url }}">
|
||||
<noscript class="loading-lazy">
|
||||
{% if toot.sensitive and not preferences.preview_sensitive %}
|
||||
<img loading="lazy" src="{% static "images/sensitive.png" %}"
|
||||
{% else %}
|
||||
@ -143,7 +138,6 @@
|
||||
title="{{ media.description }}"
|
||||
{% endif %}
|
||||
class="image is-max-256">
|
||||
</noscript>
|
||||
</a>
|
||||
</video>
|
||||
</figure>
|
||||
|
Loading…
Reference in New Issue
Block a user