Skip to content

Commit

Permalink
feat: wbw: use endTime
Browse files Browse the repository at this point in the history
  • Loading branch information
pxeemo committed Dec 13, 2024
1 parent 458f38c commit 4d6bcbd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,10 @@ function next() {
nextItem(itemsList[currentItemIndex], currentTime)
return
}
currentWordIndex++
const item = itemsList[currentItemIndex]
const line = item.children[1]
const prevWord = line.children[currentWordIndex]
currentWordIndex++
const word = line.children[currentWordIndex]

if (currentWordIndex >= item.children[1].childElementCount) {
Expand All @@ -258,10 +259,13 @@ function next() {
nextItem(itemsList[currentItemIndex], currentTime)
}
} else {
word.dataset.time = currentTime
word.dataset.beginTime = currentTime
word.classList.remove('text-zinc-400')
word.classList.add('text-zinc-100')
}
if (typeof prevWord != 'undefined') {
prevWord.dataset.endTime = currentTime
}
} else {
if (currentItemIndex < itemsList.length - 1) {
currentItemIndex++
Expand Down Expand Up @@ -382,7 +386,7 @@ dlFileBtn.addEventListener('click', () => {
text +=
word.innerText +
`${word.dataset.type == 'word' ? ' ' : ''}` +
`<${formatTime(word.dataset.time)}>`
`<${formatTime(word.dataset.endTime)}>`
})
text += '\n'
} else {
Expand Down

0 comments on commit 4d6bcbd

Please sign in to comment.