diff --git a/src/mcp_feedback_enhanced/web/locales/en/translation.json b/src/mcp_feedback_enhanced/web/locales/en/translation.json index eea72ef..7ab9db2 100644 --- a/src/mcp_feedback_enhanced/web/locales/en/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/en/translation.json @@ -434,7 +434,10 @@ "enabled": "Enabled", "disabled": "Disabled", "executing": "Executing auto submit...", - "countdownLabel": "Submit Countdown" + "countdownLabel": "Submit Countdown", + "pauseCountdown": "Pause Countdown", + "resumeCountdown": "Resume Countdown", + "paused": "Auto submit paused" }, "audio": { "notification": { diff --git a/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json b/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json index 29f0830..39efe73 100644 --- a/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json @@ -430,7 +430,10 @@ "enabled": "已启用", "disabled": "已停用", "executing": "正在执行自动提交...", - "countdownLabel": "提交倒数" + "countdownLabel": "提交倒数", + "pauseCountdown": "暂停倒数", + "resumeCountdown": "恢复倒数", + "paused": "自动提交已暂停" }, "audio": { "notification": { diff --git a/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json b/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json index 57dbc8c..b60cda7 100644 --- a/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json @@ -435,7 +435,10 @@ "enabled": "已啟用", "disabled": "已停用", "executing": "正在執行自動提交...", - "countdownLabel": "提交倒數" + "countdownLabel": "提交倒數", + "pauseCountdown": "暫停倒數", + "resumeCountdown": "恢復倒數", + "paused": "自動提交已暫停" }, "audio": { "notification": { diff --git a/src/mcp_feedback_enhanced/web/static/css/session-management.css b/src/mcp_feedback_enhanced/web/static/css/session-management.css index 5c91a40..9a52269 100644 --- a/src/mcp_feedback_enhanced/web/static/css/session-management.css +++ b/src/mcp_feedback_enhanced/web/static/css/session-management.css @@ -108,6 +108,43 @@ font-size: 12px; } +/* 倒數計時器控制按鈕 */ +.countdown-control-btn { + background: transparent; + border: none; + padding: 2px 6px; + margin-left: 4px; + cursor: pointer; + font-size: 12px; + color: var(--warning-color); + transition: all 0.2s ease; + border-radius: 4px; + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 20px; + height: 20px; +} + +.countdown-control-btn:hover { + background: rgba(255, 152, 0, 0.2); +} + +.countdown-control-btn:active { + transform: scale(0.95); +} + +/* 暫停狀態的計時器樣式 */ +.countdown-display-compact.paused .countdown-timer { + opacity: 0.6; + animation: pause-blink 1.5s ease-in-out infinite; +} + +@keyframes pause-blink { + 0%, 100% { opacity: 0.6; } + 50% { opacity: 0.3; } +} + .connection-status-compact { margin-left: auto; } diff --git a/src/mcp_feedback_enhanced/web/static/js/app.js b/src/mcp_feedback_enhanced/web/static/js/app.js index 7b23812..55f098c 100644 --- a/src/mcp_feedback_enhanced/web/static/js/app.js +++ b/src/mcp_feedback_enhanced/web/static/js/app.js @@ -347,6 +347,17 @@ // ESC 鍵功能已移除 - 避免意外清空用戶輸入的文字 }); + // 倒數計時器暫停/恢復按鈕 + const countdownPauseBtn = window.MCPFeedback.Utils.safeQuerySelector('#countdownPauseBtn'); + if (countdownPauseBtn) { + countdownPauseBtn.addEventListener('click', function(e) { + e.preventDefault(); + if (self.autoSubmitManager) { + self.autoSubmitManager.togglePause(); + } + }); + } + // 設置設定管理器的事件監聽器 self.settingsManager.setupEventListeners(); @@ -1500,6 +1511,35 @@ self.hideCountdownDisplay(); console.log('⏸️ 自動提交倒數計時已停止'); + }, + + // 暫停倒數計時 + pause: function() { + if (this.countdown && this.countdown.pause) { + this.countdown.pause(); + self.updateCountdownPauseState(true); + console.log('⏸ 自動提交倒數計時已暫停'); + } + }, + + // 恢復倒數計時 + resume: function() { + if (this.countdown && this.countdown.resume) { + this.countdown.resume(); + self.updateCountdownPauseState(false); + console.log('▶ 自動提交倒數計時已恢復'); + } + }, + + // 切換暫停/恢復狀態 + togglePause: function() { + if (!this.countdown) return; + + if (this.countdown.isPaused()) { + this.resume(); + } else { + this.pause(); + } } }; @@ -1732,6 +1772,8 @@ if (countdownDisplay) { countdownDisplay.style.display = 'none'; + // 重置暫停狀態 + this.updateCountdownPauseState(false); } }; @@ -1790,6 +1832,44 @@ } }; + /** + * 更新倒數計時器暫停狀態 + */ + FeedbackApp.prototype.updateCountdownPauseState = function(isPaused) { + const countdownDisplay = document.getElementById('countdownDisplay'); + const pauseBtn = document.getElementById('countdownPauseBtn'); + + if (!countdownDisplay || !pauseBtn) return; + + // 更新暫停/恢復圖標 + const pauseIcon = pauseBtn.querySelector('.pause-icon'); + const resumeIcon = pauseBtn.querySelector('.resume-icon'); + + if (isPaused) { + countdownDisplay.classList.add('paused'); + if (pauseIcon) pauseIcon.style.display = 'none'; + if (resumeIcon) resumeIcon.style.display = 'inline'; + + // 更新按鈕的 tooltip + const resumeTitle = window.i18nManager ? + window.i18nManager.t('autoSubmit.resumeCountdown', '恢復倒數') : + '恢復倒數'; + pauseBtn.setAttribute('title', resumeTitle); + pauseBtn.setAttribute('data-i18n-title', 'autoSubmit.resumeCountdown'); + } else { + countdownDisplay.classList.remove('paused'); + if (pauseIcon) pauseIcon.style.display = 'inline'; + if (resumeIcon) resumeIcon.style.display = 'none'; + + // 更新按鈕的 tooltip + const pauseTitle = window.i18nManager ? + window.i18nManager.t('autoSubmit.pauseCountdown', '暫停倒數') : + '暫停倒數'; + pauseBtn.setAttribute('title', pauseTitle); + pauseBtn.setAttribute('data-i18n-title', 'autoSubmit.pauseCountdown'); + } + }; + /** * 清理資源 */ diff --git a/src/mcp_feedback_enhanced/web/templates/feedback.html b/src/mcp_feedback_enhanced/web/templates/feedback.html index 2b3f774..94462f7 100644 --- a/src/mcp_feedback_enhanced/web/templates/feedback.html +++ b/src/mcp_feedback_enhanced/web/templates/feedback.html @@ -433,6 +433,13 @@ · ⏱️ --:-- +