Automatically enter folders when file-scrolling

This commit is contained in:
Sage Vaillancourt 2023-12-04 10:53:33 -05:00
parent 46b873e71d
commit de342265b1
2 changed files with 7 additions and 3 deletions

View File

@ -12,7 +12,7 @@ const addScrollHints = () => {
if (fileElement.classList.contains('file-viewed')) { if (fileElement.classList.contains('file-viewed')) {
hint.classList.add('sages-extra-breadcrumbs-viewed') hint.classList.add('sages-extra-breadcrumbs-viewed')
} }
hint.innerText = `${prefix} ${decodeURIComponent(fileElement.firstElementChild?.href?.split('#')[1] || 'Folder')}` hint.innerText = `${prefix} ${decodeURIComponent(fileElement.firstElementChild?.href?.split('#')[1] || 'In Folder...')}`
if (top) { if (top) {
hint.style.top = top hint.style.top = top
} }
@ -32,7 +32,7 @@ const addScrollHints = () => {
} }
const changeFile = e => { const changeFile = (e, noRecurse) => {
const selectedFile = getSelectedFile() const selectedFile = getSelectedFile()
const fileElements = getFileElements() const fileElements = getFileElements()
@ -42,9 +42,13 @@ const changeFile = e => {
(up && index > 0) ? fileElements[index - 1] : (up && index > 0) ? fileElements[index - 1] :
(!up && index < (fileElements.length - 1)) ? fileElements[index + 1] : (!up && index < (fileElements.length - 1)) ? fileElements[index + 1] :
null null
const isFolder = !nextElement?.firstElementChild
const toClick = nextElement?.firstElementChild ?? nextElement const toClick = nextElement?.firstElementChild ?? nextElement
toClick?.focus() toClick?.focus()
toClick?.click() toClick?.click()
if (isFolder) {
changeFile(e)
}
} }
let styled = false let styled = false

View File

@ -1,7 +1,7 @@
{ {
"name": "Sage's BitBucket Addon", "name": "Sage's BitBucket Addon",
"description": "Ensure searches don't include forks (and other enhancements)", "description": "Ensure searches don't include forks (and other enhancements)",
"version": "1.0.11", "version": "1.0.12",
"manifest_version": 2, "manifest_version": 2,
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {