Greasy Fork

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

跳过培育动画自用,不懂代码,gpt写的.jpg icon引用的萌娘百科图片

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

// ==UserScript==
// @name         偶像大师闪耀色彩跳过培育动画 [大概双端适配?]
// @namespace    http://tampermonkey.net/
// @version      0.5.2
// @description  跳过培育动画自用,不懂代码,gpt写的.jpg icon引用的萌娘百科图片
// @author       ER@关注b站EreRe_看折纸纸片人谢谢喵
// @match        https://shinycolors.enza.fun/produce/*
// @run-at       document-start
// @icon         https://img.moegirl.org.cn/common/thumb/4/41/IM%40S_SC_Swan_Mark.svg/99px-IM%40S_SC_Swan_Mark.svg.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; /* 设置按钮宽度为窗口宽度的8% */
        height: 8vw; /* 设置按钮高度为窗口宽度的8% */
        z-index: 9999; /* 设置按钮的 z-index 值 */
    `;

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

    // 将按钮添加到页面
    document.body.appendChild(buttonA);
    document.body.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/?'; // 移动设备跳转到c网页
        } else {
            window.location.href = 'https://shinycolors.enza.fun/produce/?a='; // PC设备跳转到a网页
        }
    });

    // 按钮b的点击事件
    buttonB.addEventListener(eventType, function() {
        if (isMobile) {
            window.location.href = 'https://shinycolors.enza.fun/produce/?#'; // 移动设备跳转到d网页
        } else {
            window.location.href = 'https://shinycolors.enza.fun/produce/?a=#'; // PC设备跳转到b网页
        }
    });


})();