From cc63a6f0d8ccbde179597db0ae5529c8d1d2b169 Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Wed, 4 Oct 2023 13:35:19 -0400 Subject: [PATCH] Remove uses of loading-attribute-polyfill Remains to be seen if we still need to remove/conditionally add load=lazy --- .../js/loading-attribute-polyfill.min.js | 6 - brutaldon/templates/base.html | 327 +++++++++-------- brutaldon/templates/main/toot_partial.html | 338 +++++++++--------- 3 files changed, 328 insertions(+), 343 deletions(-) delete mode 100755 brutaldon/static/js/loading-attribute-polyfill.min.js diff --git a/brutaldon/static/js/loading-attribute-polyfill.min.js b/brutaldon/static/js/loading-attribute-polyfill.min.js deleted file mode 100755 index 9f81c03..0000000 --- a/brutaldon/static/js/loading-attribute-polyfill.min.js +++ /dev/null @@ -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=''+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"); diff --git a/brutaldon/templates/base.html b/brutaldon/templates/base.html index 5574b15..0ab0da7 100644 --- a/brutaldon/templates/base.html +++ b/brutaldon/templates/base.html @@ -8,65 +8,64 @@ {% block title %} - {% if own_acct %} - brutaldon ('{{ own_acct.username }}') - {% else %} - brutaldon - {% endif %} - {% endblock %} - - {% if not preferences %} - - - - - - - {% else %} - - - - {% if not preferences.theme.is_brutalist %} - - - - {% endif %} - {% if not preferences.no_javascript %} - - - - - - - {% block page_scripts %} - {% endblock %} - {% endif %} - {% endif %} {% if own_acct %} - + brutaldon ('{{ own_acct.username }}') {% else %} - + brutaldon {% endif %} + {% endblock %} + + {% if not preferences %} + + + + + + + {% else %} + + + + {% if not preferences.theme.is_brutalist %} + + + + {% endif %} + {% if not preferences.no_javascript %} + + + + + + {% block page_scripts %} + {% endblock %} + {% endif %} + {% endif %} + {% if own_acct %} + + {% else %} + + {% endif %} - - - - - - - + + + + + + + @@ -76,100 +75,100 @@
{% block navbar %} - {% endblock %}
{% block content %} -

- Title -

-

- Brutaldon is totally a thing. -

+

+ Title +

+

+ Brutaldon is totally a thing. +

{% endblock %}
@@ -187,12 +186,10 @@
{% if preferences.theme.is_brutalist %} - + Lynx Now! + Netscape Now! {% endif %} Privacy @@ -203,28 +200,28 @@ {% if not preferences.no_javascript %} - - {% block page_scripts_inline %} - {% endblock %} + }); + {% endif %} + + {% block page_scripts_inline %} + {% endblock %} {% endif %} diff --git a/brutaldon/templates/main/toot_partial.html b/brutaldon/templates/main/toot_partial.html index 00d88f5..c8c45b9 100644 --- a/brutaldon/templates/main/toot_partial.html +++ b/brutaldon/templates/main/toot_partial.html @@ -6,202 +6,196 @@ {% if toot %} {% if active %} -
-{% else %} -
-{% endif %} +
+ {% else %} +
+ {% endif %} -
- - {% if reblog %} -

- - - -

- {% endif %} -
-
-
-

- {{ toot.account.display_name | fix_emojos:toot.account.emojis | strip_html |safe}} - - @{{ toot.account.acct }} - - {{ toot.created_at |humane_time }} - +

+ {% if reblog %} -
- Boosted by @{{ reblog_by }} +

+ + + +

{% endif %} -

- {% if toot.spoiler_text %} -
- {{ toot.spoiler_text }} +
+
+
+

+ {{ toot.account.display_name | fix_emojos:toot.account.emojis | strip_html |safe}} + + @{{ toot.account.acct }} + + {{ toot.created_at |humane_time }} + + {% if reblog %} +
+ Boosted by @{{ reblog_by }} + {% endif %} +

+ {% if toot.spoiler_text %} +
+ {{ toot.spoiler_text }} +
+ {{ toot.content | relink_toot | fix_emojos:toot.emojis | strip_html | safe }} +
+
+ {% else %}
{{ toot.content | relink_toot | fix_emojos:toot.emojis | strip_html | safe }}
- - {% else %} -
- {{ toot.content | relink_toot | fix_emojos:toot.emojis | strip_html | safe }} -
- {% endif %} + {% endif %} - {% if toot.poll %} -
- {% if toot.poll.voted or toot.poll.expired %} + {% if toot.poll %} +
+ {% if toot.poll.voted or toot.poll.expired %} {% include "polls/completed_partial.html" with toot=toot %} - {% else %} + {% else %} {% include "polls/new_partial.html" with toot=toot %} + {% endif %} +
{% endif %} -
- {% endif %} - {% if toot.card %} -
-
- {% if toot.card.image %} + {% if toot.card %} +
+
+ {% if toot.card.image %} - {% endif %} -
-

- - - {{ toot.card.title }} - - + {% endif %} +

+

+ + + {{ toot.card.title }} + + -

{{ toot.card.description |truncatechars_html:500}}

+

{{ toot.card.description |truncatechars_html:500}}

+
-
- {% endif %} + {% endif %} - {% if toot.media_attachments %} -
-
- {% for media in toot.media_attachments %} + {% if toot.media_attachments %} +
+ - {% endif %} -
- + {% endfor %} +
+ {% endif %} +
+ -
- {% if not confirm_page %} -
+ + {% endif %} -
-
-
-{% endif %} +
+
+ + {% endif %}