[web] Lint source code

This commit is contained in:
Alain Nussbaumer 2025-06-01 18:05:12 +02:00
parent 4872bfd7fd
commit 60b688a182
4 changed files with 15 additions and 18 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,6 @@ export default [
camelcase: 'off', camelcase: 'off',
'id-length': 'off', 'id-length': 'off',
'max-lines-per-function': 'off', 'max-lines-per-function': 'off',
'max-statements': 'off',
'no-bitwise': 'off', 'no-bitwise': 'off',
'no-magic-numbers': 'off', 'no-magic-numbers': 'off',
'no-undef': 'off', 'no-undef': 'off',

View File

@ -43,21 +43,19 @@ export default {
} }
}, },
computed: { computed: {
verseIndex() { verseIndex(time, verses) {
const currentTime = this.time let low = 0
const { verses } = this.lyrics let high = verses.length - 1
let start = 0 while (low <= high) {
let end = verses.length - 1 const mid = Math.floor((low + high) / 2),
while (start <= end) { midTime = verses[mid].time,
const mid = Math.floor((start + end) / 2) nextTime = verses[mid + 1]?.time
const midTime = verses[mid].time if (midTime <= time && (!nextTime || nextTime > time)) {
const nextTime = verses[mid + 1]?.time
if (midTime <= currentTime && (!nextTime || nextTime > currentTime)) {
return mid return mid
} else if (midTime < currentTime) { } else if (midTime < time) {
start = mid + 1 low = mid + 1
} else { } else {
end = mid - 1 high = mid - 1
} }
} }
return -1 return -1
@ -67,7 +65,7 @@ export default {
let start = 0 let start = 0
let { length } = verses let { length } = verses
if (synchronised) { if (synchronised) {
start = this.verseIndex - this.MIDDLE_POSITION start = this.verseIndex(this.time, verses) - this.MIDDLE_POSITION
length = this.VISIBLE_VERSES length = this.VISIBLE_VERSES
} }
return Array.from( return Array.from(