[Neopets] Grumpy and Wise Kings Randomizer

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

As of 10.07.2022. See ბოლო ვერსია.

// ==UserScript==
// @name         [Neopets] Grumpy and Wise Kings Randomizer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Sets avatar joke for Skarl, randomized answers for Skarl and Hagan.
// @author       Piotr Kardovsky
// @match        https://www.neopets.com/medieval/grumpyking.phtml
// @match        https://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)); }
    if (window.location.href.includes('grumpyking.phtml')) {
        const AV = [3, 8, 6, 1, 39, 118, 1, 32, 1, 143];
        document.querySelectorAll('.form-container__2021').forEach((c) => {
            c.querySelectorAll('div').forEach((j, idx) => {
                let plslaugh = j.querySelector(`#${j.id[0]}p${idx + 1}`);
                plslaugh.selectedIndex = j.id[0] === 'q' ? R_JOKE === false ? AV[idx] : newr(plslaugh.length) : newr(plslaugh.length);
            });
        });
    } else if (window.location.href.includes('wiseking.phtml')) {
        document.querySelector('.form-container__2021').querySelectorAll('div').forEach((w, idx) => {
            let choice = w.querySelector(`#qp${idx + 1}`);
            choice.selectedIndex = newr(choice.length);
        });
    }
})();
长期地址
遇到问题?请前往 GitHub 提 Issues。