From a69c9a544530c817bdc31bc5e5480f1a765ba34c Mon Sep 17 00:00:00 2001 From: zhx Date: Tue, 26 May 2026 02:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/i18n.js | 14 +++++++--- .../host-center}/index.html | 0 .../host-center}/script.js | 0 .../host-center}/style.css | 27 ++++++++++--------- 4 files changed, 25 insertions(+), 16 deletions(-) rename {host-center => gonghui/host-center}/index.html (100%) rename {host-center => gonghui/host-center}/script.js (100%) rename {host-center => gonghui/host-center}/style.css (98%) diff --git a/common/i18n.js b/common/i18n.js index 1855367..d79ae51 100644 --- a/common/i18n.js +++ b/common/i18n.js @@ -112,7 +112,7 @@ function initLanguageMenu() { document.addEventListener('click', function (event) { - var toggle = event.target.closest('[data-language-toggle]'); + var toggle = closest(event.target, '[data-language-toggle]'); var menu = document.querySelector('[data-language-menu]'); if (toggle && menu) { var expanded = toggle.getAttribute('aria-expanded') === 'true'; @@ -123,7 +123,7 @@ menu.hidden = expanded; return; } - var option = event.target.closest('[data-lang-option]'); + var option = closest(event.target, '[data-lang-option]'); if (option) { if (menu) menu.hidden = true; var button = document.querySelector('[data-language-toggle]'); @@ -131,7 +131,7 @@ load(option.getAttribute('data-lang-option')); return; } - if (menu && !event.target.closest('.language-switcher')) { + if (menu && !closest(event.target, '.language-switcher')) { menu.hidden = true; var languageButton = document.querySelector( '[data-language-toggle]' @@ -142,6 +142,14 @@ }); } + function closest(node, selector) { + while (node && node !== document) { + if (node.matches && node.matches(selector)) return node; + node = node.parentNode; + } + return null; + } + window.HyAppI18n = { load: load, apply: apply, diff --git a/host-center/index.html b/gonghui/host-center/index.html similarity index 100% rename from host-center/index.html rename to gonghui/host-center/index.html diff --git a/host-center/script.js b/gonghui/host-center/script.js similarity index 100% rename from host-center/script.js rename to gonghui/host-center/script.js diff --git a/host-center/style.css b/gonghui/host-center/style.css similarity index 98% rename from host-center/style.css rename to gonghui/host-center/style.css index 5b7324d..94dacba 100644 --- a/host-center/style.css +++ b/gonghui/host-center/style.css @@ -289,14 +289,14 @@ a { } .language-menu { - position: absolute; - z-index: 4; - top: calc(100% + 7px); - right: 0; - display: grid; - gap: 2px; - min-width: 58px; - padding: 5px; + position: absolute; + z-index: 20; + top: calc(100% + 7px); + right: 0; + display: grid; + gap: 2px; + min-width: 72px; + padding: 5px; border: 1px solid rgba(35, 40, 46, 0.1); border-radius: 8px; background: rgba(255, 255, 255, 0.96); @@ -304,11 +304,12 @@ a { } .language-menu button { - min-height: 28px; - border-radius: 6px; - color: var(--hy-theme-text, #282333); - font-size: 12px; - font-weight: 900; + min-height: 34px; + border-radius: 6px; + color: var(--hy-theme-text, #282333); + font-size: 12px; + font-weight: 900; + touch-action: manipulation; } .language-menu button.is-active {