From 7530d32dd138c8829ca8255ec4b1f565d8b7cbdb Mon Sep 17 00:00:00 2001 From: xunbu Date: Tue, 15 Jul 2025 21:04:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docutranslate/static/index.html | 48 +++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/docutranslate/static/index.html b/docutranslate/static/index.html index ad79f85..2ceb6f2 100644 --- a/docutranslate/static/index.html +++ b/docutranslate/static/index.html @@ -227,8 +227,13 @@ - +
+ + +
@@ -270,8 +275,13 @@ - +
+ + +
@@ -853,7 +863,10 @@ } const requiredInputs = [apikeyInput, modelInput]; if (platformSelect.value === 'custom') requiredInputs.push(baseUrlInput); - if (convertEnginSelect.value === 'mineru' && !mineruTokenInput.value.trim() && (!["md", "txt"].includes(state.file.name.split('.').pop()))) { + // 只有当文件不是markdown或txt时,才需要mineru_token + const fileExtension = state.file.name.split('.').pop().toLowerCase(); + const isTextFile = ['md', 'txt'].includes(fileExtension); + if (convertEnginSelect.value === 'mineru' && !mineruTokenInput.value.trim() && !isTextFile) { requiredInputs.push(mineruTokenInput); } @@ -1237,6 +1250,26 @@ } } + // --- Password Toggle Functionality --- + function setupPasswordToggle(button) { + const targetId = button.dataset.target; + const passwordInput = document.getElementById(targetId); + const icon = button.querySelector('i'); + + button.addEventListener('click', () => { + if (passwordInput.type === 'password') { + passwordInput.type = 'text'; + icon.classList.remove('bi-eye-slash'); + icon.classList.add('bi-eye'); + } else { + passwordInput.type = 'password'; + icon.classList.remove('bi-eye'); + icon.classList.add('bi-eye-slash'); + } + }); + } + + // --- Initialization --- async function init() { isAdminMode = window.location.pathname === '/admin'; @@ -1273,6 +1306,11 @@ setupSlider(concurrentSlider, concurrentDisplay, concurrentReset, 'concurrent', defaultParams); setupSlider(temperatureSlider, temperatureDisplay, temperatureReset, 'temperature', defaultParams); + // Setup password toggles + document.querySelectorAll('.toggle-password').forEach(button => { + setupPasswordToggle(button); + }); + if (isAdminMode) { document.title = "DocuTranslate - Admin Panel"; try {