This commit is contained in:
Luna D. 2024-09-30 22:32:09 +02:00
parent fbd18fd1fd
commit b107330e2a
No known key found for this signature in database
GPG key ID: 4B1C63448394F688
2 changed files with 12 additions and 25 deletions

View file

@ -47,31 +47,16 @@ function isOK(event: KeyboardEvent): boolean {
);
}
/* eslint-disable prettier/prettier */
const keyCodes: ShortcutKeyMap = {
j() {
click('.js-prev');
}, // J - go to previous image
i() {
click('.js-up');
}, // I - go to index page
k() {
click('.js-next');
}, // K - go to next image
r() {
click('.js-rand');
}, // R - go to random image
s() {
click('.js-source-link');
}, // S - go to image source
l() {
click('.js-tag-sauce-toggle');
}, // L - edit tags
o() {
openFullView();
}, // O - open original
v() {
openFullViewNewTab();
}, // V - open original in a new tab
j() { click('.js-prev'); }, // J - go to previous image
i() { click('.js-up'); }, // I - go to index page
k() { click('.js-next'); }, // K - go to next image
r() { click('.js-rand'); }, // R - go to random image
s() { click('.js-source-link'); }, // S - go to image source
l() { click('.js-tag-sauce-toggle'); }, // L - edit tags
o() { openFullView(); }, // O - open original
v() { openFullViewNewTab(); }, // V - open original in a new tab
f() {
// F - favourite image
click(getHover() ? `a.interaction--fave[data-image-id="${getHover()}"]` : '.block__header a.interaction--fave');
@ -81,6 +66,7 @@ const keyCodes: ShortcutKeyMap = {
click(getHover() ? `a.interaction--upvote[data-image-id="${getHover()}"]` : '.block__header a.interaction--upvote');
},
};
/* eslint-enable prettier/prettier */
export function listenForKeys() {
document.addEventListener('keydown', (event: KeyboardEvent) => {

View file

@ -24,7 +24,6 @@
"@vitest/coverage-v8": "^1.6.0",
"chai": "^5",
"eslint": "^9.4.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vitest": "^0.5.4",
"jest-environment-jsdom": "^29.7.0",
@ -2791,6 +2790,8 @@
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz",
"integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
"dev": true,
"optional": true,
"peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},