Dice-a-roo and Gormball keyboard controls

Keyboard controls for dice-a-roo and gormball

当前为 2024-03-09 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();}
                             }
                    );
    }
});

})();