// ==UserScript== // @name 偶像大师闪耀色彩跳过培育动画 [目标是双端适配] // @namespace http://tampermonkey.net/ // @version 0.5.6 // @description 跳过培育动画自用,不懂代码,gpt写的.jpg // @author ER@关注b站EreRe_看折纸纸片人谢谢喵 // @match https://shinycolors.enza.fun/produce // @match https://shinycolors.enza.fun/produce/* // @run-at document-end // @icon https://shinycolors.enza.fun/icon_192x192.png // @grant none // @license MIT // @downloadURL none // ==/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; `; // 创建按钮a和按钮b的代码保持不变 // 检测 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 { navigateToPageA(); } }); // 按钮b的点击事件 buttonB.addEventListener(eventType, function() { if (isMobile) { window.location.href = 'https://shinycolors.enza.fun/produce/?#'; } else { navigateToPageB(); } }); // 使用MutationObserver监听DOM变化 const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === 'childList') { // DOM发生变化时,重新执行脚本 setupButtons(); } }); }); // 监听整个文档的变化 observer.observe(document, { childList: true, subtree: true }); // 初始化页面上的按钮 function setupButtons() { // ...(创建按钮a和按钮b的代码) } // 使用onclick实现跳转 function navigateToPageA() { window.location.href = 'https://shinycolors.enza.fun/produce/?a='; } function navigateToPageB() { window.location.href = 'https://shinycolors.enza.fun/produce/?a=#'; } // 初次加载时初始化按钮 setupButtons(); })();