GC Guess the Card Keyboard Controls Test

Adds keyboard controls to GC's Guess the Card

  1. // ==UserScript==
  2. // @name GC Guess the Card Keyboard Controls Test
  3. // @namespace https://gf.qytechs.cn/en/users/1175371
  4. // @version 0.4
  5. // @description Adds keyboard controls to GC's Guess the Card
  6. // @author sanjix
  7. // @match https://www.grundos.cafe/games/psychoanalysis/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. var cards = document.querySelectorAll('main form button[name="card"]');
  14. var buttons = document.querySelector('#page_content main .button-group button.form-control');
  15.  
  16. function guessRandomCard(cards) {
  17. var randomizer = Math.floor(Math.random() * 5)
  18. return cards[randomizer]
  19. }
  20.  
  21. document.addEventListener('keydown', (event) => {
  22. console.log(event.key);
  23. if (event.key == 'Enter') {
  24. if (cards.length > 0) {
  25. guessRandomCard(cards).click();
  26. } else if (buttons != null) {
  27. buttons.click();
  28. }
  29. }
  30. })

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址