Make scripts defered for (potential) load time boost
This commit is contained in:
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased](https://codeberg.org/daudix/duckquill/compare/v5.2.0...main)
|
## [Unreleased](https://codeberg.org/daudix/duckquill/compare/v5.2.0...main)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add `defer` attribute to scripts.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Restly the heading anchors.
|
- Restly the heading anchors.
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
const closable = document.querySelectorAll("details.closable");
|
const closable = document.querySelectorAll("details.closable");
|
||||||
|
|
||||||
closable.forEach((detail) => {
|
closable.forEach((detail) => {
|
||||||
@ -26,4 +25,3 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
window.defaultTheme = defaultTheme;
|
window.defaultTheme = defaultTheme;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Deferred Icon Update and Theme Switching
|
// Icon Update and Theme Switching
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
function setTheme(theme, saveToLocalStorage = false) {
|
function setTheme(theme, saveToLocalStorage = false) {
|
||||||
if (theme === "system") {
|
if (theme === "system") {
|
||||||
document.documentElement.removeAttribute("data-theme");
|
document.documentElement.removeAttribute("data-theme");
|
||||||
@ -93,4 +92,3 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
// Make the switchTheme function accessible globally
|
// Make the switchTheme function accessible globally
|
||||||
window.switchTheme = switchTheme;
|
window.switchTheme = switchTheme;
|
||||||
});
|
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
{%- if scripts | length > 0 %}
|
{%- if scripts | length > 0 %}
|
||||||
{%- for script in scripts %}
|
{%- for script in scripts %}
|
||||||
<script type="text/javascript" {% if script == "count.js" %}data-goatcounter="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count"{% endif %} src="{{ get_url(path=script) | safe }}"></script>
|
<script type="text/javascript" defer {% if script == "count.js" %}data-goatcounter="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count"{% endif %} src="{{ get_url(path=script) | safe }}"></script>
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user