Skip to content

Commit cfce1df

Browse files
authored
Merge pull request #257 from hyperaudio/256-insert-caption-bug
fix caption insert
2 parents 7112259 + 68f101d commit cfce1df

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
</select>
150150
</div>
151151
<div class="form-text" style="font-size: 90%;">
152-
<p style="padding-top:16px">The models are listed in order of size. The larger the model, the more accurate it is – and slower to process.</p>
152+
<p style="padding-top:16px">The models are listed in order of size. The larger the model, the more accurate it is – and slower to process.</p>
153153
<p>The English models are slightly more accurate (for the English language only).</p>
154154
<p>* Whisper running in the browser is currently in beta.</p>
155155
</div>
@@ -1286,12 +1286,22 @@ <h3 class="font-bold text-lg">Load from Local Storage</h3>
12861286
}
12871287

12881288
function addCaption(elem) {
1289+
// Initialize the DOM parser and get the template
1290+
let parser = new DOMParser();
1291+
let html = document.querySelector('#caption-template-holder').innerHTML;
1292+
let template = parser.parseFromString(html, "text/html");
1293+
12891294
let captionTempl = template.querySelector('#caption-template').cloneNode(true);
12901295
captionTempl.getElementsByClassName('line1')[0].value = "";
12911296
captionTempl.getElementsByClassName('line2')[0].value = "";
12921297
captionTempl.getElementsByClassName('start')[0].value = "00:00:00.000";
12931298
captionTempl.getElementsByClassName('end')[0].value = "00:00:00.000";
1299+
captionTempl.classList.add('caption-new');
12941300
elem.parentElement.parentNode.insertAdjacentElement('afterend', captionTempl);
1301+
// Remove animation class after animation completes
1302+
setTimeout(() => {
1303+
captionTempl.classList.remove('caption-new');
1304+
}, 300);
12951305
makeCaptionEditorActive();
12961306
}
12971307

0 commit comments

Comments
 (0)