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