chore: disable legacy audio proxy and hide audio controls
This commit is contained in:
+8
-54
@@ -330,16 +330,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Audio Player Helper
|
||||
// Audio Player Helper (Disabled)
|
||||
// -----------------------------------------------------------------------
|
||||
function playAudio(url) {
|
||||
if (!url) return;
|
||||
try {
|
||||
globalAudioPlayer.src = url;
|
||||
globalAudioPlayer.play().catch(e => console.log('Audio playback error:', e));
|
||||
} catch (e) {
|
||||
console.log('Audio error:', e);
|
||||
}
|
||||
// Audio playback disabled
|
||||
return;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -576,15 +571,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
resPhonetic.textContent = data.phonetic || '';
|
||||
resPhonetic.style.display = data.phonetic ? 'inline-block' : 'none';
|
||||
resPos.textContent = data.part_of_speech || 'Phrase';
|
||||
|
||||
if (data.audio_url) {
|
||||
audioPlayBtn.classList.remove('hidden');
|
||||
audioPlayBtn.onclick = () => playAudio(data.audio_url);
|
||||
// Auto play once
|
||||
playAudio(data.audio_url);
|
||||
} else {
|
||||
audioPlayBtn.classList.add('hidden');
|
||||
}
|
||||
audioPlayBtn.classList.add('hidden');
|
||||
|
||||
if (data.definition_en) {
|
||||
resDefinition.textContent = data.definition_en;
|
||||
@@ -761,7 +748,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
<span class="card-term">${escapeHtml(c.term)}</span>
|
||||
${c.phonetic ? `<span class="card-phonetic">${escapeHtml(c.phonetic)}</span>` : ''}
|
||||
${c.part_of_speech ? `<span class="card-pos">${escapeHtml(c.part_of_speech)}</span>` : ''}
|
||||
${c.audio_url ? `<button class="icon-btn audio-btn audio-inline-btn" data-audio="${encodeURIComponent(c.audio_url)}" title="Озвучить">🔊</button>` : ''}
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<button class="icon-btn edit-card-btn" data-id="${c.id}" title="Редактировать">✏️</button>
|
||||
@@ -779,15 +765,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Inline audio button
|
||||
const audioBtn = cardEl.querySelector('.audio-inline-btn');
|
||||
if (audioBtn) {
|
||||
audioBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
playAudio(decodeURIComponent(audioBtn.dataset.audio));
|
||||
});
|
||||
}
|
||||
|
||||
// Edit button
|
||||
cardEl.querySelector('.edit-card-btn').addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
@@ -1106,15 +1083,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
fcBackNotes.textContent = card.notes || '';
|
||||
fcBackNotesBox.style.display = card.notes ? 'block' : 'none';
|
||||
|
||||
if (card.audio_url) {
|
||||
fcFrontAudioBtn.style.display = 'inline-flex';
|
||||
fcBackAudioBtn.style.display = 'inline-flex';
|
||||
fcFrontAudioBtn.onclick = (e) => { e.stopPropagation(); playAudio(card.audio_url); };
|
||||
fcBackAudioBtn.onclick = (e) => { e.stopPropagation(); playAudio(card.audio_url); };
|
||||
} else {
|
||||
fcFrontAudioBtn.style.display = 'none';
|
||||
fcBackAudioBtn.style.display = 'none';
|
||||
}
|
||||
fcFrontAudioBtn.style.display = 'none';
|
||||
fcBackAudioBtn.style.display = 'none';
|
||||
}
|
||||
|
||||
function flipFlashcard() {
|
||||
@@ -1123,11 +1093,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
flashcardInner.classList.add('is-flipped');
|
||||
fcRatingBar.classList.remove('hidden');
|
||||
fcFlipBtnWrap.style.display = 'none';
|
||||
|
||||
const card = srsQueue[srsCurrentIndex];
|
||||
if (card && card.audio_url) {
|
||||
playAudio(card.audio_url);
|
||||
}
|
||||
}
|
||||
|
||||
flashcardFlipWrap.addEventListener('click', flipFlashcard);
|
||||
@@ -1186,13 +1151,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
quizContextHint.classList.add('hidden');
|
||||
}
|
||||
|
||||
if (card.audio_url) {
|
||||
quizAudioBtn.classList.remove('hidden');
|
||||
quizAudioBtn.onclick = () => playAudio(card.audio_url);
|
||||
playAudio(card.audio_url);
|
||||
} else {
|
||||
quizAudioBtn.classList.add('hidden');
|
||||
}
|
||||
quizAudioBtn.classList.add('hidden');
|
||||
|
||||
// Generate 4 options: target + 3 random from other cards or presets
|
||||
const correctText = card.translation;
|
||||
@@ -2000,12 +1959,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
popupLoading.classList.add('hidden');
|
||||
popupContent.classList.remove('hidden');
|
||||
|
||||
if (data.audio_url) {
|
||||
popupAudioBtn.classList.remove('hidden');
|
||||
popupAudioBtn.onclick = () => playAudio(data.audio_url);
|
||||
} else {
|
||||
popupAudioBtn.classList.add('hidden');
|
||||
}
|
||||
popupAudioBtn.classList.add('hidden');
|
||||
} else {
|
||||
popupTranslation.textContent = 'Ошибка перевода';
|
||||
popupLoading.classList.add('hidden');
|
||||
|
||||
Reference in New Issue
Block a user