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.

目前為 2025-11-09 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
    }
})();