[Neopets] Grumpy and Wise Kings Randomizer

Sets avatar joke for Skarl, randomized answers for Skarl and Hagan.

As of 2022-07-11. See the latest version.

// ==UserScript==
// @name         [Neopets] Grumpy and Wise Kings Randomizer
// @namespace    https://greasyforks.org/en/scripts/447682
// @version      0.3
// @description  Sets avatar joke for Skarl, randomized answers for Skarl and Hagan.
// @author       Piotr Kardovsky
// @match        http*://www.neopets.com/medieval/grumpyking.phtml
// @match        http*://www.neopets.com/medieval/wiseking.phtml
// @icon         https://www.neopets.com//favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // Set to true to randomize joke instead of using avatar joke
    const R_JOKE = false;
    // rando function
    var newr = (l) => { return 1 + Math.floor(Math.random() * (l - 1)); }
    const AV = [3, 8, 6, 1, 39, 118, 1, 32, 1, 143];
    let grump = window.location.href.includes('grumpyking.phtml');
    document.querySelectorAll('.form-container__2021 select').forEach((j, idx) => {
        j.selectedIndex = j.id[0] === 'q' ? R_JOKE === false ? grump ? AV[idx] : newr(j.length) : newr(j.length) : newr(j.length);
    });
})();
长期地址
遇到问题?请前往 GitHub 提 Issues。