mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-07 04:42:58 -05:00
[web] Lint source code
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
:key="index"
|
||||
class="button is-small"
|
||||
:to="{ hash: `#index_${index}`, query: $route.query }"
|
||||
>{{ index }}</router-link
|
||||
>
|
||||
{{ index }}
|
||||
</router-link>
|
||||
</nav>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -68,17 +68,19 @@ export default {
|
||||
(this.lastIndex < la.length - 1 &&
|
||||
la[this.lastIndex + 1].time > currentTime) ||
|
||||
this.lastIndex === la.length - 1
|
||||
)
|
||||
) {
|
||||
return this.lastIndex
|
||||
}
|
||||
if (
|
||||
this.lastIndex < la.length - 2 &&
|
||||
la[this.lastIndex + 2].time > currentTime
|
||||
)
|
||||
) {
|
||||
return this.lastIndex + 1
|
||||
}
|
||||
// Not found, then start a binary search
|
||||
let start = 0,
|
||||
end = la.length - 1,
|
||||
index
|
||||
let end = la.length - 1,
|
||||
index = 0,
|
||||
start = 0
|
||||
while (start <= end) {
|
||||
index = (start + end) >> 1
|
||||
const currentVerse = la[index]
|
||||
@@ -103,7 +105,7 @@ export default {
|
||||
const parsed = []
|
||||
if (raw) {
|
||||
// Parse the lyrics
|
||||
const regex = /(\[(\d+):(\d+)(?:\.\d+)?\] ?)?(.*)/
|
||||
const regex = /(\[(\d+):(\d+)(?:\.\d+)?\] ?)?(.*)/u
|
||||
raw.split('\n').forEach((item, index) => {
|
||||
const matches = regex.exec(item)
|
||||
if (matches && matches[4]) {
|
||||
@@ -120,7 +122,7 @@ export default {
|
||||
index < lyrics.length - 1 ? lyrics[index + 1].time - verse.time : 3
|
||||
const unitDuration = duration / verse.text.length
|
||||
let delay = 0
|
||||
verse.words = verse.text.match(/\S+\s*/g).map((text) => {
|
||||
verse.words = verse.text.match(/\S+\s*/gu).map((text) => {
|
||||
const duration = text.length * unitDuration
|
||||
delay += duration
|
||||
return {
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
'is-loading': loading
|
||||
}"
|
||||
@click="togglePlay"
|
||||
><mdicon class="icon" name="broadcast" size="18" />
|
||||
>
|
||||
<mdicon class="icon" name="broadcast" size="18" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="level-item">
|
||||
@@ -70,8 +71,8 @@
|
||||
:class="{ 'has-text-grey-light': !playing }"
|
||||
>
|
||||
<p class="heading" v-text="$t('navigation.stream')" />
|
||||
<a href="stream.mp3" class="heading ml-2" target="_blank"
|
||||
><mdicon
|
||||
<a href="stream.mp3" class="heading ml-2" target="_blank">
|
||||
<mdicon
|
||||
class="icon is-small"
|
||||
name="open-in-new"
|
||||
size="16"
|
||||
@@ -218,7 +219,8 @@
|
||||
'is-loading': loading
|
||||
}"
|
||||
@click="togglePlay"
|
||||
><mdicon class="icon" name="radio-tower" size="16" />
|
||||
>
|
||||
<mdicon class="icon" name="radio-tower" size="16" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="level-item">
|
||||
@@ -228,8 +230,8 @@
|
||||
:class="{ 'has-text-grey-light': !playing }"
|
||||
>
|
||||
<p class="heading" v-text="$t('navigation.stream')" />
|
||||
<a href="stream.mp3" class="heading ml-2" target="_blank"
|
||||
><mdicon
|
||||
<a href="stream.mp3" class="heading ml-2" target="_blank">
|
||||
<mdicon
|
||||
class="icon is-small"
|
||||
name="open-in-new"
|
||||
size="16"
|
||||
@@ -367,19 +369,19 @@ export default {
|
||||
},
|
||||
setupAudio() {
|
||||
const a = audio.setup()
|
||||
a.addEventListener('waiting', (e) => {
|
||||
a.addEventListener('waiting', () => {
|
||||
this.playing = false
|
||||
this.loading = true
|
||||
})
|
||||
a.addEventListener('playing', (e) => {
|
||||
a.addEventListener('playing', () => {
|
||||
this.playing = true
|
||||
this.loading = false
|
||||
})
|
||||
a.addEventListener('ended', (e) => {
|
||||
a.addEventListener('ended', () => {
|
||||
this.playing = false
|
||||
this.loading = false
|
||||
})
|
||||
a.addEventListener('error', (e) => {
|
||||
a.addEventListener('error', () => {
|
||||
this.closeAudio()
|
||||
this.$store.dispatch('add_notification', {
|
||||
text: this.$t('navigation.stream-error'),
|
||||
|
||||
@@ -94,17 +94,17 @@
|
||||
<b v-text="$t('navigation.search')" />
|
||||
</navbar-item-link>
|
||||
<hr class="my-3" />
|
||||
<navbar-item-link :to="{ name: 'settings-webinterface' }">{{
|
||||
$t('navigation.settings')
|
||||
}}</navbar-item-link>
|
||||
<navbar-item-link :to="{ name: 'settings-webinterface' }">
|
||||
{{ $t('navigation.settings') }}
|
||||
</navbar-item-link>
|
||||
<a
|
||||
class="navbar-item"
|
||||
@click.stop.prevent="open_update_dialog()"
|
||||
v-text="$t('navigation.update-library')"
|
||||
/>
|
||||
<navbar-item-link :to="{ name: 'about' }">{{
|
||||
$t('navigation.about')
|
||||
}}</navbar-item-link>
|
||||
<navbar-item-link :to="{ name: 'about' }">
|
||||
{{ $t('navigation.about') }}
|
||||
</navbar-item-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user