Danbooru

shortcut keys: make arrowkeys shortcuts for WASD

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.

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 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!

1