client/posts: bind 'p' key
This commit is contained in:
parent
c114cec642
commit
9d6878a1aa
2 changed files with 13 additions and 5 deletions
|
@ -8,11 +8,11 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class='buttons'>
|
<div class='buttons'>
|
||||||
<input type='submit' value='Search'/>
|
<input class='mousetrap' type='submit' value='Search'/>
|
||||||
<input data-safety=safe type='button' class='safety safety-safe <%= ctx.settings.listPosts.safe ? '' : 'disabled' %>'/>
|
<input data-safety=safe type='button' class='mousetrap safety safety-safe <%= ctx.settings.listPosts.safe ? '' : 'disabled' %>'/>
|
||||||
<input data-safety=sketchy type='button' class='safety safety-sketchy <%= ctx.settings.listPosts.sketchy ? '' : 'disabled' %>'/>
|
<input data-safety=sketchy type='button' class='mousetrap safety safety-sketchy <%= ctx.settings.listPosts.sketchy ? '' : 'disabled' %>'/>
|
||||||
<input data-safety=unsafe type='button' class='safety safety-unsafe <%= ctx.settings.listPosts.unsafe ? '' : 'disabled' %>'/>
|
<input data-safety=unsafe type='button' class='mousetrap safety safety-unsafe <%= ctx.settings.listPosts.unsafe ? '' : 'disabled' %>'/>
|
||||||
<a class='button append' href='/help/search/posts'>Syntax help</a>
|
<a class='mousetrap button append' href='/help/search/posts'>Syntax help</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,6 +30,14 @@ class PostsHeaderView {
|
||||||
form.querySelector('input').focus();
|
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')) {
|
for (let safetyButton of form.querySelectorAll('.safety')) {
|
||||||
safetyButton.addEventListener(
|
safetyButton.addEventListener(
|
||||||
'click', e => this._evtSafetyButtonClick(e, ctx.clientUrl));
|
'click', e => this._evtSafetyButtonClick(e, ctx.clientUrl));
|
||||||
|
|
Loading…
Reference in a new issue