mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-28 05:49:18 -05:00
[web] Lint source code
This commit is contained in:
parent
f2c3e8ff50
commit
57207c1ff4
@ -34,13 +34,7 @@ export default {
|
||||
},
|
||||
|
||||
caption() {
|
||||
if (this.album) {
|
||||
return this.album.substring(0, 2)
|
||||
}
|
||||
if (this.artist) {
|
||||
return this.artist.substring(0, 2)
|
||||
}
|
||||
return ''
|
||||
return (this.album || this.artist || '').substring(0, 2)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -172,13 +172,13 @@ export default {
|
||||
}
|
||||
const currentVerse = pane.children[this.verse_index]
|
||||
pane.scrollBy({
|
||||
behavior: 'smooth',
|
||||
left: 0,
|
||||
top:
|
||||
currentVerse.offsetTop -
|
||||
(pane.offsetHeight >> 1) +
|
||||
(currentVerse.offsetHeight >> 1) -
|
||||
pane.scrollTop,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
pane.scrollTop
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -6,28 +6,25 @@
|
||||
aria-label="main navigation"
|
||||
>
|
||||
<div class="navbar-brand">
|
||||
<navbar-item-link v-if="is_visible_playlists" :to="{ name: 'playlists' }">
|
||||
<navbar-item-link v-if="show_playlists" :to="{ name: 'playlists' }">
|
||||
<mdicon class="icon" name="music-box-multiple" size="16" />
|
||||
</navbar-item-link>
|
||||
<navbar-item-link v-if="is_visible_music" :to="{ name: 'music' }">
|
||||
<navbar-item-link v-if="show_music" :to="{ name: 'music' }">
|
||||
<mdicon class="icon" name="music" size="16" />
|
||||
</navbar-item-link>
|
||||
<navbar-item-link v-if="is_visible_podcasts" :to="{ name: 'podcasts' }">
|
||||
<navbar-item-link v-if="show_podcasts" :to="{ name: 'podcasts' }">
|
||||
<mdicon class="icon" name="microphone" size="16" />
|
||||
</navbar-item-link>
|
||||
<navbar-item-link
|
||||
v-if="is_visible_audiobooks"
|
||||
:to="{ name: 'audiobooks' }"
|
||||
>
|
||||
<navbar-item-link v-if="show_audiobooks" :to="{ name: 'audiobooks' }">
|
||||
<mdicon class="icon" name="book-open-variant" size="16" />
|
||||
</navbar-item-link>
|
||||
<navbar-item-link v-if="is_visible_radio" :to="{ name: 'radio' }">
|
||||
<navbar-item-link v-if="show_radio" :to="{ name: 'radio' }">
|
||||
<mdicon class="icon" name="radio" size="16" />
|
||||
</navbar-item-link>
|
||||
<navbar-item-link v-if="is_visible_files" :to="{ name: 'files' }">
|
||||
<navbar-item-link v-if="show_files" :to="{ name: 'files' }">
|
||||
<mdicon class="icon" name="folder-open" size="16" />
|
||||
</navbar-item-link>
|
||||
<navbar-item-link v-if="is_visible_search" :to="{ name: search_name }">
|
||||
<navbar-item-link v-if="show_search" :to="{ name: search_name }">
|
||||
<mdicon class="icon" name="magnify" size="16" />
|
||||
</navbar-item-link>
|
||||
<div
|
||||
@ -135,52 +132,17 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
is_visible_playlists() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_playlists'
|
||||
).value
|
||||
search_name: {
|
||||
get() {
|
||||
return `search-${this.$store.state.search_source}`
|
||||
}
|
||||
},
|
||||
is_visible_music() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_music'
|
||||
).value
|
||||
},
|
||||
is_visible_podcasts() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_podcasts'
|
||||
).value
|
||||
},
|
||||
is_visible_audiobooks() {
|
||||
show_audiobooks() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_audiobooks'
|
||||
).value
|
||||
},
|
||||
is_visible_radio() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_radio'
|
||||
).value
|
||||
},
|
||||
is_visible_files() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_files'
|
||||
).value
|
||||
},
|
||||
is_visible_search() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_search'
|
||||
).value
|
||||
},
|
||||
spotify_enabled() {
|
||||
return this.$store.state.spotify.webapi_token_valid
|
||||
},
|
||||
|
||||
show_burger_menu: {
|
||||
get() {
|
||||
return this.$store.state.show_burger_menu
|
||||
@ -189,11 +151,45 @@ export default {
|
||||
this.$store.commit(types.SHOW_BURGER_MENU, value)
|
||||
}
|
||||
},
|
||||
|
||||
show_files() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_files'
|
||||
).value
|
||||
},
|
||||
show_music() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_music'
|
||||
).value
|
||||
},
|
||||
show_player_menu() {
|
||||
return this.$store.state.show_player_menu
|
||||
},
|
||||
|
||||
show_playlists() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_playlists'
|
||||
).value
|
||||
},
|
||||
show_podcasts() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_podcasts'
|
||||
).value
|
||||
},
|
||||
show_radio() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_radio'
|
||||
).value
|
||||
},
|
||||
show_search() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_menu_item_search'
|
||||
).value
|
||||
},
|
||||
show_update_dialog: {
|
||||
get() {
|
||||
return this.$store.state.show_update_dialog
|
||||
@ -202,13 +198,9 @@ export default {
|
||||
this.$store.commit(types.SHOW_UPDATE_DIALOG, value)
|
||||
}
|
||||
},
|
||||
|
||||
search_name: {
|
||||
get() {
|
||||
return `search-${this.$store.state.search_source}`
|
||||
}
|
||||
spotify_enabled() {
|
||||
return this.$store.state.spotify.webapi_token_valid
|
||||
},
|
||||
|
||||
zindex() {
|
||||
if (this.show_player_menu) {
|
||||
return 'z-index: 21'
|
||||
@ -227,7 +219,6 @@ export default {
|
||||
on_click_outside_settings() {
|
||||
this.show_settings_menu = !this.show_settings_menu
|
||||
},
|
||||
|
||||
open_update_dialog() {
|
||||
this.show_update_dialog = true
|
||||
this.show_settings_menu = false
|
||||
|
@ -4,11 +4,33 @@ import i18n from '@/i18n'
|
||||
const { t, locale } = i18n.global
|
||||
|
||||
export const filters = {
|
||||
durationInHours(value_ms) {
|
||||
const format = value_ms >= 3600000 ? 'h:mm:ss' : 'm:ss'
|
||||
return Duration.fromMillis(value_ms).toFormat(format)
|
||||
channels(value) {
|
||||
if (value === 1) {
|
||||
return t('filter.mono')
|
||||
}
|
||||
if (value === 2) {
|
||||
return t('filter.stereo')
|
||||
}
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
return t('filter.channels', { value })
|
||||
},
|
||||
cursor(path, size = 20) {
|
||||
const viewbox = 24
|
||||
const center = size / 2
|
||||
return `url("data:image/svg+xml,%3Csvg width='${size}' height='${size}' viewBox='0 0 ${viewbox} ${viewbox}' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath d='${path}'/%3E%3C/svg%3E") ${center} ${center}, auto`
|
||||
},
|
||||
date(value) {
|
||||
return DateTime.fromISO(value)
|
||||
.setLocale(locale.value)
|
||||
.toLocaleString(DateTime.DATE_FULL)
|
||||
},
|
||||
datetime(value) {
|
||||
return DateTime.fromISO(value)
|
||||
.setLocale(locale.value)
|
||||
.toLocaleString(DateTime.DATETIME_MED)
|
||||
},
|
||||
|
||||
durationInDays(value_ms) {
|
||||
const minutes = Math.floor(value_ms / 60000)
|
||||
if (minutes > 1440) {
|
||||
@ -22,44 +44,15 @@ export const filters = {
|
||||
}
|
||||
return Duration.fromObject({ minutes }).shiftTo('minutes').toHuman()
|
||||
},
|
||||
|
||||
date(value) {
|
||||
return DateTime.fromISO(value)
|
||||
.setLocale(locale.value)
|
||||
.toLocaleString(DateTime.DATE_FULL)
|
||||
durationInHours(value_ms) {
|
||||
const format = value_ms >= 3600000 ? 'h:mm:ss' : 'm:ss'
|
||||
return Duration.fromMillis(value_ms).toFormat(format)
|
||||
},
|
||||
|
||||
datetime(value) {
|
||||
return DateTime.fromISO(value)
|
||||
.setLocale(locale.value)
|
||||
.toLocaleString(DateTime.DATETIME_MED)
|
||||
},
|
||||
|
||||
timeFromNow(value) {
|
||||
const diff = DateTime.now().diff(DateTime.fromISO(value))
|
||||
return this.durationInDays(diff.as('milliseconds'))
|
||||
},
|
||||
|
||||
number(value) {
|
||||
return value.toLocaleString(locale.value)
|
||||
},
|
||||
|
||||
channels(value) {
|
||||
if (value === 1) {
|
||||
return t('filter.mono')
|
||||
}
|
||||
if (value === 2) {
|
||||
return t('filter.stereo')
|
||||
}
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
return t('filter.channels', { value })
|
||||
},
|
||||
|
||||
cursor(path, size = 20) {
|
||||
const viewbox = 24
|
||||
const center = size / 2
|
||||
return `url("data:image/svg+xml,%3Csvg width='${size}' height='${size}' viewBox='0 0 ${viewbox} ${viewbox}' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath d='${path}'/%3E%3C/svg%3E") ${center} ${center}, auto`
|
||||
timeFromNow(value) {
|
||||
const diff = DateTime.now().diff(DateTime.fromISO(value))
|
||||
return this.durationInDays(diff.as('milliseconds'))
|
||||
}
|
||||
}
|
||||
|
@ -103,18 +103,18 @@ export class GroupedList {
|
||||
for (const [index, items] of this.itemsGrouped.entries()) {
|
||||
if (index !== NO_INDEX) {
|
||||
yield {
|
||||
index: index,
|
||||
itemId: index,
|
||||
index,
|
||||
isItem: false,
|
||||
item: {}
|
||||
item: {},
|
||||
itemId: index
|
||||
}
|
||||
}
|
||||
for (const item of items) {
|
||||
yield {
|
||||
index: index,
|
||||
itemId: item.id,
|
||||
index,
|
||||
isItem: true,
|
||||
item: item
|
||||
item,
|
||||
itemId: item.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ const dataObject = {
|
||||
index: { field: 'disc_number', type: Number }
|
||||
})
|
||||
if (vm.tracks.indices.length < 2) {
|
||||
vm.tracks.group({ index: { type: undefined } })
|
||||
vm.tracks.group()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ export default {
|
||||
},
|
||||
play() {
|
||||
webapi.player_play_uri(
|
||||
this.albums.items.map((a) => a.uri).join(','),
|
||||
this.albums.items.map((item) => item.uri).join(),
|
||||
true
|
||||
)
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ const dataObject = {
|
||||
return Promise.all([
|
||||
spotifyApi.getArtist(to.params.id),
|
||||
spotifyApi.getArtistAlbums(to.params.id, {
|
||||
limit: PAGE_SIZE,
|
||||
offset: 0,
|
||||
include_groups: 'album,single',
|
||||
market: store.state.spotify.webapi_country
|
||||
limit: PAGE_SIZE,
|
||||
market: store.state.spotify.webapi_country,
|
||||
offset: 0
|
||||
})
|
||||
])
|
||||
},
|
||||
|
@ -131,7 +131,7 @@ export default {
|
||||
id: 2,
|
||||
name: this.$t('page.artist.sort.rating'),
|
||||
options: {
|
||||
criteria: [{ field: 'rating', type: Number, order: -1 }],
|
||||
criteria: [{ field: 'rating', order: -1, type: Number }],
|
||||
index: { field: 'rating', type: 'Digits' }
|
||||
}
|
||||
}
|
||||
@ -169,7 +169,7 @@ export default {
|
||||
return this.$store.state.spotify.webapi_token_valid
|
||||
},
|
||||
track_uris() {
|
||||
return this.tracks_list.items.map((a) => a.uri).join(',')
|
||||
return this.tracks_list.items.map((item) => item.uri).join()
|
||||
},
|
||||
tracks() {
|
||||
const grouping = this.grouping_options.find(
|
||||
@ -193,7 +193,7 @@ export default {
|
||||
},
|
||||
play() {
|
||||
webapi.player_play_uri(
|
||||
this.tracks_list.items.map((a) => a.uri).join(','),
|
||||
this.tracks_list.items.map((item) => item.uri).join(),
|
||||
true
|
||||
)
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ export default {
|
||||
id: 2,
|
||||
name: this.$t('page.artists.sort.recently-added'),
|
||||
options: {
|
||||
criteria: [{ field: 'time_added', type: Date, order: -1 }],
|
||||
criteria: [{ field: 'time_added', order: -1, type: Date }],
|
||||
index: { field: 'time_added', type: Date }
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ export default {
|
||||
methods: {
|
||||
play() {
|
||||
webapi.player_play_uri(
|
||||
this.albums.items.map((a) => a.uri).join(','),
|
||||
this.albums.items.map((item) => item.uri).join(),
|
||||
false
|
||||
)
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ export default {
|
||||
id: 2,
|
||||
name: this.$t('page.composer.sort.rating'),
|
||||
options: {
|
||||
criteria: [{ field: 'rating', type: Number, order: -1 }],
|
||||
criteria: [{ field: 'rating', order: -1, type: Number }],
|
||||
index: { field: 'rating', type: 'Digits' }
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ export default {
|
||||
id: 2,
|
||||
name: this.$t('page.genre.sort.rating'),
|
||||
options: {
|
||||
criteria: [{ field: 'rating', type: Number, order: -1 }],
|
||||
criteria: [{ field: 'rating', order: -1, type: Number }],
|
||||
index: { field: 'rating', type: 'Digits' }
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ const dataObject = {
|
||||
|
||||
set(vm, response) {
|
||||
vm.recently_added = new GroupedList(response.data.albums, {
|
||||
criteria: [{ field: 'time_added', type: Date, order: -1 }],
|
||||
criteria: [{ field: 'time_added', order: -1, type: Date }],
|
||||
index: { field: 'time_added', type: Date }
|
||||
})
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ export default {
|
||||
computed: {
|
||||
uris() {
|
||||
if (this.playlist.random) {
|
||||
return this.tracks.map((a) => a.uri).join(',')
|
||||
return this.tracks.map((item) => item.uri).join()
|
||||
}
|
||||
return this.playlist.uri
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ const dataObject = {
|
||||
spotifyApi.getPlaylist(to.params.id),
|
||||
spotifyApi.getPlaylistTracks(to.params.id, {
|
||||
limit: PAGE_SIZE,
|
||||
offset: 0,
|
||||
market: store.state.spotify.webapi_country
|
||||
market: store.state.spotify.webapi_country,
|
||||
offset: 0
|
||||
})
|
||||
])
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user