From 883cb28e6a37e753d5e7b43ac91d6e884eaa3458 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Thu, 19 Dec 2024 14:34:51 +0800 Subject: refactor: third-party libraries loading logic --- themes/yinyang/layouts/_default/single.html | 8 ++---- themes/yinyang/layouts/partials/head/css.html | 1 - .../yinyang/layouts/partials/head/headscript.html | 31 ++++++++++++++------ themes/yinyang/layouts/partials/scripts.html | 33 ++++++++++++++++++---- .../layouts/partials/snippets/waline-init.html | 20 ------------- 5 files changed, 51 insertions(+), 42 deletions(-) delete mode 100644 themes/yinyang/layouts/partials/snippets/waline-init.html diff --git a/themes/yinyang/layouts/_default/single.html b/themes/yinyang/layouts/_default/single.html index 49abf0ff..a1b0b111 100644 --- a/themes/yinyang/layouts/_default/single.html +++ b/themes/yinyang/layouts/_default/single.html @@ -15,7 +15,7 @@ {{ . }} {{ end }} - +
{{ if .Date }} @@ -55,10 +55,6 @@
-
{{ end }} @@ -66,4 +62,4 @@ -{{ partial "snippets/document-end.html" . }} \ No newline at end of file +{{ partial "snippets/document-end.html" . }} diff --git a/themes/yinyang/layouts/partials/head/css.html b/themes/yinyang/layouts/partials/head/css.html index 5622a117..7e342da4 100644 --- a/themes/yinyang/layouts/partials/head/css.html +++ b/themes/yinyang/layouts/partials/head/css.html @@ -18,7 +18,6 @@ href="https://unpkg.com/@waline/client@v3/dist/waline.css" /> - + + + diff --git a/themes/yinyang/layouts/partials/scripts.html b/themes/yinyang/layouts/partials/scripts.html index a0823181..a2cbb997 100644 --- a/themes/yinyang/layouts/partials/scripts.html +++ b/themes/yinyang/layouts/partials/scripts.html @@ -1,10 +1,31 @@ - + + diff --git a/themes/yinyang/layouts/partials/snippets/waline-init.html b/themes/yinyang/layouts/partials/snippets/waline-init.html deleted file mode 100644 index 4d89fc93..00000000 --- a/themes/yinyang/layouts/partials/snippets/waline-init.html +++ /dev/null @@ -1,20 +0,0 @@ -const options = { - el: '#waline', - serverURL: 'https://waline.geedea.pro', - dark: 'auto', - pageview: true, - search: false -}; - -if (location.href.includes('localhost') || location.href.includes('127.0.0.1')) { - options.pageview = false; -} - -if (!window.location.pathname.endsWith('/')) { - options.path = window.location.pathname + '/' -} - -init(options); - -const walineButton = document.querySelector("#waline > div > div.wl-comment > div > div.wl-footer > div.wl-info > button.primary.wl-btn"); -walineButton.addEventListener("click", () => umami.track("Comment")) -- cgit v1.2.3