Compare commits

..

1 Commits

Author SHA1 Message Date
59a7af771c
Rewrite 2025-04-19 19:06:49 -04:00

View File

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