GC Guess the Card Keyboard Controls Test

Adds keyboard controls to GC's Guess the Card

当前为 2024-03-16 提交的版本,查看 最新版本

// ==UserScript==
// @name         GC Guess the Card Keyboard Controls Test
// @namespace    https://greasyfork.org/en/users/1175371
// @version      0.1
// @description  Adds keyboard controls to GC's Guess the Card
// @author       sanjix
// @match        https://www.grundos.cafe/games/psychoanalysis/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
// @grant        none
// ==/UserScript==

var card = document.querySelector('main form button[value="square"]');
var buttons = document.querySelector('#page_content main .button-group button.form-control');
document.addEventListener('keydown', (event) => {
    if (event.keyCode == '13') {
        if (card != null) {
            card.click();
        } else if (buttons != null) {
            buttons.click();
        }
    }
})