Neopets Customisation Spotlight Enhancer

Customisation Spotlight Enhancer: it makes the contestants entries bigger and also includes their Pet name.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Neopets Customisation Spotlight Enhancer
// @namespace    sadMidas
// @version      2024
// @description  Customisation Spotlight Enhancer: it makes the contestants entries bigger and also includes their Pet name.
// @include      https://www.neopets.com/spotlights/custompet/custom_spotlight_votes.phtml*
// @include      *neopets.com/spotlights/custompet/custom_spotlight_votes.phtml*
// @author       sadMidas
// @license MIT
// ==/UserScript==

function findLinkContainingString() {
    var aTags = document.getElementsByTagName("img");
    var petImages = [];

    for (var i = 0; i < aTags.length; i++) {
        if (aTags[i].width == 150) {
            console.log("Found Pet image: " + aTags[i].src);
            petImages.push(aTags[i]);
            console.log(petImages);
        }
    }
    return petImages[1];
}

setTimeout(function(){Main()}, 0);

function Main(){

    var spotlight = findLinkContainingString();
    var oldText = spotlight.src;
    var newText = oldText.replace("/1/2.png", "/1/7.png");
    newText = newText.replace("https://", "//");
    oldText = oldText.replace("https://", "//");

    var petName = newText.split("/");

    var originalText = '<img src="'+oldText+'" width="150" height="150" border="0" style="">';
    var replaceText = '<img src="'+newText+'" border="0" style=""> <h1>'+petName[4]+'</h1>';

    document.body.innerHTML = document.body.innerHTML.replace(originalText, replaceText);

}