summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2022-01-13 22:20:10 +0100
committerSamantaz Fox <coding@samantaz.fr>2022-01-13 22:48:31 +0100
commit8aed1e11c34a063b7c8a19934e147118db0709d1 (patch)
treeef24fd9f672f598040119817664705ab6fe15696
parent6cf6c56dd136c3e94a13852d7278fab8c6f3da7d (diff)
downloadinvidious-8aed1e11c34a063b7c8a19934e147118db0709d1.tar.gz
invidious-8aed1e11c34a063b7c8a19934e147118db0709d1.tar.bz2
invidious-8aed1e11c34a063b7c8a19934e147118db0709d1.zip
Add JS to focus search box on '/'
-rw-r--r--assets/js/handlers.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/assets/js/handlers.js b/assets/js/handlers.js
index 1498f39a..a417fcca 100644
--- a/assets/js/handlers.js
+++ b/assets/js/handlers.js
@@ -142,4 +142,16 @@
var csrf_token = target.parentNode.querySelector('input[name="csrf_token"]').value;
xhr.send('csrf_token=' + csrf_token);
}
+
+ // Handle keypresses
+ window.addEventListener('keydown', (event) => {
+ // Ignore modifier keys
+ if (event.ctrlKey || event.metaKey) { return; }
+
+ // Focus search bar on '/'
+ if (event.key == "/") {
+ document.getElementById('searchbox').focus();
+ event.preventDefault();
+ }
+ });
})();
6 +0200'>2023-07-08HTML/CSS: Fix buttons' responsivenessSamantaz Fox 2023-07-08CSS: fix light/dark themes for pure buttonsSamantaz Fox 2023-07-08HTML: Fix thin mode/thumbnail on other itemsSamantaz Fox 2023-07-08HTML: merge MixVideo with other types in item.ecrSamantaz Fox 2023-07-08HTML: Use new buttons for playlists (save/delete/add videos/etc...)Samantaz Fox 2023-07-06HTML: Use new buttons for thumbnail overlaysSamantaz Fox In addition, this commit also heavily changes the structure of the generic "video card" item. Main benefits: * Improved accessibility for keyboard users * Many styling glitches were fixed * PlaylistVideos now use the same items as the rest * Elements all have distinct CSS classes * Design can be expanded to add more icons 2023-07-06HTML: Use the new pagination component for channel pagesSamantaz Fox 2023-07-06HTML: Use the new pagination component for search resultsSamantaz Fox 2023-07-06HTML: Use the new pagination component for playlistsSamantaz Fox 2023-07-06CSS: add styling for the new buttonsSamantaz Fox