[GC] - Scorchy Slots Keyboard Mapping

Keyboard controls for Scorchy Slots. See beginning of script for settings.

  1. // ==UserScript==
  2. // @name [GC] - Scorchy Slots Keyboard Mapping
  3. // @namespace https://greasyfork.org/en/users/1225524-kaitlin
  4. // @match https://www.grundos.cafe/games/slots/*
  5. // @match https://www.grundos.cafe/games/play_slots/
  6. // @grant none
  7. // @version 1.0
  8. // @icon https://i.imgur.com/4Hm2e6z.png
  9. // @author Cupkait
  10. // @description Keyboard controls for Scorchy Slots. See beginning of script for settings.
  11. // ==/UserScript==
  12.  
  13. // Change this to false to stop ALL pop-ups when you can hold.
  14. // To keep alerst when maps and/or jackpot bags are present,
  15. // leave this true and change the preference below.
  16. const holdReminders = true;
  17.  
  18. // To be notified of all pages with hold values, leave this as: "all"
  19. // To only get an alert when you can hold a map or jackpot square, change this to: "maps"
  20. // To only get an alert when you can hold a jackpot square, change this to: "jackpot"
  21. const holdPreference = "all";
  22.  
  23.  
  24.  
  25.  
  26.  
  27. const beforeSlots = $('#scorchy-rules');
  28. const mainSlots = $('#scorchy-wrapper');
  29. const ingameSlots = $('#scorchy-outer-wrapper')
  30. const holdSlots = $('#scorchy-hold');
  31.  
  32. if (beforeSlots.length === 1) {
  33. console.log("Begin Page");
  34. document.addEventListener('keydown', function(event) {
  35. if (event.key === 'Enter') {
  36. const submitButton = document.querySelector('input[type="submit"][value="Click Here to Play"]');
  37. if (submitButton) {
  38. submitButton.click();
  39. }
  40. }
  41. });
  42. } else if (ingameSlots.length === 1){
  43. console.log("Game Ongoing.")
  44. console.log(holdSlots.length);
  45. const winningRow = document.querySelectorAll('.scorchy-row')[1];
  46.  
  47. if (holdSlots.length === 1 && holdReminders === true && holdPreference === "jackpot") {
  48. if (winningRow && winningRow.innerHTML.includes('baggold_0.gif')) {
  49.  
  50.  
  51. alert("Don't forget to hold!\n Number keys 1-4 can be used to toggle checkboxes.");
  52. document.addEventListener('keydown', function(event) {
  53. if (event.key >= '1' && event.key <= '4') {
  54. const index = parseInt(event.key) - 1;
  55. const checkbox = document.querySelector(`#scorchy-hold input[type="checkbox"][name="scorchy_hold_${index}"]`);
  56.  
  57. if (checkbox) {
  58. checkbox.checked = !checkbox.checked;
  59. }
  60. }
  61. });
  62.  
  63. };
  64. } else if (holdSlots.length === 1 && holdReminders === true && holdPreference === "maps") {
  65. if (winningRow && winningRow.innerHTML.includes('mappiece_0.gif')) {
  66.  
  67. window.onload = function() {
  68. alert("Don't forget to hold!\n Number keys 1-4 can be used to toggle checkboxes.");
  69. document.addEventListener('keydown', function(event) {
  70. if (event.key >= '1' && event.key <= '4') {
  71. const index = parseInt(event.key) - 1;
  72. const checkbox = document.querySelector(`#scorchy-hold input[type="checkbox"][name="scorchy_hold_${index}"]`);
  73.  
  74. if (checkbox) {
  75. checkbox.checked = !checkbox.checked;
  76. }
  77. }
  78. });}
  79.  
  80. };
  81. } else if (holdSlots.length === 1 && holdReminders === true) {
  82. window.onload = function() {
  83. alert("Don't forget to hold!\n Number keys 1-4 can be used to toggle checkboxes.");
  84. document.addEventListener('keydown', function(event) {
  85. if (event.key >= '1' && event.key <= '4') {
  86. const index = parseInt(event.key) - 1;
  87. const checkbox = document.querySelector(`#scorchy-hold input[type="checkbox"][name="scorchy_hold_${index}"]`);
  88.  
  89. if (checkbox) {
  90. checkbox.checked = !checkbox.checked;
  91. }
  92. }
  93. });
  94.  
  95. };
  96. }
  97.  
  98. document.addEventListener('keydown', function(event) {
  99. if (event.key === 'Enter') {
  100. const submitButton = document.querySelector('input[type="submit"][value="Play Again"], input[type="submit"][value="Collect Winnings"]');
  101. if (submitButton) {
  102. submitButton.click();
  103. }
  104. }
  105. });
  106. }