Greasy Fork

偶像大师闪耀色彩跳过培育动画 [双端适配]

跳过培育动画自用,面向gpt编程.jpg

目前为 2023-08-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         偶像大师闪耀色彩跳过培育动画 [双端适配]
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  跳过培育动画自用,面向gpt编程.jpg
// @author       ER@关注b站EreRe_看折纸纸片人谢谢喵
// @match        https://shinycolors.enza.fun/*
// @run-at       document-end
// @icon         https://shinycolors.enza.fun/icon_192x192.png
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to add buttons
    function addButtons() {
        // Check if buttons already exist on the page
        if (document.querySelector('.custom-button')) {
            return;
        }

        // Create buttons
        const button = document.createElement('button');

        // Add class to buttons for identification
        button.classList.add('custom-button');
        button.textContent = '跳!';
        button.style.cssText = `
            position: fixed;
            bottom: 3vw;
            left: 46vw;
            opacity: 0.4;
            background-color: gray;
            color: white;
            border: none;
            padding: 0;
            cursor: pointer;
            width: 8vw;
            height: 8vw;
            z-index: 9999;
        `;

        if (/Mobi|Android/i.test(navigator.userAgent)) {
            button.addEventListener('touchstart', function() {
            const currentURL = window.location.href;
            if (currentURL !== 'https://shinycolors.enza.fun/produce/?a=#') {
                window.location.href = '/produce/?a=';
            } else {
                history.back(); // 后退一页
            }
        });
        } else {
            button.addEventListener('click', function() {
            const currentURL = window.location.href;
            if (currentURL !== 'https://shinycolors.enza.fun/produce/?a=#') {
                window.location.href = '/produce/?a=';
            } else {
                history.back(); // 后退一页
            }
        });
        }

        // Add buttons to the page
        document.body.appendChild(button);
    }

    // Function to check and update buttons when URL changes
    function checkAndAddButtons() {
        const currentURL = window.location.href;
        if (currentURL.includes('produce')) {
            addButtons();
        }
    }

    // Observe changes to the URL and add buttons if necessary
    const urlObserver = new MutationObserver(checkAndAddButtons);
    const observerConfig = { childList: true, subtree: true };
    urlObserver.observe(document.documentElement, observerConfig);
})();