fix & feat: resolve user reports #1 through #8 (TTS voice & speed, modals, scrollbar, CEFR hint, SRS grammar exclusion, global word lookup)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// =======================================================================
|
||||
|
||||
import { api } from './api.js';
|
||||
import { escapeHtml, escapeRegex, slugify, showToast, playAudio } from './ui.js';
|
||||
import { escapeHtml, escapeRegex, slugify, showToast, playAudio, playTextSpeech } from './ui.js';
|
||||
import { getAllCards, fetchCards } from './dictionary.js';
|
||||
|
||||
// Reader State & Appearance Settings
|
||||
@@ -2251,6 +2251,7 @@ export function initReader() {
|
||||
|
||||
const popupAudioBtn = document.getElementById('popup-audio-btn');
|
||||
const popupAudioSentenceBtn = document.getElementById('popup-audio-sentence-btn');
|
||||
const popupAudioSentenceSlowBtn = document.getElementById('popup-audio-sentence-slow-btn');
|
||||
const popupAudioRuBtn = document.getElementById('popup-audio-ru-btn');
|
||||
const popupTranslateSentenceBtn = document.getElementById('popup-translate-sentence-btn');
|
||||
const popupUseContextMeaningBtn = document.getElementById('popup-use-context-meaning-btn');
|
||||
@@ -2265,9 +2266,7 @@ export function initReader() {
|
||||
popupAudioBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
if (!popupCurrentData || !popupCurrentData.term) return;
|
||||
const term = popupCurrentData.term;
|
||||
const url = popupCurrentData.audioUrl || `/api/tts?text=${encodeURIComponent(term)}&lang=en`;
|
||||
playAudio(url);
|
||||
playTextSpeech(popupCurrentData.term, 'en');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2275,9 +2274,15 @@ export function initReader() {
|
||||
popupAudioSentenceBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
if (!popupCurrentData || !popupCurrentData.contextSentence) return;
|
||||
const sentence = popupCurrentData.contextSentence;
|
||||
const url = `/api/tts?text=${encodeURIComponent(sentence)}&lang=en`;
|
||||
playAudio(url);
|
||||
playTextSpeech(popupCurrentData.contextSentence, 'en', 1.0);
|
||||
});
|
||||
}
|
||||
|
||||
if (popupAudioSentenceSlowBtn) {
|
||||
popupAudioSentenceSlowBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
if (!popupCurrentData || !popupCurrentData.contextSentence) return;
|
||||
playTextSpeech(popupCurrentData.contextSentence, 'en', 0.75);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2286,8 +2291,7 @@ export function initReader() {
|
||||
e.stopPropagation();
|
||||
const ruText = (popupSentenceRu && popupSentenceRu.textContent || '').trim();
|
||||
if (!ruText || ruText.startsWith('(') || ruText.startsWith('Ошибка')) return;
|
||||
const url = `/api/tts?text=${encodeURIComponent(ruText)}&lang=ru`;
|
||||
playAudio(url);
|
||||
playTextSpeech(ruText, 'ru', 1.0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user