🔥 Refactor struct & code for loading 3rd scripts.

This commit is contained in:
凡梦星尘
2022-10-27 15:57:42 +08:00
parent 9160a33053
commit 0d1b00f7b0
21 changed files with 302 additions and 210 deletions

View File

@@ -1,22 +1,2 @@
{{ partialCached "scripts/global.html" . }}
{{ if or .Params.math .Site.Params.math }}
{{ partialCached "_thirdparty/others/math.html" . }}
{{ end }}
{{ if .Params.mermaid }}
{{ partialCached "_thirdparty/others/mermaid.html" . }}
{{ end }}
{{ if .Site.Params.footer.translate }}
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
const element = '#gtranslate';
if (!NexT.utils.checkDOMExist(element)) return;
NexT.utils.lazyLoadComponent(element).then(() => {
window.translateelement_styles='/css/google-translate.min.css';
NexT.utils.getScript('/js/third-party/google-translate.min.js');
});
});
</script>
{{ end }}
{{- partialCached "scripts/global.html" . -}}
{{- partial "scripts/plugins.html" . -}}