mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 00:11:48 -06:00
feat: add ?scroll query param to set scroll sensitivity on load (#681)
Follows the same pattern as the existing ?volume param. Lets users bake a preferred scroll sensitivity into the URL (useful for cast/embed setups where the settings panel isn't reachable), and it's persisted to localStorage afterwards so it sticks on future visits. Fixes #607
This commit is contained in:
@@ -206,6 +206,11 @@
|
||||
return Math.max(0.0, Math.min(!isNaN(numberParam) ? numberParam * 100 : 100, 100))
|
||||
}
|
||||
|
||||
get scroll() {
|
||||
const numberParam = parseInt(new URL(location.href).searchParams.get('scroll') || '', 10)
|
||||
return Math.max(1, Math.min(!isNaN(numberParam) ? numberParam : 10, 100))
|
||||
}
|
||||
|
||||
get isCastMode() {
|
||||
return !!new URL(location.href).searchParams.get('cast')
|
||||
}
|
||||
@@ -229,6 +234,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('scroll', { immediate: true })
|
||||
onScroll(scroll: number) {
|
||||
if (new URL(location.href).searchParams.has('scroll')) {
|
||||
this.$accessor.settings.setScroll(scroll)
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('hideControls', { immediate: true })
|
||||
onHideControls(enabled: boolean) {
|
||||
if (enabled) {
|
||||
|
||||
@@ -52,6 +52,7 @@ You can use query parameters to customize the Neko web interface. These paramete
|
||||
| `?cast=1` | Hides all controls and shows only the video. |
|
||||
| `?embed=1` | Hides most additional components and shows only the video. |
|
||||
| `?volume=<0-1>` | Sets the volume to the given value (between 0 and 1). |
|
||||
| `?scroll=<1-100>` | Sets the scroll sensitivity to the given value (1-100). |
|
||||
| `?lang=<language>` | Sets the language to the given value. |
|
||||
| `?show_side=1` | Shows the sidebar on startup. |
|
||||
| `?mute_chat=1` | Mutes the chat on startup. |
|
||||
|
||||
Reference in New Issue
Block a user