ydshieh HF staff commited on
Commit
75c56b5
1 Parent(s): b51c028

Update transcript-tracer.js

Browse files
Files changed (1) hide show
  1. transcript-tracer.js +22 -9
transcript-tracer.js CHANGED
@@ -589,16 +589,29 @@ function handleSelection() {
589
  console.log(temp);
590
 
591
  // Mark selection
592
- // if (ttCurrentEvent.currentWordIndexes.length > 0) {
593
- // for (const wordIndex of ttCurrentEvent.currentWordIndexes) {
594
- // var wordElements = ttCurrentTranscript.querySelectorAll(`[data-tt-word="${wordIndex}"]`);
595
- // for (const wordElement of wordElements) wordElement.classList.add('tt-current-word');
596
- // }
597
- // for (const wordElement of ttCurrentTranscript.getElementsByClassName('tt-word')) {
598
- // if (wordElement.classList.contains('tt-current-word')) break;
599
- // wordElement.classList.add('tt-previous-word');
600
- // }
 
 
 
 
 
 
 
 
 
 
 
 
601
  // }
 
602
 
603
  }
604
 
 
589
  console.log(temp);
590
 
591
  // Mark selection
592
+
593
+ var currentWordElement = startWordElement;
594
+ while (true) {
595
+ var isWhite = currentWordElement.className == "tt-whitespace";
596
+ var index = -1;
597
+ if (!isWhite) {
598
+ var index = currentWordElement.dataset.ttWord;
599
+ }
600
+ if (parseInt(index) > parseInt(endWordIndex)) {
601
+ break;
602
+ }
603
+ console.log(currentWordElement);
604
+ currentWordElement = currentWordElement.nextElementSibling;
605
+
606
+ // var wordElements = ttCurrentTranscript.querySelectorAll(`[data-tt-word="${wordIndex}"]`);
607
+ // for (const wordElement of wordElements) wordElement.classList.add('tt-current-word');
608
+ }
609
+
610
+ // for (const wordElement of ttCurrentTranscript.getElementsByClassName('tt-word')) {
611
+ // if (wordElement.classList.contains('tt-current-word')) break;
612
+ // wordElement.classList.add('tt-previous-word');
613
  // }
614
+
615
 
616
  }
617