My left hand tends to be occupied while I'm using this site. It would be nice if the arrow keys were shortcut keys with the same function as WASD. Right now, up/down arrow keys work as scrolling, but left/right don't let you navigate between pages.
Posted under Bugs & Features
My left hand tends to be occupied while I'm using this site. It would be nice if the arrow keys were shortcut keys with the same function as WASD. Right now, up/down arrow keys work as scrolling, but left/right don't let you navigate between pages.
I think that was done back when keyboard navigation was first rolled out on Danbooru, but got changed soon after due to interfering with horizontal keyboard scrolling (relevant when looking at, say, full-size images with a large horizontal resolution; examples in absurdres wide_image).
Here's a small script for you:
// ==UserScript== // @name Danbooru left-handed mode // @match *://*.donmai.us/posts/* // @version 0.1.0 // @author Nameless Contributor // @description Enable using arrow keys for previous/next post. // ==/UserScript== 'use strict'; const left = document.querySelector('a[data-shortcut="a"]'); const right = document.querySelector('a[data-shortcut="d"]'); left.setAttribute('data-shortcut', 'a left'); left.title = 'Shortcut is a or left'; right.setAttribute('data-shortcut', 'd right'); right.title = 'Shortcut is d or right'; Danbooru.Shortcuts.initialize_data_shortcuts();
You need a userscript manager like Violentmonkey to use it.
Thank you, I'll try it out. Would Greasemonkey work?
Alanis_the_Evoker said:
I think that was done back when keyboard navigation was first rolled out on Danbooru, but got changed soon after due to interfering with horizontal keyboard scrolling (relevant when looking at, say, full-size images with a large horizontal resolution; examples in absurdres wide_image).
Ah, that makes sense.
shorno said:
Thank you, I'll try it out. Would Greasemonkey work?
Should work no problem.
@shorno I noticed a bug where the script wouldn't work on the first page of a pool. I also took the opportunity to simplify the script.
// ==UserScript== // @name Danbooru left-handed mode // @match *://*.donmai.us/posts/* // @version 0.1.1 // @author Nameless Contributor // @description Enable using arrow keys for previous/next post. // ==/UserScript== 'use strict'; document.querySelector('a[data-shortcut="a"]')?.setAttribute('data-shortcut', 'a left'); document.querySelector('a[data-shortcut="d"]')?.setAttribute('data-shortcut', 'd right'); Danbooru.Shortcuts.initialize_data_shortcuts();
Nameless_Contributor said:
@shorno I noticed a bug where the script wouldn't work on the first page of a pool. I also took the opportunity to simplify the script.
// ==UserScript== // @name Danbooru left-handed mode // @match *://*.donmai.us/posts/* // @version 0.1.1 // @author Nameless Contributor // @description Enable using arrow keys for previous/next post. // ==/UserScript== 'use strict'; document.querySelector('a[data-shortcut="a"]')?.setAttribute('data-shortcut', 'a left'); document.querySelector('a[data-shortcut="d"]')?.setAttribute('data-shortcut', 'd right'); Danbooru.Shortcuts.initialize_data_shortcuts();
Thank you!
shorno said:
Thank you, I'll try it out. Would Greasemonkey work?
I've previously tried different userscript extensions, none worked even after fiddling with them, Violentmonkey worked instantly, so I'd suggest that.