ydshieh HF staff commited on
Commit
c49adc5
1 Parent(s): 365d964

Update transcript-tracer.js

Browse files
Files changed (1) hide show
  1. transcript-tracer.js +10 -1
transcript-tracer.js CHANGED
@@ -619,13 +619,22 @@ function handleSelection() {
619
  console.log(transcript.children[0]);
620
  console.log(transcript.children[0].children);
621
 
 
622
  var nodes = [];
 
623
  for (const x of transcript.children) {
624
  for (const y of x.children) {
625
  nodes.push(y);
626
- }
 
 
 
 
 
 
627
  }
628
  console.log(nodes);
 
629
 
630
  // for (const wordElement of ttCurrentTranscript.getElementsByClassName('tt-word')) {
631
  // if (wordElement.classList.contains('tt-current-word')) break;
 
619
  console.log(transcript.children[0]);
620
  console.log(transcript.children[0].children);
621
 
622
+ var dict = {};
623
  var nodes = [];
624
+ var listIndex = -1;
625
  for (const x of transcript.children) {
626
  for (const y of x.children) {
627
  nodes.push(y);
628
+ listIndex = listIndex + 1;
629
+ if (y.className != "tt-whitespace") {
630
+ wordElement = y;
631
+ wordIndex = wordElement.dataset.ttWord;
632
+ dict[wordIndex] = listIndex;
633
+ }
634
+ }
635
  }
636
  console.log(nodes);
637
+ console.log(dict);
638
 
639
  // for (const wordElement of ttCurrentTranscript.getElementsByClassName('tt-word')) {
640
  // if (wordElement.classList.contains('tt-current-word')) break;