Compare commits

..

1 Commits

Author SHA1 Message Date
996a38bacb
Rewrite 2025-04-19 12:53:10 -04:00

View File

@ -22,11 +22,10 @@ let
const
// This is a Firefox only option. For some reason older versions of Firefox can't set outline: none.
focusInvisible = { __proto__: null, focusVisible: false },
isComment = () => query[selected].classList.contains('comtr'),
highlightSelected = () => {
query[selected].style.boxShadow = '0px 0px 10px 4px rgba(0,0,0,0.73)'
isComment() ?
globalThis.location.pathname === '/item' ?
// Drawing the boxShadow on this selector isn't visible enough.
query[selected].querySelector('a.togg.clicky')?.focus(focusInvisible)
:
@ -72,10 +71,10 @@ const
globalThis.open('https://news.ycombinator.com/item?id=' + query[selected].id)
return
case 'u':
globalThis.open((isComment() ? query[selected] : query[selected].nextSibling).querySelector('a.hnuser').href, '_self')
globalThis.open((globalThis.location.pathname === '/item' ? query[selected] : query[selected].nextSibling).querySelector('a.hnuser').href, '_self')
return
case 'U':
globalThis.open((isComment() ? query[selected] : query[selected].nextSibling).querySelector('a.hnuser').href)
globalThis.open((globalThis.location.pathname === '/item' ? query[selected] : query[selected].nextSibling).querySelector('a.hnuser').href)
}
},
listen = () => globalThis.document.addEventListener('keydown', keydown)