diff --git a/web-src/src/App.vue b/web-src/src/App.vue index 7515f86a..6df10719 100644 --- a/web-src/src/App.vue +++ b/web-src/src/App.vue @@ -199,9 +199,6 @@ export default { vm.update_lastfm() 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, diff --git a/web-src/src/components/LyricsPane.vue b/web-src/src/components/LyricsPane.vue index a0541957..225f6b0d 100644 --- a/web-src/src/components/LyricsPane.vue +++ b/web-src/src/components/LyricsPane.vue @@ -163,25 +163,26 @@ export default { if (!e.screenX || e.screenX == 0 || !e.screenY || e.screenY == 0) return this.autoScroll = false if (this.scrollTimer) clearTimeout(this.scrollTimer) - let t = this + const t = this // Reenable automatic scrolling after 5 seconds - this.scrollTimer = setTimeout(function () { + this.scrollTimer = setTimeout(() => { t.autoScroll = true }, 5000) }, _scrollToElement() { - let scrollTouch = this.$refs.lyricsWrapper + const scrollTouch = this.$refs.lyricsWrapper if (this.lyricIndex == -1) { scrollTouch.scrollTo(0, 0) 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 if (!this.lyricsArr || !currentLyric) return - let currOff = scrollTouch.scrollTop, + const currOff = scrollTouch.scrollTop, destOff = currentLyric.offsetTop - offsetToCenter + diff --git a/web-src/src/lib/GroupByList.js b/web-src/src/lib/GroupByList.js index 7699569e..e83cafb8 100644 --- a/web-src/src/lib/GroupByList.js +++ b/web-src/src/lib/GroupByList.js @@ -120,7 +120,7 @@ export class GroupByList { this.count = itemsFiltered.length // Sort item list - let itemsSorted = options.compareFn + const itemsSorted = options.compareFn ? [...itemsFiltered].sort(options.compareFn) : itemsFiltered diff --git a/web-src/src/pages/PagePlaylistTracksSpotify.vue b/web-src/src/pages/PagePlaylistTracksSpotify.vue index 27f72a6f..d1e2b43d 100644 --- a/web-src/src/pages/PagePlaylistTracksSpotify.vue +++ b/web-src/src/pages/PagePlaylistTracksSpotify.vue @@ -74,7 +74,7 @@ import webapi from '@/webapi' const PAGE_SIZE = 50 const dataObject = { - load: function (to) { + load(to) { const spotifyApi = new SpotifyWebApi() spotifyApi.setAccessToken(store.state.spotify.webapi_token) return Promise.all([ diff --git a/web-src/src/store/index.js b/web-src/src/store/index.js index 21bba7f7..9b160d62 100644 --- a/web-src/src/store/index.js +++ b/web-src/src/store/index.js @@ -194,8 +194,8 @@ export default createStore({ [types.UPDATE_LYRICS](state, track) { // Parse from .LRC or text format to synchronized lyrics function parse(lyrics) { + const lyricsObj = [] if (lyrics) { - const lyricsObj = [] const regex = /(\[(\d+):(\d+)(?:\.\d+)?\] ?)?(.*)/ lyrics.split('\n').forEach((item) => { const matches = regex.exec(item) @@ -208,9 +208,8 @@ export default createStore({ lyricsObj.push(obj) } }) - return lyricsObj } - return {} + return lyricsObj } state.lyrics.content = track ? parse(track.lyrics) : '' },