diff options
author | 2019-01-17 19:57:53 +0700 | |
---|---|---|
committer | 2019-01-17 19:57:53 +0700 | |
commit | 11b927189bab258a226e251c1bd87504feee51f4 (patch) | |
tree | 89b3cf4ba9e6b49afd65b8f9a59a7ca33e46efe3 /source/features/hide-navigation-hover-highlight.tsx | |
parent | f25483fa128d9dcc8e1e74fcf2d2751d604fe11f (diff) | |
download | refined-github-11b927189bab258a226e251c1bd87504feee51f4.tar.gz refined-github-11b927189bab258a226e251c1bd87504feee51f4.tar.zst refined-github-11b927189bab258a226e251c1bd87504feee51f4.zip |
Drop Babel in favor of esm and TypeScript (#1726)
To get some meaningful errors during feature development, I thought it'd be useful to use TypeScript on `features.js` only, hoping to keep it contained to that file.
@sindresorhus suggested we just extend it the whole extension and maybe that can be done incrementally, without having to necessarily use types on everything.
Diffstat (limited to 'source/features/hide-navigation-hover-highlight.tsx')
-rw-r--r-- | source/features/hide-navigation-hover-highlight.tsx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/features/hide-navigation-hover-highlight.tsx b/source/features/hide-navigation-hover-highlight.tsx new file mode 100644 index 00000000..d254c1bc --- /dev/null +++ b/source/features/hide-navigation-hover-highlight.tsx @@ -0,0 +1,24 @@ +/* +Some lists like notifications, file lists, and issue lists, +are highlighted as you move the mouse over them. This highlight +is useful when navigating via the keyboard (j/k), but annoying +when just moving the mouse around. + +This feature will hide the highlight until the first keyboard +navigation, then it will be displayed until the next full reload. +*/ +import features from '../libs/features'; + +const className = 'rgh-no-navigation-highlight'; + +function init() { + document.body.classList.add(className); + document.body.addEventListener('navigation:keydown', () => { + document.body.classList.remove(className); + }, {once: true}); +} + +features.add({ + id: 'hide-navigation-hover-highlight', + init +}); |