Fixed up scroll-wheel folder de-nesting
This commit is contained in:
parent
8cdcfac87d
commit
e71e2fb699
|
@ -1,6 +1,6 @@
|
|||
const getChangeHeader = () => getClassNameElementsArray('change-header')[0]
|
||||
|
||||
const getFileElements = () => getClassNameElementsArray('file')
|
||||
const getFileElements = () => querySelectorAllArray('.file,.icon-folder-closed')
|
||||
|
||||
const getSelectedFile = () => getClassNameElementsArray('file-selected')[0]
|
||||
|
||||
|
@ -12,7 +12,7 @@ const addScrollHints = () => {
|
|||
if (fileElement.classList.contains('file-viewed')) {
|
||||
hint.classList.add('sages-extra-breadcrumbs-viewed')
|
||||
}
|
||||
hint.innerText = `${prefix} ${decodeURIComponent(fileElement.firstElementChild.href.split('#')[1])}`
|
||||
hint.innerText = `${prefix} ${decodeURIComponent(fileElement.firstElementChild?.href?.split('#')[1] || 'Folder')}`
|
||||
if (top) {
|
||||
hint.style.top = top
|
||||
}
|
||||
|
@ -42,8 +42,9 @@ const changeFile = e => {
|
|||
(up && index > 0) ? fileElements[index - 1] :
|
||||
(!up && index < (fileElements.length - 1)) ? fileElements[index + 1] :
|
||||
null
|
||||
nextElement?.firstElementChild?.focus()
|
||||
nextElement?.firstElementChild?.click()
|
||||
const toClick = nextElement?.firstElementChild ?? nextElement
|
||||
toClick?.focus()
|
||||
toClick?.click()
|
||||
}
|
||||
|
||||
let styled = false
|
||||
|
@ -71,4 +72,4 @@ addFix(() => {
|
|||
})
|
||||
|
||||
window.addEventListener('load', () => setTimeout(addScrollHints, NEW_PAGE_DELAY))
|
||||
addEventListener('hashchange', () => setTimeout(addScrollHints, 100))
|
||||
addEventListener('hashchange', () => setTimeout(addScrollHints, 200))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "Sage's BitBucket Addon",
|
||||
"description": "Ensure searches don't include forks (and other enhancements)",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.9",
|
||||
"manifest_version": 2,
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
|
@ -25,6 +25,7 @@
|
|||
"matches": ["*://git.add123.com/*"],
|
||||
"js": [
|
||||
"utils.js",
|
||||
"all-ADD-repos.js",
|
||||
"backtick-comments.js",
|
||||
"csharp-quotes.js",
|
||||
"file-scroll.js",
|
||||
|
|
3
utils.js
3
utils.js
|
@ -4,6 +4,9 @@ const CURRENT_PAGE_DELAY = 300
|
|||
const getClassNameElementsArray = className =>
|
||||
Array.from(document.getElementsByClassName(className))
|
||||
|
||||
const querySelectorAllArray = selector =>
|
||||
Array.from(document.querySelectorAll(selector))
|
||||
|
||||
/// Runs on "complete" load and when `https://website.tld#this-hash-value` changes
|
||||
const addFix = fixFunc => {
|
||||
window.addEventListener('load', () => setTimeout(fixFunc, NEW_PAGE_DELAY))
|
||||
|
|
Loading…
Reference in New Issue