From b3a3337c61539a4427131bdd724188aa0260940c Mon Sep 17 00:00:00 2001 From: awesomeYG <993631441@qq.com> Date: Thu, 21 Dec 2023 18:48:54 +0800 Subject: [PATCH 1/3] fix: deffer add script --- next.config.js | 2 +- public/cnzz.js | 5 +---- src/pages/_document.tsx | 2 +- src/utils/tools.ts | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/next.config.js b/next.config.js index 0163113..cb41d95 100644 --- a/next.config.js +++ b/next.config.js @@ -15,7 +15,7 @@ const nextConfig = withPlugins([withTM], { source: '/', destination: '/tools', basePath: false, - permanent: false + permanent: true } ] } diff --git a/public/cnzz.js b/public/cnzz.js index 21a91b4..848aa6a 100644 --- a/public/cnzz.js +++ b/public/cnzz.js @@ -15,8 +15,5 @@ if ( var riverTag = document.createElement('script'); riverTag.src = 'https://rivers.chaitin.cn/main-header.js'; document.head.append(riverTag); - - document.addEventListener('DOMContentLoaded', function () { - document.body.style.paddingTop = '64px'; - }); + document.body.style.paddingTop = '64px'; } diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 06c3c9b..154eaab 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -20,7 +20,7 @@ export default function MyDocument({ emotionStyleTags }: MyDocumentProps) { return (
- + {emotionStyleTags} diff --git a/src/utils/tools.ts b/src/utils/tools.ts index 8c7c5a7..4fc4f49 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -31,7 +31,6 @@ export type Tool = { }; export const routesMenu: Tool[] = [ - // { icon: dot_blue, label: '网络', children: [] }, { label: 'URL 编解码', tags: [Tags.CODE], From e44fb26c84654e2af1310aed4a82d17ce33f23a4 Mon Sep 17 00:00:00 2001 From: awesomeYG <993631441@qq.com> Date: Thu, 21 Dec 2023 19:23:17 +0800 Subject: [PATCH 2/3] fix: distinguish main_header domain --- public/cnzz.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/cnzz.js b/public/cnzz.js index 848aa6a..eda09d7 100644 --- a/public/cnzz.js +++ b/public/cnzz.js @@ -12,8 +12,11 @@ if ( cnzzTag.src = 'https://s4.cnzz.com/z.js?id=1281132544&async=1'; document.head.append(cnzzTag); + const DOMAIN = location?.hostname?.includes("dev") + ? "https://dev.rivers.ctopt.cn" + : "https://rivers.chaitin.cn"; var riverTag = document.createElement('script'); - riverTag.src = 'https://rivers.chaitin.cn/main-header.js'; + riverTag.src = DOMAIN + '/main-header.js'; document.head.append(riverTag); document.body.style.paddingTop = '64px'; } From 01fe5ffffa7d538e5db7e7d2f0e508803a0ece8d Mon Sep 17 00:00:00 2001 From: awesomeYG <993631441@qq.com> Date: Thu, 21 Dec 2023 19:52:31 +0800 Subject: [PATCH 3/3] fix: delete root dir cnzz --- public/{tools => }/Mono.ttf | Bin public/tools/cnzz.js | 22 ---------------------- 2 files changed, 22 deletions(-) rename public/{tools => }/Mono.ttf (100%) delete mode 100644 public/tools/cnzz.js diff --git a/public/tools/Mono.ttf b/public/Mono.ttf similarity index 100% rename from public/tools/Mono.ttf rename to public/Mono.ttf diff --git a/public/tools/cnzz.js b/public/tools/cnzz.js deleted file mode 100644 index 21a91b4..0000000 --- a/public/tools/cnzz.js +++ /dev/null @@ -1,22 +0,0 @@ -if ( - [ - 'rivers.chaitin.cn', - 'dev.rivers.ctopt.cn', - '127.0.0.1', - 'localhost', - ].includes(document.domain) -) { - window.is_river = true; - var _czc = _czc || []; - var cnzzTag = document.createElement('script'); - cnzzTag.src = 'https://s4.cnzz.com/z.js?id=1281132544&async=1'; - document.head.append(cnzzTag); - - var riverTag = document.createElement('script'); - riverTag.src = 'https://rivers.chaitin.cn/main-header.js'; - document.head.append(riverTag); - - document.addEventListener('DOMContentLoaded', function () { - document.body.style.paddingTop = '64px'; - }); -}