Update transcript-tracer.js
Browse files- transcript-tracer.js +10 -3
transcript-tracer.js
CHANGED
@@ -570,26 +570,33 @@ function handleSelection() {
|
|
570 |
while (startWordElementForHighlight.className == "tt-whitespace") {
|
571 |
startWordElementForHighlight = startWordElementForHighlight.nextElementSibling;
|
572 |
}
|
573 |
-
//
|
574 |
var startWordIndexForHighlight = startWordElementForHighlight.dataset.ttWord;
|
|
|
|
|
575 |
|
576 |
// Used for computing the start seconds
|
577 |
var startWordElementForTime = startWordElementForHighlight;
|
578 |
|
579 |
// No time specified for some words --> we compute the starting time with the first element where the time information is provided.
|
580 |
-
// TODO: `nextElementSibling` can go beyond the <p> ... </p>
|
581 |
while (startWordElementForTime.className == "tt-whitespace" || (startWordElementForTime.dataset.ttWord === undefined)) {
|
582 |
startWordElementForTime = startWordElementForTime.nextElementSibling;
|
583 |
}
|
584 |
-
|
|
|
585 |
var startWordIndexForTime = startWordElementForTime.dataset.ttWord;
|
|
|
|
|
586 |
var startSeconds = ttLinkedDataByMediaUrl[mediaUrl].wordTimings[startWordIndexForTime].startSeconds;
|
587 |
|
588 |
console.log(startWordElement);
|
589 |
console.log(startWordElementForHighlight);
|
590 |
console.log(startWordIndexForHighlight);
|
|
|
591 |
console.log(startWordElementForTime);
|
592 |
console.log(startWordIndexForTime);
|
|
|
593 |
console.log(startSeconds);
|
594 |
|
595 |
return
|
|
|
570 |
while (startWordElementForHighlight.className == "tt-whitespace") {
|
571 |
startWordElementForHighlight = startWordElementForHighlight.nextElementSibling;
|
572 |
}
|
573 |
+
// This could be `undefined`!
|
574 |
var startWordIndexForHighlight = startWordElementForHighlight.dataset.ttWord;
|
575 |
+
// This is always defined.
|
576 |
+
var startWordListIndexForHighlight = startWordElementForHighlight.listIndex;
|
577 |
|
578 |
// Used for computing the start seconds
|
579 |
var startWordElementForTime = startWordElementForHighlight;
|
580 |
|
581 |
// No time specified for some words --> we compute the starting time with the first element where the time information is provided.
|
582 |
+
// TODO: `nextElementSibling` can go beyond the <p> ... </p> -->
|
583 |
while (startWordElementForTime.className == "tt-whitespace" || (startWordElementForTime.dataset.ttWord === undefined)) {
|
584 |
startWordElementForTime = startWordElementForTime.nextElementSibling;
|
585 |
}
|
586 |
+
|
587 |
+
// This is always defined here.
|
588 |
var startWordIndexForTime = startWordElementForTime.dataset.ttWord;
|
589 |
+
// But let's still get the `listIndex`.
|
590 |
+
var startWordListIndexForTime = startWordIndexForTime.listIndex;
|
591 |
var startSeconds = ttLinkedDataByMediaUrl[mediaUrl].wordTimings[startWordIndexForTime].startSeconds;
|
592 |
|
593 |
console.log(startWordElement);
|
594 |
console.log(startWordElementForHighlight);
|
595 |
console.log(startWordIndexForHighlight);
|
596 |
+
console.log(startWordListIndexForHighlight);
|
597 |
console.log(startWordElementForTime);
|
598 |
console.log(startWordIndexForTime);
|
599 |
+
console.log(startWordListIndexForTime);
|
600 |
console.log(startSeconds);
|
601 |
|
602 |
return
|