feat: добавлена аудио-озвучка упражнений (синтез речи)
This commit is contained in:
parent
dd686e834f
commit
f96324265c
23
index.html
23
index.html
@ -855,6 +855,8 @@
|
||||
document.getElementById('modal-video').innerHTML =
|
||||
'<div style="text-align:center;">' +
|
||||
'<img src="' + ex.image + '" alt="' + ex.name + '" style="width:100%;border-radius:12px;object-fit:cover;">' +
|
||||
'<br><br>' +
|
||||
'<button onclick="playAudio(' + id + ')" style="background:linear-gradient(135deg,#00d9ff,#00ff88);border:none;border-radius:30px;padding:14px 32px;font-size:18px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;gap:10px;box-shadow:0 4px 15px rgba(0,217,255,0.4);transition:0.3s;" onmouseover="this.style.transform=\'scale(1.05\')" onmouseout="this.style.transform=\'scale(1)\'">🔊 Слушать инструкцию</button>' +
|
||||
'</div>';
|
||||
document.getElementById('modal-desc').textContent = ex.desc;
|
||||
document.getElementById('video-modal').classList.add('active');
|
||||
@ -893,7 +895,10 @@
|
||||
const ex = exercises.find(e => e.id === id);
|
||||
|
||||
document.getElementById('main-video-player').innerHTML =
|
||||
'<img src="' + ex.image + '" alt="' + ex.name + '" style="width:100%;border-radius:12px;object-fit:cover;">';
|
||||
'<div style="position:relative;">' +
|
||||
'<img src="' + ex.image + '" alt="' + ex.name + '" style="width:100%;border-radius:12px;object-fit:cover;">' +
|
||||
'<button onclick="playAudio(' + id + ')" style="position:absolute;bottom:20px;right:20px;background:linear-gradient(135deg,#00d9ff,#00ff88);border:none;border-radius:30px;padding:12px 24px;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;gap:8px;box-shadow:0 4px 15px rgba(0,217,255,0.4);transition:0.3s;" onmouseover="this.style.transform=\'scale(1.05\')" onmouseout="this.style.transform=\'scale(1)\'">🔊 Слушать</button>' +
|
||||
'</div>';
|
||||
document.getElementById('current-exercise-name').textContent = ex.name;
|
||||
document.getElementById('current-exercise-desc').innerHTML = '<strong>🎯 ' + ex.focus + '</strong> • ⏱️ ' + ex.time + ' • ' + ex.reps + '<br><br>' + ex.desc;
|
||||
|
||||
@ -901,6 +906,22 @@
|
||||
event.currentTarget.classList.add('active');
|
||||
}
|
||||
|
||||
function playAudio(id) {
|
||||
const ex = exercises.find(e => e.id === id);
|
||||
const text = ex.name + '. ' + ex.desc + '. Повторы: ' + ex.reps + '. Время: ' + ex.time;
|
||||
|
||||
if ('speechSynthesis' in window) {
|
||||
window.speechSynthesis.cancel();
|
||||
const utterance = new SpeechSynthesisUtterance(text);
|
||||
utterance.lang = 'ru-RU';
|
||||
utterance.rate = 0.9;
|
||||
utterance.pitch = 1;
|
||||
window.speechSynthesis.speak(utterance);
|
||||
} else {
|
||||
alert('Ваш браузер не поддерживает синтез речи');
|
||||
}
|
||||
}
|
||||
|
||||
function markTodayDone() {
|
||||
const todayStr = new Date().toDateString();
|
||||
if (!progressData.completedDays.includes(todayStr)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user