Defer JavaScript loading

This avoids waiting for the JS to download before rendering the page.
This commit is contained in:
Ben Sturmfels 2024-03-22 10:38:32 +11:00
parent da121e5eb4
commit 374ec19b77
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
4 changed files with 5 additions and 5 deletions

View file

@ -5,7 +5,7 @@
{% block category %}supporter{% endblock %}
{% block head %}
<script type="text/javascript" src="{% static 'js/supporter-page.js' %}"></script>
<script type="text/javascript" src="{% static 'js/\supporter-page.js' %}" defer></script>
<link href="{% static 'css/forms.css' %}" rel="stylesheet" type="text/css"/>
{% endblock %}

View file

@ -15,8 +15,8 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/tachyons.css' %}"/>
<link rel="stylesheet" type="text/css" media="screen" href="{% static 'css/conservancy.css' %}" />
<link rel="stylesheet" type="text/css" media="(min-width: 67em)" href="{% static 'css/conservancy-bigscreen.css' %}" />
<script type="text/javascript" src="{% static 'js/jquery-1.7.2.js' %}"></script>
<script type="text/javascript" src="{% static 'js/conservancy.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery-1.7.2.js' %}" defer></script>
<script type="text/javascript" src="{% static 'js/conservancy.js' %}" defer></script>
{% block head %}{% endblock %}
</head>

View file

@ -3,7 +3,7 @@
{% block head %}
<script type="text/javascript">
$(function () {
window.addEventListener('DOMContentLoaded', function() {
function my_display (sel, b) {
if (b) { sel.slideDown(); }
else { sel.slideUp(); }

View file

@ -4,7 +4,7 @@
{% block category %}sustainer{% endblock %}
{% block head %}
<script type="text/javascript" src="{% static 'js/supporter-page.js' %}"></script>
<script type="text/javascript" src="{% static 'js/supporter-page.js' %}" defer></script>
<link href="{% static 'css/forms.css' %}" rel="stylesheet" type="text/css"/>
{% include "opengraph_partial.html" with url="/sustainer/" title="Support Conservancy!" description="Software freedom is critical to many of today&rsquo;s most pressing social issues, but it&rsquo;s only effective when FOSS is for everyone. Support Conservancy today to help make that happen!" %}
{% include "opengraph_urllist_partial.html" with property='image' urls='' fallback='/static/img/conservancy-logo.png' %}