GC Dice-A-Roo Keyboard Controls

Adds keyboard controls for Dice-A-Roo on GC.

当前为 2023-09-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GC Dice-A-Roo Keyboard Controls
  3. // @namespace https://greasyfork.org/en/users/1175371/
  4. // @version 0.2
  5. // @description Adds keyboard controls for Dice-A-Roo on GC.
  6. // @author sanjix
  7. // @match https://www.grundos.cafe/games/play_dicearoo/
  8. // @match https://www.grundos.cafe/games/dicearoo/
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
  10. // ==/UserScript==
  11. var restart = document.querySelector("input[value='Press Me']")
  12. var play = document.querySelector("input[value='Lets Play!']")
  13. var roll = document.querySelector("input[value='Roll Again']");
  14.  
  15.  
  16. function diceARoo(element, event) {
  17. if (event.keyCode == 13) {
  18. element.click()
  19. }
  20. }
  21.  
  22. document.addEventListener("keydown", (event) => {
  23. if (event.keyCode == 13) {
  24. if (play != null) {
  25. play.click();
  26. } else if (roll != null) {
  27. roll.click();
  28. } else if (restart != null) {
  29. restart.click();
  30. }
  31. }
  32. });