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

View file

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