您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
It's always raining Mortogs
当前为
// ==UserScript== // @name Neopets Mortog Challenge // @version 2024.10.05 // @description It's always raining Mortogs // @match *://*.neopets.com/* // @icon https://images.neopets.com/new_shopkeepers/t_1900.gif // @author Posterboy // @namespace https://greasyfork.org/users/1277376 // @run-at document-end // ==/UserScript== (function() { 'use strict'; // Adjustable falling speed (in seconds). const fallingSpeed = 0.3; // Falling speed in seconds const maxVisibleMortogs = 10; // Limit the number of visible Mortogs const centralPercentage = 0.9; // Central 90% of the window // Preload Mortog images const mortogImage = new Image(); mortogImage.src = 'https://images.neopets.com/randomevents/rain/mortog.png'; // Create a container for Mortogs const mortogContainer = document.createElement('div'); mortogContainer.style.position = 'fixed'; mortogContainer.style.top = '0'; // Start from the top mortogContainer.style.left = '0'; mortogContainer.style.width = '100%'; mortogContainer.style.pointerEvents = 'none'; mortogContainer.style.zIndex = '9999'; document.body.appendChild(mortogContainer); function createFallingMortog() { if (mortogContainer.childElementCount >= maxVisibleMortogs) { return; } const img = document.createElement('img'); img.src = mortogImage.src; img.classList.add('falling-mortog'); img.style.position = 'absolute'; img.style.top = '-100px'; img.style.width = '100px'; img.style.height = 'auto'; // Calculate the central position for horizontal spawning const viewportWidth = window.innerWidth; const centralWidth = viewportWidth * centralPercentage; const leftOffset = (viewportWidth - centralWidth) / 2; const randomLeft = Math.floor(Math.random() * (centralWidth - 100)) + leftOffset; img.style.left = `${randomLeft}px`; mortogContainer.appendChild(img); // Animate falling let startTime; function animate(time) { if (!startTime) startTime = time; const elapsed = time - startTime; const topPosition = Math.min((elapsed / (fallingSpeed * 1000)) * window.innerHeight, window.innerHeight); img.style.top = `${topPosition}px`; if (topPosition < window.innerHeight) { requestAnimationFrame(animate); } else { // Instead of removing immediately, fade out img.style.transition = 'opacity 0.5s'; img.style.opacity = '0'; setTimeout(() => img.remove(), 500); // Remove after fade-out } } requestAnimationFrame(animate); } // Create X Mortogs per second for Y seconds const mortogsPerSecond = 9; // Mortogs per second 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); })();