diff --git a/web-src/src/components/ModalDialogAddRss.vue b/web-src/src/components/ModalDialogAddRss.vue index 1942fcdd..c861575a 100644 --- a/web-src/src/components/ModalDialogAddRss.vue +++ b/web-src/src/components/ModalDialogAddRss.vue @@ -66,8 +66,8 @@ export default { data() { return { - url: '', - loading: false + loading: false, + url: '' } }, @@ -75,7 +75,6 @@ export default { show() { if (this.show) { this.loading = false - // We need to delay setting the focus to the input field until the field is part of the dom and visible setTimeout(() => { this.$refs.url_field.focus() diff --git a/web-src/src/components/ModalDialogAddUrlStream.vue b/web-src/src/components/ModalDialogAddUrlStream.vue index ea536632..125509a3 100644 --- a/web-src/src/components/ModalDialogAddUrlStream.vue +++ b/web-src/src/components/ModalDialogAddUrlStream.vue @@ -69,8 +69,8 @@ export default { data() { return { - url: '', - loading: false + loading: false, + url: '' } }, diff --git a/web-src/src/components/NavbarBottom.vue b/web-src/src/components/NavbarBottom.vue index 893626cd..6105c726 100644 --- a/web-src/src/components/NavbarBottom.vue +++ b/web-src/src/components/NavbarBottom.vue @@ -344,17 +344,12 @@ export default { }, methods: { - change_volume() { - webapi.player_volume(this.player.volume) - }, change_stream_volume() { audio.setVolume(this.stream_volume / 100) }, - toggle_mute_volume() { - this.player.volume = this.player.volume > 0 ? 0 : this.old_volume - this.change_volume() + change_volume() { + webapi.player_volume(this.player.volume) }, - closeAudio() { audio.stop() this.playing = false @@ -366,15 +361,12 @@ export default { if (this.playing) { return } - - const channel = '/stream.mp3' this.loading = true - audio.play(channel) + audio.play('/stream.mp3') audio.setVolume(this.stream_volume / 100) }, setupAudio() { const a = audio.setup() - a.addEventListener('waiting', (e) => { this.playing = false this.loading = true @@ -402,9 +394,13 @@ export default { return } if (this.playing) { - return this.closeAudio() + this.closeAudio() } - return this.playChannel() + this.playChannel() + }, + toggle_mute_volume() { + this.player.volume = this.player.volume > 0 ? 0 : this.old_volume + this.change_volume() } } } diff --git a/web-src/src/components/PlayerButtonLyrics.vue b/web-src/src/components/PlayerButtonLyrics.vue index 99eabc41..673e9f0e 100644 --- a/web-src/src/components/PlayerButtonLyrics.vue +++ b/web-src/src/components/PlayerButtonLyrics.vue @@ -17,11 +17,11 @@ export default { }, computed: { - is_active() { - return this.$store.state.lyrics.pane - }, icon_name() { return this.is_active ? 'script-text-play' : 'script-text-outline' + }, + is_active() { + return this.$store.state.lyrics.pane } }, diff --git a/web-src/src/components/PlayerButtonPlayPause.vue b/web-src/src/components/PlayerButtonPlayPause.vue index 201d3469..5cae4860 100644 --- a/web-src/src/components/PlayerButtonPlayPause.vue +++ b/web-src/src/components/PlayerButtonPlayPause.vue @@ -19,21 +19,9 @@ export default { }, computed: { - is_playing() { - return this.$store.state.player.state === 'play' - }, - - is_pause_allowed() { - return ( - this.$store.getters.now_playing && - this.$store.getters.now_playing.data_kind !== 'pipe' - ) - }, - disabled() { return !this.$store.state.queue || this.$store.state.queue.count <= 0 }, - icon_name() { if (!this.is_playing) { return 'play' @@ -41,6 +29,15 @@ export default { return 'pause' } return 'stop' + }, + is_pause_allowed() { + return ( + this.$store.getters.now_playing && + this.$store.getters.now_playing.data_kind !== 'pipe' + ) + }, + is_playing() { + return this.$store.state.player.state === 'play' } }, @@ -50,9 +47,9 @@ export default { if (this.show_disabled_message) { this.$store.dispatch('add_notification', { text: this.$t('server.empty-queue'), - type: 'info', + timeout: 2000, topic: 'connection', - timeout: 2000 + type: 'info' }) } return diff --git a/web-src/src/components/PlayerButtonRepeat.vue b/web-src/src/components/PlayerButtonRepeat.vue index 271be0e5..79a61866 100644 --- a/web-src/src/components/PlayerButtonRepeat.vue +++ b/web-src/src/components/PlayerButtonRepeat.vue @@ -19,15 +19,6 @@ export default { }, computed: { - is_repeat_all() { - return this.$store.state.player.repeat === 'all' - }, - is_repeat_single() { - return this.$store.state.player.repeat === 'single' - }, - is_repeat_off() { - return !this.is_repeat_all && !this.is_repeat_single - }, icon_name() { if (this.is_repeat_all) { return 'repeat' @@ -35,6 +26,15 @@ export default { return 'repeat-once' } return 'repeat-off' + }, + is_repeat_all() { + return this.$store.state.player.repeat === 'all' + }, + is_repeat_off() { + return !this.is_repeat_all && !this.is_repeat_single + }, + is_repeat_single() { + return this.$store.state.player.repeat === 'single' } }, diff --git a/web-src/src/components/PlayerButtonSeekBack.vue b/web-src/src/components/PlayerButtonSeekBack.vue index 912ec261..f9534f67 100644 --- a/web-src/src/components/PlayerButtonSeekBack.vue +++ b/web-src/src/components/PlayerButtonSeekBack.vue @@ -19,12 +19,6 @@ export default { }, computed: { - now_playing() { - return this.$store.getters.now_playing - }, - is_stopped() { - return this.$store.state.player.state === 'stop' - }, disabled() { return ( !this.$store.state.queue || @@ -33,6 +27,12 @@ export default { this.now_playing.data_kind === 'pipe' ) }, + is_stopped() { + return this.$store.state.player.state === 'stop' + }, + now_playing() { + return this.$store.getters.now_playing + }, visible() { return ['podcast', 'audiobook'].includes(this.now_playing.media_kind) } diff --git a/web-src/src/components/PlayerButtonSeekForward.vue b/web-src/src/components/PlayerButtonSeekForward.vue index 350f2803..b349a111 100644 --- a/web-src/src/components/PlayerButtonSeekForward.vue +++ b/web-src/src/components/PlayerButtonSeekForward.vue @@ -19,12 +19,6 @@ export default { }, computed: { - now_playing() { - return this.$store.getters.now_playing - }, - is_stopped() { - return this.$store.state.player.state === 'stop' - }, disabled() { return ( !this.$store.state.queue || @@ -33,6 +27,12 @@ export default { this.now_playing.data_kind === 'pipe' ) }, + is_stopped() { + return this.$store.state.player.state === 'stop' + }, + now_playing() { + return this.$store.getters.now_playing + }, visible() { return ['podcast', 'audiobook'].includes(this.now_playing.media_kind) } diff --git a/web-src/src/components/PlayerButtonShuffle.vue b/web-src/src/components/PlayerButtonShuffle.vue index 09621f4c..af9ed223 100644 --- a/web-src/src/components/PlayerButtonShuffle.vue +++ b/web-src/src/components/PlayerButtonShuffle.vue @@ -16,21 +16,18 @@ export default { name: 'PlayerButtonShuffle', props: { - icon_size: { - type: Number, - default: 16 - } + icon_size: { default: 16, type: Number } }, computed: { - is_shuffle() { - return this.$store.state.player.shuffle - }, icon_name() { if (this.is_shuffle) { return 'shuffle' } return 'shuffle-disabled' + }, + is_shuffle() { + return this.$store.state.player.shuffle } }, diff --git a/web-src/src/components/SettingsCheckbox.vue b/web-src/src/components/SettingsCheckbox.vue index a877f356..b4f306be 100644 --- a/web-src/src/components/SettingsCheckbox.vue +++ b/web-src/src/components/SettingsCheckbox.vue @@ -40,6 +40,20 @@ export default { }, computed: { + info() { + if (this.is_success) { + return this.$t('setting.saved') + } else if (this.is_error) { + return this.$t('setting.not-saved') + } + return '' + }, + is_error() { + return this.statusUpdate === 'error' + }, + is_success() { + return this.statusUpdate === 'success' + }, option() { const option = this.$store.getters.settings_option( this.category_name, @@ -53,27 +67,16 @@ export default { } } return option - }, - - info() { - if (this.is_success) { - return this.$t('setting.saved') - } else if (this.is_error) { - return this.$t('setting.not-saved') - } - return '' - }, - - is_success() { - return this.statusUpdate === 'success' - }, - - is_error() { - return this.statusUpdate === 'error' } }, methods: { + clear_status() { + if (this.is_error) { + this.option.value = !this.option.value + } + this.statusUpdate = '' + }, update_setting() { this.timerId = -1 const option = { @@ -93,13 +96,6 @@ export default { .finally(() => { this.timerId = window.setTimeout(this.clear_status, this.timerDelay) }) - }, - - clear_status() { - if (this.is_error) { - this.option.value = !this.option.value - } - this.statusUpdate = '' } } } diff --git a/web-src/src/components/SettingsIntfield.vue b/web-src/src/components/SettingsIntfield.vue index 61eed9bc..c3941e5d 100644 --- a/web-src/src/components/SettingsIntfield.vue +++ b/web-src/src/components/SettingsIntfield.vue @@ -41,9 +41,9 @@ export default { data() { return { + statusUpdate: '', timerDelay: 2000, - timerId: -1, - statusUpdate: '' + timerId: -1 } }, @@ -53,20 +53,6 @@ export default { (elem) => elem.name === this.category_name ) }, - - option() { - if (!this.category) { - return {} - } - return this.category.options.find( - (elem) => elem.name === this.option_name - ) - }, - - value() { - return this.option.value - }, - info() { if (this.statusUpdate === 'success') { return this.$t('setting.saved') @@ -75,17 +61,29 @@ export default { } return '' }, - + is_error() { + return this.statusUpdate === 'error' + }, is_success() { return this.statusUpdate === 'success' }, - - is_error() { - return this.statusUpdate === 'error' + option() { + if (!this.category) { + return {} + } + return this.category.options.find( + (elem) => elem.name === this.option_name + ) + }, + value() { + return this.option.value } }, methods: { + clear_status() { + this.statusUpdate = '' + }, set_update_timer() { if (this.timerId > 0) { window.clearTimeout(this.timerId) @@ -98,16 +96,13 @@ export default { this.timerId = window.setTimeout(this.update_setting, this.timerDelay) } }, - update_setting() { this.timerId = -1 - const newValue = this.$refs.setting.value if (newValue === this.value) { this.statusUpdate = '' return } - const option = { category: this.category.name, name: this.option_name, @@ -126,10 +121,6 @@ export default { .finally(() => { this.timerId = window.setTimeout(this.clear_status, this.timerDelay) }) - }, - - clear_status() { - this.statusUpdate = '' } } } diff --git a/web-src/src/components/SettingsTextfield.vue b/web-src/src/components/SettingsTextfield.vue index 00d2ea65..cd7618f0 100644 --- a/web-src/src/components/SettingsTextfield.vue +++ b/web-src/src/components/SettingsTextfield.vue @@ -40,9 +40,9 @@ export default { data() { return { + statusUpdate: '', timerDelay: 2000, - timerId: -1, - statusUpdate: '' + timerId: -1 } }, @@ -52,20 +52,6 @@ export default { (elem) => elem.name === this.category_name ) }, - - option() { - if (!this.category) { - return {} - } - return this.category.options.find( - (elem) => elem.name === this.option_name - ) - }, - - value() { - return this.option.value - }, - info() { if (this.statusUpdate === 'success') { return this.$t('setting.saved') @@ -74,39 +60,47 @@ export default { } return '' }, - + is_error() { + return this.statusUpdate === 'error' + }, is_success() { return this.statusUpdate === 'success' }, - - is_error() { - return this.statusUpdate === 'error' + option() { + if (!this.category) { + return {} + } + return this.category.options.find( + (elem) => elem.name === this.option_name + ) + }, + value() { + return this.option.value } }, methods: { + clear_status() { + this.statusUpdate = '' + }, set_update_timer() { if (this.timerId > 0) { window.clearTimeout(this.timerId) this.timerId = -1 } - this.statusUpdate = '' const newValue = this.$refs.setting.value if (newValue !== this.value) { this.timerId = window.setTimeout(this.update_setting, this.timerDelay) } }, - update_setting() { this.timerId = -1 - const newValue = this.$refs.setting.value if (newValue === this.value) { this.statusUpdate = '' return } - const option = { category: this.category.name, name: this.option_name, @@ -125,10 +119,6 @@ export default { .finally(() => { this.timerId = window.setTimeout(this.clear_status, this.timerDelay) }) - }, - - clear_status() { - this.statusUpdate = '' } } } diff --git a/web-src/src/pages/PageSearchSpotify.vue b/web-src/src/pages/PageSearchSpotify.vue index ac590f12..ba1026d6 100644 --- a/web-src/src/pages/PageSearchSpotify.vue +++ b/web-src/src/pages/PageSearchSpotify.vue @@ -214,9 +214,9 @@ export default { spotify_search(types) { return webapi.spotify().then(({ data }) => { this.search_param.market = data.webapi_country - const api = new SpotifyWebApi() - api.setAccessToken(data.webapi_token) - return api.search(this.query.query, types, this.search_param) + const spotifyApi = new SpotifyWebApi() + spotifyApi.setAccessToken(data.webapi_token) + return spotifyApi.search(this.query.query, types, this.search_param) }) } }