MCPcopy
hub / github.com/iChochy/NCE / updateLoopPlaybackUI

Method updateLoopPlaybackUI

js/ReadingSystem.js:772–797  ·  view source on GitHub ↗

* 更新循环播放 UI

()

Source from the content-addressed store, hash-verified

770 * 更新循环播放 UI
771 */
772 updateLoopPlaybackUI() {
773 if (!this.dom.loopToggleBtn) return;
774
775 const mode = this.state.loopMode;
776 const isList = mode === 'list';
777 const isSentence = mode === 'sentence';
778 const isActive = isList || isSentence;
779
780 this.dom.loopToggleBtn.setAttribute('aria-pressed', isActive ? 'true' : 'false');
781 toggleClass(this.dom.loopToggleBtn, 'active', isList);
782 toggleClass(this.dom.loopToggleBtn, 'sentence', isSentence);
783
784 let title = '列表循环';
785 let label = '列表循环';
786
787 if (isList) {
788 title = '关闭循环播放';
789 label = '关闭循环播放';
790 } else if (isSentence) {
791 title = '关闭单句循环';
792 label = '关闭单句循环';
793 }
794
795 this.dom.loopToggleBtn.title = title;
796 this.dom.loopToggleBtn.setAttribute('aria-label', label);
797 }
798
799 // =========================================================================
800 // 翻译显示控制

Callers 2

initMethod · 0.95
toggleLoopPlaybackMethod · 0.95

Calls 1

toggleClassFunction · 0.90

Tested by

no test coverage detected