From ea845e50495d79f48315c281186a51aa486ae263 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Sat, 2 Aug 2025 09:27:40 +0800 Subject: perf: refactor render-blocking action-menu logic - put initialization script at the end of the page - delay initialization furthermore - delay comment count fetch after giscus iframe is loaded --- layouts/_partials/posts/action-menu.html | 116 ------------------------ layouts/_partials/scripts.html | 4 + layouts/_partials/scripts/action-menu-js.html | 125 ++++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 116 deletions(-) create mode 100644 layouts/_partials/scripts/action-menu-js.html diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html index dcc881d3..602004c8 100644 --- a/layouts/_partials/posts/action-menu.html +++ b/layouts/_partials/posts/action-menu.html @@ -53,119 +53,3 @@ color: #8B0000 !important; } - - diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html index 6dc0080b..7c000323 100644 --- a/layouts/_partials/scripts.html +++ b/layouts/_partials/scripts.html @@ -7,6 +7,10 @@ {{ partial "scripts/fancybox-js" . }} {{ partial "scripts/aplayer-js" . }} +{{ if .File }} + {{ partial "scripts/action-menu-js" (.File.UniqueID | urlize) }} +{{ end }} + {{ with resources.Get "js/tooltip.js" }} {{ end }} diff --git a/layouts/_partials/scripts/action-menu-js.html b/layouts/_partials/scripts/action-menu-js.html new file mode 100644 index 00000000..66673b71 --- /dev/null +++ b/layouts/_partials/scripts/action-menu-js.html @@ -0,0 +1,125 @@ +{{ $pageId := . }} + -- cgit v1.2.3