From 9d6878a1aa8e02d9bbd44bbc1971bc51fce38d91 Mon Sep 17 00:00:00 2001 From: rr- Date: Fri, 3 Jun 2016 19:46:28 +0200 Subject: [PATCH] client/posts: bind 'p' key --- client/html/posts_header.tpl | 10 +++++----- client/js/views/posts_header_view.js | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/html/posts_header.tpl b/client/html/posts_header.tpl index 28938c8..1c27e02 100644 --- a/client/html/posts_header.tpl +++ b/client/html/posts_header.tpl @@ -8,11 +8,11 @@
- - '/> - '/> - '/> - Syntax help + + '/> + '/> + '/> + Syntax help
diff --git a/client/js/views/posts_header_view.js b/client/js/views/posts_header_view.js index 7a482e8..261aa87 100644 --- a/client/js/views/posts_header_view.js +++ b/client/js/views/posts_header_view.js @@ -30,6 +30,14 @@ class PostsHeaderView { form.querySelector('input').focus(); }); + keyboard.bind('p', () => { + const firstPostNode + = document.body.querySelector('.post-list li:first-child a'); + if (firstPostNode) { + firstPostNode.focus(); + } + }); + for (let safetyButton of form.querySelectorAll('.safety')) { safetyButton.addEventListener( 'click', e => this._evtSafetyButtonClick(e, ctx.clientUrl));