From 70cfd74bcfab6a74dd9755c1946109e6576158a8 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 18 Jul 2025 18:46:45 +0800 Subject: refactor: make partials of all embeded JavaScript code --- layouts/_partials/posts/toc.html | 40 ----------------- layouts/_partials/scripts.html | 67 ++-------------------------- layouts/_partials/scripts/aplayer-js.html | 50 +++++++++++++++++++++ layouts/_partials/scripts/fancybox-js.html | 4 ++ layouts/_partials/scripts/littlefoot-js.html | 6 +++ layouts/_partials/scripts/toc-js.html | 41 +++++++++++++++++ 6 files changed, 105 insertions(+), 103 deletions(-) create mode 100644 layouts/_partials/scripts/aplayer-js.html create mode 100644 layouts/_partials/scripts/fancybox-js.html create mode 100644 layouts/_partials/scripts/littlefoot-js.html create mode 100644 layouts/_partials/scripts/toc-js.html (limited to 'layouts') diff --git a/layouts/_partials/posts/toc.html b/layouts/_partials/posts/toc.html index 0af63e4a..7a4a63cf 100644 --- a/layouts/_partials/posts/toc.html +++ b/layouts/_partials/posts/toc.html @@ -6,44 +6,4 @@ class="sticky top-12 text-size-sm 2xl:text-size-base px-8" >{{ .TableOfContents }} - - {{ end }} diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html index 12beca10..ac62974b 100644 --- a/layouts/_partials/scripts.html +++ b/layouts/_partials/scripts.html @@ -1,67 +1,8 @@ - {{- range .Site.Params.externalJSFiles }} {{- end }} -{{- if or (in .Section "posts") (in .Section "cards") (in .Section "library") (eq .Type "single") }} - - -{{- end }} - -{{ if .Params.aplayer }} - -{{ end }} - - +{{ partial "scripts/toc-js" . }} +{{ partial "scripts/littlefoot-js" . }} +{{ partial "scripts/fancybox-js" . }} +{{ partial "scripts/aplayer-js" . }} diff --git a/layouts/_partials/scripts/aplayer-js.html b/layouts/_partials/scripts/aplayer-js.html new file mode 100644 index 00000000..2b22702c --- /dev/null +++ b/layouts/_partials/scripts/aplayer-js.html @@ -0,0 +1,50 @@ +{{ if .Params.aplayer }} + +{{ end }} diff --git a/layouts/_partials/scripts/fancybox-js.html b/layouts/_partials/scripts/fancybox-js.html new file mode 100644 index 00000000..c9543a01 --- /dev/null +++ b/layouts/_partials/scripts/fancybox-js.html @@ -0,0 +1,4 @@ +{{- if or (in .Section "posts") (in .Section "cards") (in .Section "library") (eq .Type "single") }} + + +{{- end }} diff --git a/layouts/_partials/scripts/littlefoot-js.html b/layouts/_partials/scripts/littlefoot-js.html new file mode 100644 index 00000000..2601b7c4 --- /dev/null +++ b/layouts/_partials/scripts/littlefoot-js.html @@ -0,0 +1,6 @@ + diff --git a/layouts/_partials/scripts/toc-js.html b/layouts/_partials/scripts/toc-js.html new file mode 100644 index 00000000..110f2357 --- /dev/null +++ b/layouts/_partials/scripts/toc-js.html @@ -0,0 +1,41 @@ +{{ if .Params.toc }} + +{{ end }} -- cgit v1.2.3