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 {