Greasy Fork

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

跳过培育动画自用,不懂代码,gpt写的.jpg

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

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

(function() {
    'use strict';

    // 创建按钮a
    const buttonA = document.createElement('button');
    buttonA.textContent = '◀'; // 向左的三角形
    buttonA.style.cssText = `
        position: fixed;
        bottom: 3vw;
        left: 41vw;
        opacity: 0.4;
        background-color: gray;
        color: white;
        border: none;
        padding: 0;
        cursor: pointer;
        width: 8vw;
        height: 8vw;
        z-index: 9999;
    `;

    // 创建按钮b
    const buttonB = document.createElement('button');
    buttonB.textContent = '▶'; // 向右的三角形
    buttonB.style.cssText = `
        position: fixed;
        bottom: 3vw;
        left: 51vw;
        opacity: 0.4;
        background-color: gray;
        color: white;
        border: none;
        padding: 0;
        cursor: pointer;
        width: 8vw;
        height: 8vw;
        z-index: 9999;
    `;

    // 找到最高级的 div
    const highestDiv = document.body || document.documentElement;

    // 将按钮添加到最高级的 div
    highestDiv.appendChild(buttonA);
    highestDiv.appendChild(buttonB);

    // 检测 User Agent,判断设备类型
    const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

    // 设置按钮的事件类型
    const eventType = isMobile ? 'tap' : 'click';

    // 按钮a的点击事件
    buttonA.addEventListener(eventType, function() {
        if (isMobile) {
            window.location.href = 'https://shinycolors.enza.fun/produce/?';
        } else {
            window.location.href = 'https://shinycolors.enza.fun/produce/?a=';
        }
    });

    // 按钮b的点击事件
    buttonB.addEventListener(eventType, function() {
        if (isMobile) {
            window.location.href = 'https://shinycolors.enza.fun/produce/?#';
        } else {
            window.location.href = 'https://shinycolors.enza.fun/produce/?a=#';
        }
    });

})();