Compare commits
1 Commits
996a38bacb
...
59a7af771c
Author | SHA1 | Date | |
---|---|---|---|
59a7af771c |
@ -22,10 +22,11 @@ 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)'
|
||||
|
||||
globalThis.location.pathname === '/item' ?
|
||||
isComment() ?
|
||||
// Drawing the boxShadow on this selector isn't visible enough.
|
||||
query[selected].querySelector('a.togg.clicky')?.focus(focusInvisible)
|
||||
:
|
||||
@ -71,10 +72,10 @@ const
|
||||
globalThis.open('https://news.ycombinator.com/item?id=' + query[selected].id)
|
||||
return
|
||||
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
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user