Neopets: HTML Game UI tweaks

Moves elements around on various HTML-based games so the buttons to continue playing on each screen can be clicked without having to move the mouse on every new screen.

От 09.11.2025. Виж последната версия.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name             Neopets: HTML Game UI tweaks
// @namespace        kmtxcxjx
// @version          1.0.1
// @description      Moves elements around on various HTML-based games so the buttons to continue playing on each screen can be clicked without having to move the mouse on every new screen.
// @match            *://www.neopets.com/games/slots.phtml*
// @match            *://www.neopets.com/medieval/doubleornothing.phtml*
// @match            *://www.neopets.com/medieval/cheeseroller.phtml
// @grant            none
// @run-at           document-end
// @icon             https://images.neopets.com/games/aaa/dailydare/2012/post/theme-icon.png
// @license          MIT
// ==/UserScript==

(function() {
    'use strict';

    // SCORCHY SLOTS
    if (window.location.href.includes('://www.neopets.com/games/slots.phtml')) {
        const form = document.querySelector('form[action="process_slots2.phtml"]');
        if (!form) return;
        const submitButton = form.querySelector('center input[type="submit"]');
        if (!submitButton) return;
        const center = submitButton.parentElement;
        const slots = form.querySelector('table');
        if (!slots) return;
        form.insertBefore(center, slots.nextSibling);
        return;
    }

    // DOUBLE OR NOTHING
    if (window.location.href.includes('://www.neopets.com/medieval/doubleornothing.phtml')) {
        // Initial start-game screen, look for high score button
        const a = document.querySelector('td.content center p a[href="//www.neopets.com/gamescores.phtml?game_id=178"]');
        if (a) {
            const center = a.parentElement.parentElement;
            // This p element contains the coin
            const p = document.querySelector('td.content p table');
            if (!p) return;
            // Move it to before the high score buttons's containing elements
            center.insertBefore(p.parentElement, a.parentElement);
            return;
        }
        // Successful flip screen, look for Continue button
        const continueButton = document.querySelector('input[value="Continue"]');
        if (continueButton) {
            // Continue button is inside a <center> tag two levels up
            const center = continueButton.parentElement.parentElement;
            // Move it to after the ruffle element, which is before the <center> that contains the above <center>
            const center2 = center.parentElement;
            center2.parentElement.insertBefore(center, center2);
            return;
        }
        // Flip screen, any round but the first - look for the coin image
        let coin = document.querySelector('img[src="//images.neopets.com/medieval/coin_heads.gif"]');
        if (!coin) coin = document.querySelector('img[src="//images.neopets.com/medieval/coin_tails.gif"]');
        if (coin) {
            // Move the p that contains the coin image to immediately after the image of the Skeith
            const p = coin.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
            const p2 = document.querySelector('center img[src="//images.neopets.com/medieval/coin_skeith.gif"]').nextSibling;
            p2.parentElement.insertBefore(p, p2);
        }
        // Lose screen, look for Try Again button
        const tryAgainButton = document.querySelector('input[value="Try again..."]');
        if (tryAgainButton) {
            const center = tryAgainButton.parentElement.parentElement;
            // Moves it before an empty <p></p> that seems to just act as a <br>
            center.parentElement.insertBefore(center, center.previousSibling);
            return;
        }
    }

    // CHEESEROLLER
    if (window.location.href.includes('://www.neopets.com/medieval/cheeseroller.phtml')) {
        const form = document.querySelector('form[action="cheeseroller.phtml"]');
        if (!form) return;
        const hillside = document.querySelector('img[src="//images.neopets.com/medieval/cheese_slope.gif"]');
        if (!hillside) return;
        // p is the element which tells you how far is left and how long has elapsed
        const p = hillside.parentElement.querySelector('hr + p');
        if (!p) return;
        // Move p below the hillside image and the form with the buttons below that
        hillside.parentElement.insertBefore(p, hillside.nextSibling);
        hillside.parentElement.insertBefore(form, p.nextSibling);
        //hillside.parentElement.insertBefore(form.parentElement, hillside.nextSibling);
        //hillside.parentElement.insertBefore(document.createElement('p'), form.parentElement);
    }
})();