您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
批量改ROI
// ==UserScript== // @name 一键修改ROI // @namespace http://tampermonkey.net/ // @version 1.1 // @description 批量改ROI // @author Rayu // @match https://seller.shopee.tw/portal/marketing/pas/product* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Toast函数 function showToast(msg, duration = 2000) { let toast = document.getElementById('tampermonkey-roi-toast'); if (toast) toast.remove(); toast = document.createElement('div'); toast.id = 'tampermonkey-roi-toast'; toast.innerText = msg; toast.style.position = 'fixed'; toast.style.left = '50%'; toast.style.bottom = '100px'; toast.style.transform = 'translateX(-50%)'; toast.style.background = 'rgba(0,0,0,0.85)'; toast.style.color = '#fff'; toast.style.padding = '12px 24px'; toast.style.fontSize = '18px'; toast.style.borderRadius = '6px'; toast.style.zIndex = '10000'; toast.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)'; toast.style.opacity = '0.95'; document.body.appendChild(toast); setTimeout(() => { toast.remove(); }, duration); } function addButton() { if (document.getElementById('tampermonkey-roi-btn')) return; const btn = document.createElement('button'); btn.id = 'tampermonkey-roi-btn'; btn.innerText = '一键修改ROI'; btn.style.position = 'fixed'; btn.style.left = '20px'; btn.style.bottom = '20px'; btn.style.zIndex = '9999'; btn.style.padding = '10px 20px'; btn.style.fontSize = '16px'; btn.style.background = '#f60'; btn.style.color = '#fff'; btn.style.border = 'none'; btn.style.borderRadius = '5px'; btn.style.cursor = 'pointer'; btn.style.boxShadow = '0 2px 8px rgba(0,0,0,0.3)'; btn.style.opacity = '0.85'; btn.style.transition = 'opacity 0.2s'; btn.onmouseenter = () => btn.style.opacity = '1'; btn.onmouseleave = () => btn.style.opacity = '0.85'; btn.onclick = function() { let input = prompt('请输入要修改的ROI值:', '7'); if (input === null) return; // 用户取消 input = input.trim(); if (!input || isNaN(input)) { showToast('请输入合法数字!'); return; } // 修改ROI const roiEls = document.querySelectorAll('.roi-edit-popover-container .roi-value'); roiEls.forEach(function(el) { el.innerText = input; }); showToast(`全部ROI值已修改为 ${input} !`); // 勾选radio let yesLimitRadio = document.querySelector('.yes-limit input[type="radio"]'); if (yesLimitRadio) { yesLimitRadio.checked = true; yesLimitRadio.dispatchEvent(new Event('change', { bubbles: true })); } // 填写预算输入框,加延时和原生setter双保险 setTimeout(function () { let budgetInput = document.querySelector('.budget-input .eds-input__input'); if (budgetInput) { const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set; nativeInputValueSetter.call(budgetInput, '40'); budgetInput.dispatchEvent(new Event('input', { bubbles: true })); budgetInput.dispatchEvent(new Event('change', { bubbles: true })); } else { console.warn('未找到预算输入框!'); } // 延时后关闭所有“开”的switch let switches = document.querySelectorAll('.eds-switch'); switches.forEach(sw => { if (sw.classList.contains('eds-switch--open')) { sw.click(); } }); }, 300); }; document.body.appendChild(btn); } // 初次加载 addButton(); // 监听单页应用路由变更 let lastUrl = location.href; setInterval(() => { if (location.href !== lastUrl) { lastUrl = location.href; addButton(); } }, 1000); })();