[GC] - Scorchy Slots Keyboard Controls

Enables keyboard navigation for GC's Scorchy Slots.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         [GC] - Scorchy Slots Keyboard Controls
// @description  Enables keyboard navigation for GC's Scorchy Slots.
// @icon         https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
// @match        https://www.grundos.cafe/games/play_slots/
// @match        https://www.grundos.cafe/games/slots/
// @author       aether
// @namespace    https://github.com/hlmartin/gc-userscripts/
// @version      1.0.1
// @license      MIT
// @supportURL   https://github.com/hlmartin/gc-userscripts/issues
// ==/UserScript==

const submit = () => {
  const button = document.querySelector('input[type="submit"][value="Click Here to Play"], input[type="submit"][value="Play Again"], input[type="submit"][value="Collect Winnings"]');
  if (button) {
    button.click();
  }
}

const hold = (key) => {
  const index = key - 1;
  const checkbox = document.querySelector(`#scorchy-hold input[type="checkbox"][name="scorchy_hold_${index}"]`);
  if (checkbox) {
    checkbox.checked = !checkbox.checked;
  }
}

document.addEventListener("keydown", (event) => {
  switch (event.key) {
    case 'Enter':
      submit();
      break;
    case '1':
    case '2':
    case '3':
    case '4':
      hold(parseInt(event.key));
      break;
  }
});