Neopets Mortog Challenge

It's always raining Mortogs

目前為 2024-09-28 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Neopets Mortog Challenge
// @version      2024.09.28
// @description  It's always raining Mortogs
// @match        *://*.neopets.com/*
// @icon         https://images.neopets.com/new_shopkeepers/t_1900.gif
// @author       Posterboy
// @namespace    https://gf.qytechs.cn/users/1277376
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Adjustable falling speed (in seconds).
    const fallingSpeed = .3; // Adjust this value to control speed; e.g., 0.5 for twice as fast

    // Function to create and animate a Mortog image
    function createFallingMortog() {
        const img = document.createElement('img');
        img.src = 'https://images.neopets.com/randomevents/rain/mortog.png';
        img.style.position = 'absolute';
        img.style.top = '-100px';
        img.style.zIndex = '9999';
        img.style.transition = `top ${fallingSpeed}s linear`;

        // Randomize the horizontal position
        const viewportWidth = window.innerWidth;
        const imgWidth = 100;
        const randomLeft = Math.floor(Math.random() * (viewportWidth - imgWidth));
        img.style.left = `${randomLeft}px`;

        document.body.appendChild(img);

        setTimeout(() => {
            img.style.top = `${window.innerHeight}px`;
        }, 100);

        img.addEventListener('transitionend', () => {
            img.remove();
        });
    }

    // Create X Mortogs per second for Y seconds
    const mortogsPerSecond = 9;
    const duration = 60; // How many seconds should this script continue generating Mortogs
    const interval = 1000 / mortogsPerSecond;

    let totalMortogs = mortogsPerSecond * duration;
    const intervalId = setInterval(() => {
        if (totalMortogs <= 0) {
            clearInterval(intervalId);
            return;
        }
        createFallingMortog();
        totalMortogs--;
    }, interval);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址