Neopets Obelisk Boons Display

Inserts images below selections

当前为 2025-01-21 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Neopets Obelisk Boons Display
// @description  Inserts images below selections
// @version      2025.01.21
// @license      GNU GPLv3
// @match        https://www.neopets.com/prehistoric/battleground/
// @author       Posterboy
// @namespace    https://greasyfork.org/users/1277376
// @homepage     https://youtube.com/@Neo_PosterBoy
// @icon         https://images.neopets.com/new_shopkeepers/t_1900.gif
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Check to see if it is an obelisk selection week
    const targetPhrase = "Why wait to see who wins? It could be you! Choose your side and arm yourself; war is coming.";

    function isPhrasePresent() {
        return document.body.innerText.includes(targetPhrase);
    }

    const itemNames = ['Awakened', 'Brutes', 'Order', 'Seekers', 'Sway', 'Thieves'];

    // Function to create display
    function createDisplay(itemName) {
        const displayDiv = document.createElement('div');
        displayDiv.className = 'item-display';

        // Images for each boon depeneding on faction
        let images = [];
        if (itemName === 'Brutes') {
            images = [
                'https://www.jellyneo.net/images/articles/boon_doppelgaenger.png',
                'https://images.neopets.com/prehistoric/obelisk/doppelganger_y2g78rgu/title.png',
                'https://www.jellyneo.net/images/articles/boon_equipallthethings.png',
                'https://images.neopets.com/prehistoric/obelisk/equipall_th54u28g/title.png',
                'https://www.jellyneo.net/images/articles/boon_grrraaaahhhhhh.png',
                'https://images.neopets.com/prehistoric/obelisk/grrraaaahhhhhh_q5g48y9v/title.png',
                'https://www.jellyneo.net/images/articles/boon_rightroundroundround.png',
                'https://images.neopets.com/prehistoric/obelisk/rightround_eh938urw/title.png',
                'https://www.jellyneo.net/images/articles/boon_scratchmaster.png',
                'https://images.neopets.com/prehistoric/obelisk/scratchmaster_43hu98n9/title.png'
            ];
        } else if (itemName === 'Order') {
            images = [
                'https://www.jellyneo.net/images/articles/boon_cartogriphication.png',
                'https://images.neopets.com/prehistoric/obelisk/cartogriphication_bhjei43v/title.png',
                'https://www.jellyneo.net/images/articles/boon_doctorwho.png',
                'https://images.neopets.com/prehistoric/obelisk/doctorwho_iy98der8/title.png',
                'https://www.jellyneo.net/images/articles/boon_doppelgaenger.png',
                'https://images.neopets.com/prehistoric/obelisk/doppelganger_y2g78rgu/title.png',
                'https://www.jellyneo.net/images/articles/boon_doublebubble.png',
                'https://images.neopets.com/prehistoric/obelisk/doublebubble_a45h9i3r/title.png',
                'https://www.jellyneo.net/images/articles/boon_refreshedquestrequest.png',
                'https://images.neopets.com/prehistoric/obelisk/refreshquest_bh3y98ur/title.png'
            ];
        } else if (itemName === 'Seekers') {
            images = [
                'https://www.jellyneo.net/images/articles/boon_bankbribery.png',
                'https://images.neopets.com/prehistoric/obelisk/bankbribery_o34y928v/title.png',
                'https://www.jellyneo.net/images/articles/boon_booksmarts.png',
                'https://images.neopets.com/prehistoric/obelisk/booksmarts_0y7u4erw/title.png',
                'https://www.jellyneo.net/images/articles/boon_doctorwho.png',
                'https://images.neopets.com/prehistoric/obelisk/doctorwho_iy98der8/title.png',
                'https://www.jellyneo.net/images/articles/boon_rightroundroundround.png',
                'https://images.neopets.com/prehistoric/obelisk/rightround_eh938urw/title.png',
                'https://www.jellyneo.net/images/articles/boon_strengthofmind.png',
                'https://images.neopets.com/prehistoric/obelisk/strengthmind_g459ub47/title.png'
            ];
        } else if (itemName === 'Sway') {
            images = [
                'https://www.jellyneo.net/images/articles/boon_bankbribery.png',
                'https://images.neopets.com/prehistoric/obelisk/bankbribery_o34y928v/title.png',
                'https://www.jellyneo.net/images/articles/boon_blackmarketgoods.png',
                'https://images.neopets.com/prehistoric/obelisk/blackmarket_q54xw47c/title.png',
                'https://www.jellyneo.net/images/articles/boon_cheaperbythedozen.png',
                'https://images.neopets.com/prehistoric/obelisk/cheaperdozen_p4h2tuv6/title.png',
                'https://www.jellyneo.net/images/articles/boon_refreshedquestrequest.png',
                'https://images.neopets.com/prehistoric/obelisk/refreshquest_bh3y98ur/title.png',
                'https://www.jellyneo.net/images/articles/boon_thatmillionairefeeling.png',
                'https://images.neopets.com/prehistoric/obelisk/millionairefeeling_z34yue5y/title.png'
            ];
        } else if (itemName === 'Thieves') {
            images = [
                'https://www.jellyneo.net/images/articles/boon_cheaperbythedozen.png',
                'https://images.neopets.com/prehistoric/obelisk/cheaperdozen_p4h2tuv6/title.png',
                'https://www.jellyneo.net/images/articles/boon_doppelgaenger.png',
                'https://images.neopets.com/prehistoric/obelisk/doppelganger_y2g78rgu/title.png',
                'https://www.jellyneo.net/images/articles/boon_fivefingerdiscount.png',
                'https://images.neopets.com/prehistoric/obelisk/fivefinger_uy68huy1/title.png',
                'https://www.jellyneo.net/images/articles/boon_lolavies.png',
                'https://images.neopets.com/prehistoric/obelisk/lolavies_u347qr2i/title.png',
                'https://www.jellyneo.net/images/articles/boon_scratchmaster.png',
                'https://images.neopets.com/prehistoric/obelisk/scratchmaster_43hu98n9/title.png'
            ];
        } else {
            // Question marks for Awakened, since it's randomly chosen
            for (let i = 0; i < 5; i++) {
                images.push('https://images.neopets.com/charity/2017/unknown.gif',
                           'https://images.neopets.com/prehistoric/outskirts/numbers.png');
            }
        }

        // Loads images below faction button
        images.forEach((imageUrl, index) => {
            const img = document.createElement('img');
            img.src = imageUrl;
            img.alt = `${itemName} Image ${index + 1}`;
            img.style.width = '180px';
            img.style.display = 'block';
            img.style.margin = '0 auto';
            displayDiv.appendChild(img);
        });

        const textDiv = document.createElement('div');
        textDiv.textContent = `Boons if ${itemName} wins`;
        displayDiv.appendChild(textDiv);

        return displayDiv;
    }

    // Function to process each list item
    function processListItems() {
        const listItems = document.querySelectorAll('li');

        listItems.forEach((li) => {
            itemNames.forEach((itemName) => {
                if (li.innerHTML.includes(itemName)) {
                    const display = createDisplay(itemName);
                    li.appendChild(display);
                }
            });
        });
    }

    // Run the process when the page is loaded
    window.addEventListener('load', processListItems);
})();