Dice-a-roo and Gormball keyboard controls

Keyboard controls for dice-a-roo and gormball

目前為 2024-03-09 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Dice-a-roo and Gormball keyboard controls
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Keyboard controls for dice-a-roo and gormball
// @author       Dij
// @match        https://www.grundos.cafe/games/dicearoo/
// @match        https://www.grundos.cafe/games/play_dicearoo/
// @match        https://www.grundos.cafe/games/gormball/
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js
// @icon         https://www.grundos.cafe/static/images/favicon.66a6c5f11278.ico
// @grant        none
// @license      MIT
// ==/UserScript==
/* global $ */
/*
1 Thyassa
2 Brian
3 Gargarox
4 Farvin III
5 Ember
6 COOL Zargrold
7 Ursula
8 Kevin
*/
var preferredPlayer = 3;

var play = '.button-group input[value="Lets Play!"]'
var restart = '.button-group input[value="Press Me"]'
var roll = '.button-group input[value="Roll Again"]'
var gorm = '.button-group input[value="Next >>>"]'
var throwGorm = '.button-group input[value="Throw!"]'
var moreGorm = '.button-group input[value="Continue!"]'
var againGorm = '.button-group input[value="Play Again"]'
var chooseAGorm = `.gormball_player[data-id="${preferredPlayer}"]`;

(function() {
    'use strict';
document.addEventListener("keydown", (event) => {
    // press enter and ALL of the found buttons will be clicked. Only one of these should exist on one page at a time so it should be fine maybe
    if (event.keyCode == 13) {
        var doIt = [$(roll), $(restart), $(play), $(gorm), $(throwGorm), $(moreGorm), $(againGorm), $(chooseAGorm)];
        doIt.forEach(
            function(button) {
                if(button.size() > 0){ button.click();}
                             }
                    );
    }
});

})();