mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2023-12-21 10:22:58 +01:00
footer: simpify loading hljs,
defer and beautify
This commit is contained in:
parent
3c28b8a8b2
commit
fd06af55fc
@ -17,9 +17,9 @@
|
|||||||
</a>
|
</a>
|
||||||
{{- partial "extend_footer.html" . -}}
|
{{- partial "extend_footer.html" . -}}
|
||||||
{{ if in site.Params.mainSections .Type }}
|
{{ if in site.Params.mainSections .Type }}
|
||||||
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint -}}
|
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }}
|
||||||
<script src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}"></script>
|
<script defer src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}"
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
onload="hljs.initHighlightingOnLoad();"></script>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<script>
|
<script>
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
@ -46,9 +46,11 @@
|
|||||||
mybutton.style.opacity = "0";
|
mybutton.style.opacity = "0";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function menu_on_scroll() {
|
function menu_on_scroll() {
|
||||||
localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft);
|
localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{{- if (not .Site.Params.disableThemeToggle) }}
|
{{- if (not .Site.Params.disableThemeToggle) }}
|
||||||
<script>
|
<script>
|
||||||
@ -61,10 +63,12 @@
|
|||||||
localStorage.setItem("pref-theme", 'dark');
|
localStorage.setItem("pref-theme", 'dark');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{/* case where owner disables theme button after deployment, this resets the stored theme */}}
|
{{/* case where owner disables theme button after deployment, this resets the stored theme */}}
|
||||||
<script>
|
<script>
|
||||||
localStorage.removeItem("pref-theme");
|
localStorage.removeItem("pref-theme");
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user