diff --git a/js/compare.js b/js/compare.js
index 52b1ac9..917fee4 100644
--- a/js/compare.js
+++ b/js/compare.js
@@ -113,7 +113,7 @@ async function doCompare(blob, originalText, duration) {
if (i > 0) {
const sep = document.createElement('span');
sep.style.cssText = 'color:#ccc;margin:0 1px';
- sep.textContent = '·';
+ sep.textContent = '-';
div.appendChild(sep);
}
const chip = document.createElement('span');
diff --git a/js/main.js b/js/main.js
index 03f6d01..9ce6e55 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,6 +1,6 @@
// ---------- Глобальные переменные и инициализация ----------
const GROQ_API_KEY = '';
-const VERSION = 'v69';
+const VERSION = 'v70';
let mediaRecorder, audioChunks = [], userAudioBlob = null, ttsText = '';
let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null;
diff --git a/js/storage.js b/js/storage.js
index 00e54db..2b68249 100644
--- a/js/storage.js
+++ b/js/storage.js
@@ -61,11 +61,12 @@ async function renderRecHistory() {
r.transcription.split(/\s+/).map(w => {
const sy = syllabifyIT(w);
if (sy.includes('-')) {
- return sy.split('-').map(s =>
+ return sy.split('-').map((s,si) =>
'' + s + ''
- ).join('·');
+ ' onmouseout="this.style.background=\'\'"' +
+ ' onclick="playHistorySyl(' + r.id + ',' + si + ',' + sy.split('-').length + ')">' + s + ''
+ ).join('-');
}
return w;
}).join(' ') +
diff --git a/js/syllables.js b/js/syllables.js
index 460ccbf..8928caf 100644
--- a/js/syllables.js
+++ b/js/syllables.js
@@ -38,15 +38,12 @@ let _currentBlob = null;
let _currentSylBuf = null;
async function playSyllable(sylIdx, total) {
- console.log('[SYL] click', sylIdx, '/', total, 'blob=', !!_currentBlob);
if (!_currentBlob) return;
try {
const ctx = await getAudioCtx();
- console.log('[SYL] ctx.state=', ctx.state);
if (!_currentSylBuf) {
const ab = await _currentBlob.arrayBuffer();
_currentSylBuf = await ctx.decodeAudioData(ab);
- console.log('[SYL] decoded', _currentSylBuf.duration.toFixed(1) + 's');
}
const dur = _currentSylBuf.duration;
const start = (dur / total) * sylIdx;
@@ -55,6 +52,19 @@ async function playSyllable(sylIdx, total) {
src.buffer = _currentSylBuf;
src.connect(ctx.destination);
src.start(0, start, len);
- console.log('[SYL] playing', start.toFixed(2) + 's-' + (start+len).toFixed(2) + 's');
- } catch(e) { console.log('[SYL] ERR', e); }
+ } catch(e) {}
+}
+
+// Проигрывание слога из истории (загрузка blob из IndexedDB)
+async function playHistorySyl(recId, sylIdx, total) {
+ try {
+ const db = await openRecDB();
+ const tx = db.transaction('recs', 'readonly');
+ const store = tx.objectStore('recs');
+ const rec = await new Promise(r => { const req = store.get(recId); req.onsuccess = () => r(req.result); });
+ if (!rec?.blob) return;
+ _currentBlob = rec.blob;
+ _currentSylBuf = null;
+ await playSyllable(sylIdx, total);
+ } catch(e) {}
}