From d81b4849161ce645321c9e5541cb61096bbfd096 Mon Sep 17 00:00:00 2001 From: xing Date: Wed, 5 Jul 2023 23:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=AE=F0=9F=A4=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/theme/wp/customheader.go | 12 +- app/theme/wp/defaultscriptload.go | 8 +- app/theme/wp/scriptloader.go | 332 ++++++++++++++++++++++++++---- helper/maps/function.go | 4 +- helper/maps/function_test.go | 2 +- helper/strings/strings.go | 4 +- 6 files changed, 309 insertions(+), 53 deletions(-) diff --git a/app/theme/wp/customheader.go b/app/theme/wp/customheader.go index a650893..4711238 100644 --- a/app/theme/wp/customheader.go +++ b/app/theme/wp/customheader.go @@ -122,7 +122,7 @@ func CustomVideo(h *Handle, scene ...string) (ok bool) { logs.Error(err, "get headerVideo fail", mod.HeaderVideo) return } - scripts := []string{ + scriptss := []string{ "/wp-includes/js/dist/vendor/wp-polyfill-inert.min.js", "/wp-includes/js/dist/vendor/regenerator-runtime.min.js", "/wp-includes/js/dist/vendor/wp-polyfill.min.js", @@ -132,11 +132,11 @@ func CustomVideo(h *Handle, scene ...string) (ok bool) { "/wp-includes/js/dist/a11y.min.js", "/wp-includes/js/wp-custom-header.min.js", } - scripts = slice.Map(scripts, func(t string) string { + scriptss = slice.Map(scriptss, func(t string) string { return fmt.Sprintf(` -`, t, str.Replaces(t, [][]string{{ +`, t, str.Replaces(t, []string{ "/wp-includes/js/dist/vendor/", "/wp-includes/js/dist/", "/wp-includes/js/", ".min.js", ".js", "wp-", "", - }})) + })) }) var tr = `