[web] Lint source code

This commit is contained in:
Alain Nussbaumer 2023-11-24 15:56:04 +01:00
parent 095d60af00
commit b39eb0b51d
5 changed files with 10 additions and 13 deletions

View File

@ -199,9 +199,6 @@ export default {
vm.update_lastfm() vm.update_lastfm()
vm.update_pairing() vm.update_pairing()
} }
socket.onclose = function () {
// vm.$store.dispatch('add_notification', { text: 'Connection closed', type: 'danger', timeout: 2000 })
}
/* /*
* When the app becomes active, force an update of all information, * When the app becomes active, force an update of all information,

View File

@ -163,25 +163,26 @@ export default {
if (!e.screenX || e.screenX == 0 || !e.screenY || e.screenY == 0) return if (!e.screenX || e.screenX == 0 || !e.screenY || e.screenY == 0) return
this.autoScroll = false this.autoScroll = false
if (this.scrollTimer) clearTimeout(this.scrollTimer) if (this.scrollTimer) clearTimeout(this.scrollTimer)
let t = this const t = this
// Reenable automatic scrolling after 5 seconds // Reenable automatic scrolling after 5 seconds
this.scrollTimer = setTimeout(function () { this.scrollTimer = setTimeout(() => {
t.autoScroll = true t.autoScroll = true
}, 5000) }, 5000)
}, },
_scrollToElement() { _scrollToElement() {
let scrollTouch = this.$refs.lyricsWrapper const scrollTouch = this.$refs.lyricsWrapper
if (this.lyricIndex == -1) { if (this.lyricIndex == -1) {
scrollTouch.scrollTo(0, 0) scrollTouch.scrollTo(0, 0)
return return
} }
let currentLyric = scrollTouch.children[0].children[this.lyricIndex + 1], // Because of space item const currentLyric =
scrollTouch.children[0].children[this.lyricIndex + 1], // Because of space item
offsetToCenter = scrollTouch.offsetHeight >> 1 offsetToCenter = scrollTouch.offsetHeight >> 1
if (!this.lyricsArr || !currentLyric) return if (!this.lyricsArr || !currentLyric) return
let currOff = scrollTouch.scrollTop, const currOff = scrollTouch.scrollTop,
destOff = destOff =
currentLyric.offsetTop - currentLyric.offsetTop -
offsetToCenter + offsetToCenter +

View File

@ -120,7 +120,7 @@ export class GroupByList {
this.count = itemsFiltered.length this.count = itemsFiltered.length
// Sort item list // Sort item list
let itemsSorted = options.compareFn const itemsSorted = options.compareFn
? [...itemsFiltered].sort(options.compareFn) ? [...itemsFiltered].sort(options.compareFn)
: itemsFiltered : itemsFiltered

View File

@ -74,7 +74,7 @@ import webapi from '@/webapi'
const PAGE_SIZE = 50 const PAGE_SIZE = 50
const dataObject = { const dataObject = {
load: function (to) { load(to) {
const spotifyApi = new SpotifyWebApi() const spotifyApi = new SpotifyWebApi()
spotifyApi.setAccessToken(store.state.spotify.webapi_token) spotifyApi.setAccessToken(store.state.spotify.webapi_token)
return Promise.all([ return Promise.all([

View File

@ -194,8 +194,8 @@ export default createStore({
[types.UPDATE_LYRICS](state, track) { [types.UPDATE_LYRICS](state, track) {
// Parse from .LRC or text format to synchronized lyrics // Parse from .LRC or text format to synchronized lyrics
function parse(lyrics) { function parse(lyrics) {
const lyricsObj = []
if (lyrics) { if (lyrics) {
const lyricsObj = []
const regex = /(\[(\d+):(\d+)(?:\.\d+)?\] ?)?(.*)/ const regex = /(\[(\d+):(\d+)(?:\.\d+)?\] ?)?(.*)/
lyrics.split('\n').forEach((item) => { lyrics.split('\n').forEach((item) => {
const matches = regex.exec(item) const matches = regex.exec(item)
@ -208,9 +208,8 @@ export default createStore({
lyricsObj.push(obj) lyricsObj.push(obj)
} }
}) })
return lyricsObj
} }
return {} return lyricsObj
} }
state.lyrics.content = track ? parse(track.lyrics) : '' state.lyrics.content = track ? parse(track.lyrics) : ''
}, },