mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-27 22:46:02 -05:00
[web] Lint source code
This commit is contained in:
parent
5640c33a67
commit
be931f4173
@ -97,9 +97,8 @@ export default {
|
|||||||
// Hook the progress bar to start before we move router-view
|
// Hook the progress bar to start before we move router-view
|
||||||
this.$router.beforeEach((to, from, next) => {
|
this.$router.beforeEach((to, from, next) => {
|
||||||
if (to.meta.show_progress && !(to.path === from.path && to.hash)) {
|
if (to.meta.show_progress && !(to.path === from.path && to.hash)) {
|
||||||
if (to.meta.progress !== undefined) {
|
if (to.meta.progress) {
|
||||||
const meta = to.meta.progress
|
this.$Progress.parseMeta(to.meta.progress)
|
||||||
this.$Progress.parseMeta(meta)
|
|
||||||
}
|
}
|
||||||
this.$Progress.start()
|
this.$Progress.start()
|
||||||
}
|
}
|
||||||
@ -171,7 +170,7 @@ export default {
|
|||||||
maxReconnectInterval: 2000
|
maxReconnectInterval: 2000
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.onopen = function () {
|
socket.onopen = () => {
|
||||||
vm.reconnect_attempts = 0
|
vm.reconnect_attempts = 0
|
||||||
socket.send(
|
socket.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@ -239,7 +238,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.onmessage = function (response) {
|
socket.onmessage = (response) => {
|
||||||
const data = JSON.parse(response.data)
|
const data = JSON.parse(response.data)
|
||||||
if (
|
if (
|
||||||
data.notify.includes('update') ||
|
data.notify.includes('update') ||
|
||||||
|
@ -146,7 +146,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
reset_scrolling() {
|
reset_scrolling() {
|
||||||
// Scroll to the start of the lyrics in all cases
|
// Scroll to the start of the lyrics in all cases
|
||||||
if (this.player.item_id != this.lastItemId && this.$refs.lyrics) {
|
if (this.player.item_id !== this.lastItemId && this.$refs.lyrics) {
|
||||||
this.$refs.lyrics.scrollTo(0, 0)
|
this.$refs.lyrics.scrollTo(0, 0)
|
||||||
}
|
}
|
||||||
this.lastItemId = this.player.item_id
|
this.lastItemId = this.player.item_id
|
||||||
@ -154,7 +154,7 @@ export default {
|
|||||||
},
|
},
|
||||||
start_scrolling(e) {
|
start_scrolling(e) {
|
||||||
// Consider only user events
|
// Consider only user events
|
||||||
if (e.screenX || e.screenX != 0 || e.screenY || e.screenY != 0) {
|
if (e.screenX || e.screenX !== 0 || e.screenY || e.screenY !== 0) {
|
||||||
this.autoScrolling = false
|
this.autoScrolling = false
|
||||||
if (this.scrollingTimer) {
|
if (this.scrollingTimer) {
|
||||||
clearTimeout(this.scrollingTimer)
|
clearTimeout(this.scrollingTimer)
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
const toColor = (string) => {
|
const toColor = (string) => {
|
||||||
let hash = 0
|
let hash = 0
|
||||||
for (let i = 0; i < string.length; i++) {
|
for (const char of string) {
|
||||||
hash = string.charCodeAt(i) + ((hash << 5) - hash)
|
hash = char.charCodeAt(0) + ((hash << 5) - hash)
|
||||||
}
|
}
|
||||||
return (hash & 0x00ffffff).toString(16)
|
return (hash & 0x00ffffff).toString(16)
|
||||||
}
|
}
|
||||||
|
|
||||||
const luminance = (color) =>
|
const luminance = (color) =>
|
||||||
[0.2126, 0.7152, 0.0722].reduce(
|
[0.2126, 0.7152, 0.0722].reduce(
|
||||||
(luminance, factor, index) =>
|
(value, factor, index) =>
|
||||||
luminance + Number(`0x${color.slice(index * 2, index * 2 + 2)}`) * factor,
|
value + Number(`0x${color.slice(index * 2, index * 2 + 2)}`) * factor,
|
||||||
0
|
0
|
||||||
) / 255
|
) / 255
|
||||||
|
|
||||||
|
@ -135,10 +135,7 @@ export default {
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
current_position() {
|
current_position() {
|
||||||
const nowPlaying = this.$store.getters.now_playing
|
return this.$store.getters.now_playing?.position ?? -1
|
||||||
return nowPlaying === undefined || nowPlaying.position === undefined
|
|
||||||
? -1
|
|
||||||
: this.$store.getters.now_playing.position
|
|
||||||
},
|
},
|
||||||
is_queue_save_allowed() {
|
is_queue_save_allowed() {
|
||||||
return (
|
return (
|
||||||
@ -189,7 +186,7 @@ export default {
|
|||||||
remove(item) {
|
remove(item) {
|
||||||
webapi.queue_remove(item.id)
|
webapi.queue_remove(item.id)
|
||||||
},
|
},
|
||||||
update_show_next_items(e) {
|
update_show_next_items() {
|
||||||
this.$store.commit(types.SHOW_ONLY_NEXT_ITEMS, !this.show_only_next_items)
|
this.$store.commit(types.SHOW_ONLY_NEXT_ITEMS, !this.show_only_next_items)
|
||||||
},
|
},
|
||||||
save_dialog() {
|
save_dialog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user