Keyboard controls for dice-a-roo and gormball
当前为
// ==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();}
}
);
}
});
})();