From be7d72ff72edaef73d57e20ca2e9bdbc0209294a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Mon, 10 Feb 2025 19:01:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A,=20=E3=80=90Debug=E3=80=91?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.user.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.user.js b/main.user.js index 4d3a2796c..c3eac9924 100644 --- a/main.user.js +++ b/main.user.js @@ -309,13 +309,14 @@ pageType = pathMatch ? (pathMatch[1] || pathMatch.slice(-1)[0]) : false; } + console.log(`【Debug】pathname = ${pathname}, site = ${site}, isLogin = ${isLogin}, analyticsLocation = ${metaLocation}, isOrganization = ${isOrganization}, isRepository = ${isRepository}, isProfile = ${isProfile}, isSession = ${isSession}`) + // 词库校验 ================================================ if (pageType === false || !I18N[CONFIG.LANG]?.[pageType]) { console.warn(`[i18n] 页面类型未匹配或词库缺失: ${pageType}`); return false; // 明确返回 false 表示异常 } - console.log(`【Debug】pathname = ${pathname}, site = ${site}, isLogin = ${isLogin}, analyticsLocation = ${metaLocation}, isOrganization = ${isOrganization}, isRepository = ${isRepository}, isProfile = ${isProfile}, isSession = ${isSession}`) return pageType; } @@ -594,7 +595,7 @@ document.documentElement.lang = CONFIG.LANG; // 监测 HTML Lang 值, 设置中文环境 - new MutationObserver(mutations => { + new MutationObserver(() => { if (document.documentElement.lang === "en") { document.documentElement.lang = CONFIG.LANG; } @@ -607,7 +608,7 @@ firstChangeURL = true; // 页面开始切换前设置为 true }); - // 监听 Turbo 完成事件 + // 监听 Turbo 完成事件(延迟翻译) document.addEventListener('turbo:load', () => { if (!pageConfig.currentPageType) return;