Skip to content

Commit

Permalink
Allow selecting bottom row diagonally with ArrowDown
Browse files Browse the repository at this point in the history
  • Loading branch information
probablykasper committed Jan 10, 2024
1 parent 79aa8b5 commit 1af58cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next
- Load 100 videos at a time instead of 50
- Allow selecting bottom row diagonally with the down arrow key

## 1.5.0 - 2023 Nov 19
- Add support for all channel URLs. URLs like `/lacunarecs`, `/@lacunarecs`, `/c/lacunarecs`, `/user/lacunarecs` and even `/lacunarecs/playlists` etc work now.
Expand Down
9 changes: 4 additions & 5 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
await autoloadHandler()
}
async function autoloadHandler() {
if (!allLoaded && isScrolledToBottom() && !loading) {
if (!allLoaded && isScrolledNearBottom() && !loading) {
await getMoreVideos()
}
}
Expand Down Expand Up @@ -99,7 +99,7 @@
}
let scrollDiv: HTMLElement | null = null
function isScrolledToBottom() {
function isScrolledNearBottom() {
if (scrollDiv) {
const lastElement = boxes[videos.length - 1]
const threshold = lastElement.offsetTop - 200
Expand Down Expand Up @@ -159,9 +159,8 @@
e.preventDefault()
} else if (checkShortcut(e, 'ArrowDown')) {
const columnCount = getColumnCount()
if (selectedIndex + columnCount <= videos.length - 1) {
selectedIndex += columnCount
}
selectedIndex += columnCount
selectedIndex = Math.min(selectedIndex, videos.length - 1)
e.preventDefault()
} else if (checkShortcut(e, 'Escape')) {
selectionVisible = false
Expand Down

0 comments on commit 1af58cf

Please sign in to comment.