mirror of
https://github.com/Minidoracat/mcp-feedback-enhanced.git
synced 2025-07-27 02:22:26 +08:00
✨ 自動提交倒數增加暫停和開始按鈕
This commit is contained in:
parent
2ec789280a
commit
5e103f10d8
@ -434,7 +434,10 @@
|
|||||||
"enabled": "Enabled",
|
"enabled": "Enabled",
|
||||||
"disabled": "Disabled",
|
"disabled": "Disabled",
|
||||||
"executing": "Executing auto submit...",
|
"executing": "Executing auto submit...",
|
||||||
"countdownLabel": "Submit Countdown"
|
"countdownLabel": "Submit Countdown",
|
||||||
|
"pauseCountdown": "Pause Countdown",
|
||||||
|
"resumeCountdown": "Resume Countdown",
|
||||||
|
"paused": "Auto submit paused"
|
||||||
},
|
},
|
||||||
"audio": {
|
"audio": {
|
||||||
"notification": {
|
"notification": {
|
||||||
|
@ -430,7 +430,10 @@
|
|||||||
"enabled": "已启用",
|
"enabled": "已启用",
|
||||||
"disabled": "已停用",
|
"disabled": "已停用",
|
||||||
"executing": "正在执行自动提交...",
|
"executing": "正在执行自动提交...",
|
||||||
"countdownLabel": "提交倒数"
|
"countdownLabel": "提交倒数",
|
||||||
|
"pauseCountdown": "暂停倒数",
|
||||||
|
"resumeCountdown": "恢复倒数",
|
||||||
|
"paused": "自动提交已暂停"
|
||||||
},
|
},
|
||||||
"audio": {
|
"audio": {
|
||||||
"notification": {
|
"notification": {
|
||||||
|
@ -435,7 +435,10 @@
|
|||||||
"enabled": "已啟用",
|
"enabled": "已啟用",
|
||||||
"disabled": "已停用",
|
"disabled": "已停用",
|
||||||
"executing": "正在執行自動提交...",
|
"executing": "正在執行自動提交...",
|
||||||
"countdownLabel": "提交倒數"
|
"countdownLabel": "提交倒數",
|
||||||
|
"pauseCountdown": "暫停倒數",
|
||||||
|
"resumeCountdown": "恢復倒數",
|
||||||
|
"paused": "自動提交已暫停"
|
||||||
},
|
},
|
||||||
"audio": {
|
"audio": {
|
||||||
"notification": {
|
"notification": {
|
||||||
|
@ -108,6 +108,43 @@
|
|||||||
font-size: 12px;
|
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 {
|
.connection-status-compact {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
@ -347,6 +347,17 @@
|
|||||||
// ESC 鍵功能已移除 - 避免意外清空用戶輸入的文字
|
// 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();
|
self.settingsManager.setupEventListeners();
|
||||||
|
|
||||||
@ -1500,6 +1511,35 @@
|
|||||||
self.hideCountdownDisplay();
|
self.hideCountdownDisplay();
|
||||||
|
|
||||||
console.log('⏸️ 自動提交倒數計時已停止');
|
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) {
|
if (countdownDisplay) {
|
||||||
countdownDisplay.style.display = 'none';
|
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');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清理資源
|
* 清理資源
|
||||||
*/
|
*/
|
||||||
|
@ -433,6 +433,13 @@
|
|||||||
<span class="info-separator">·</span>
|
<span class="info-separator">·</span>
|
||||||
<span>⏱️</span>
|
<span>⏱️</span>
|
||||||
<span id="countdownTimer" class="countdown-timer">--:--</span>
|
<span id="countdownTimer" class="countdown-timer">--:--</span>
|
||||||
|
<button id="countdownPauseBtn" class="countdown-control-btn"
|
||||||
|
data-i18n-title="autoSubmit.pauseCountdown"
|
||||||
|
title="暫停倒數"
|
||||||
|
aria-label="暫停/恢復倒數">
|
||||||
|
<span class="pause-icon">⏸</span>
|
||||||
|
<span class="resume-icon" style="display: none;">▶</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 分隔符 -->
|
<!-- 分隔符 -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user