Adds keyboard controls to GC's Guess the Card
目前為
// ==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();
}
}
})