Scratch Tactical Nuke Prank

Prank script for Scratch when clicking the green flag

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Scratch Tactical Nuke Prank
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Prank script for Scratch when clicking the green flag
// @author       You
// @match        *://scratch.mit.edu/projects/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function playSound() {
        let audio = new Audio("https://www.myinstants.com/media/sounds/tactical-nuke.mp3");
        audio.play();
    }

    function spamImage() {
        let spamInterval = setInterval(() => {
            let img = document.createElement("img");
            img.src = "https://i.ibb.co/Xf4PMVD6/IMG-1365.jpg";
            img.style.position = "fixed";
            img.style.left = Math.random() * window.innerWidth + "px";
            img.style.top = Math.random() * window.innerHeight + "px";
            img.style.width = "150px";
            img.style.height = "150px";
            img.style.zIndex = "9999";
            document.body.appendChild(img);
        }, 100);
        
        setTimeout(() => {
            clearInterval(spamInterval);
            window.close();
            window.open("https://youtu.be/V6KOyFXXGh0?si=pbB58oUpnN4xQQQp", "_blank");
        }, 5000);
    }

    function saveProject() {
        let saveButton = document.querySelector("[data-control='save']");
        if (saveButton) {
            saveButton.click();
        }
    }

    document.addEventListener("click", function(event) {
        if (event.target.closest(".green-flag_green-flag_1kiAo")) {
            saveProject();
            playSound();
            spamImage();
        }
    });

})();