(function() { 'use strict'; // 添加浮动按钮 let button = document.createElement('button'); button.textContent = '一键点击'; button.style = 'position: fixed; bottom: 20px; right: 20px; z-index: 99999;'; document.body.appendChild(button); // 按钮点击事件 button.addEventListener('click', function() { let labels = document.querySelectorAll('.custom-control-label'); labels.forEach(label => { label.click(); }); }); })();
设置油猴的URL
用户自定规则为:https://brandregistry.amazon.com/brand/report-a-violation?searchType=KEYWORD&WITH_PARENT_ASIN=*
或者直接使用下面的代码粘贴在油猴里即可:
// ==UserScript== // @name Amazon Brand Registry Checkbox Toggler // @namespace http://tampermonkey.net/ // @version 0.1 // @description Toggle all checkboxes on the Amazon Brand Registry violation report page // @author You // @match https://brandregistry.amazon.com/brand/report-a-violation?searchType=* // @grant none // ==/UserScript== (function() { 'use strict'; // 创建一个按钮 var toggleButton = document.createElement('button'); toggleButton.innerText = 'Toggle Checkboxes'; toggleButton.style.position = 'fixed'; toggleButton.style.bottom = '20px'; toggleButton.style.right = '20px'; toggleButton.style.zIndex = '9999'; toggleButton.addEventListener('click', function() { // 找到所有的复选框 var checkboxes = document.querySelectorAll('input[type="checkbox"]'); checkboxes.forEach(function(checkbox) { // 切换复选框状态 checkbox.click(); // 使用 click() 方法来模拟点击 }); }); // 将按钮添加到页面 document.body.appendChild(toggleButton); })();