[web] Avoid useless assignment

This commit is contained in:
Alain Nussbaumer 2024-04-25 21:33:38 +02:00
parent 938458b56e
commit 30fc35097c
2 changed files with 8 additions and 9 deletions

View File

@ -32,7 +32,6 @@ export default [
'no-ternary': 'off',
'no-undef': 'off',
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'none' }],
'no-useless-assignment': 'off',
'one-var': 'off',
'prefer-named-capture-group': 'off',
'sort-keys': 'off',

View File

@ -117,25 +117,25 @@ export default {
}
// Not found, then start a binary search
let end = la.length - 1,
index = 0,
index = -1,
start = 0
while (start <= end) {
index = (start + end) >> 1
const currentVerse = la[index]
const nextVerse = la[index + 1]
const currentVerseTime = la[index].time
const nextVerseTime = la[index + 1]?.time
if (
currentVerse.time <= currentTime &&
(nextVerse?.time > currentTime || !nextVerse)
currentVerseTime <= currentTime &&
(nextVerseTime > currentTime || !nextVerseTime)
) {
return index
break
}
if (currentVerse.time < currentTime) {
if (currentVerseTime < currentTime) {
start = index + 1
} else {
end = index - 1
}
}
return -1
return index
}
this.reset_scrolling()
return -1