ydshieh HF staff commited on
Commit
fd2f80a
1 Parent(s): f05fd66

Update transcript-tracer.js

Browse files
Files changed (1) hide show
  1. transcript-tracer.js +14 -4
transcript-tracer.js CHANGED
@@ -599,7 +599,7 @@ function handleSelection() {
599
  console.log(startWordListIndexForTime);
600
  console.log(startSeconds);
601
 
602
- return
603
 
604
  // ====================================================================================================
605
 
@@ -609,11 +609,21 @@ function handleSelection() {
609
  // Used for highlight
610
  var endWordElementForHighlight = endWordElement;
611
  while (endWordElementForHighlight.className == "tt-whitespace") {
612
- endWordElementForHighlight = endWordElementForHighlight.nextElementSibling;
613
  }
614
- // TODO: if there is/are whitespace(s) and the next element doesn't have `ttWord`, we don't know how to go back.
615
- // TODO: even if we can go back (where ther is `ttWord`), we could still miss some words without `ttWord`.
616
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  // ====================================================================================================
618
 
619
  // Used for computing the start seconds
 
599
  console.log(startWordListIndexForTime);
600
  console.log(startSeconds);
601
 
602
+ // return
603
 
604
  // ====================================================================================================
605
 
 
609
  // Used for highlight
610
  var endWordElementForHighlight = endWordElement;
611
  while (endWordElementForHighlight.className == "tt-whitespace") {
612
+ endWordElementForHighlight = nodes[endWordElementForHighlight.listIndex - 1];
613
  }
 
 
614
 
615
+ // This could be `undefined`!
616
+ var endWordIndexForHighlight = endWordElementForHighlight.dataset.ttWord;
617
+ // This is always defined.
618
+ var endWordListIndexForHighlight = endWordElementForHighlight.listIndex;
619
+
620
+ console.log(endWordElement);
621
+ console.log(endWordElementForHighlight);
622
+ console.log(endWordIndexForHighlight);
623
+ console.log(endWordListIndexForHighlight);
624
+
625
+ return
626
+
627
  // ====================================================================================================
628
 
629
  // Used for computing the start seconds