您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Toggle all selected items on Torn.com and set maximum quantity and price
当前为
// ==UserScript== // @name Toggle Checkboxes on Torn.com // @namespace http://tampermonkey.net/ // @version 7.2 // @description Toggle all selected items on Torn.com and set maximum quantity and price // @author Fists [2830940] // @match https://www.torn.com/bazaar.php* // @match https://www.torn.com/trade.php#step=add* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to toggle items based on partial item name, set quantity, and set price function toggleItems() { var button = document.getElementById('toggleButton'); button.style.transform = 'translate(-4px, 4px)'; // Shift button slightly to the left and down button.style.backgroundColor = '#7B1FA2'; // Darken button color when pressed setTimeout(function() { button.style.transform = ''; // Shift button back to original position after 200ms button.style.backgroundColor = '#AB47BC'; // Restore original button color }, 200); var itemNameInput = document.getElementById('itemNameInput'); var itemPriceInput = document.getElementById('itemPriceInput'); var itemName = itemNameInput.value.trim().toLowerCase(); var itemPrice = parseFloat(itemPriceInput.value.trim()); var items = document.querySelectorAll('.clearfix[data-group="child"]'); items.forEach(function(item) { var itemNameElement = item.querySelector('.name-wrap .t-overflow'); var itemNameText = itemNameElement ? itemNameElement.textContent.trim().toLowerCase() : ''; var itemPriceElement = item.querySelector('.input-money'); var itemQuantityElement = item.querySelector('.amount input[type="text"]'); var checkbox = item.querySelector('.amount-main-wrap .amount .checkbox-css'); // Check if the entered item name is a substring of the actual item name if (itemNameText.includes(itemName)) { // Toggle checkbox based on item type if (checkbox) { checkbox.checked = true; // Trigger click event to simulate checkbox change checkbox.dispatchEvent(new Event('click', { bubbles: true })); } else if (itemQuantityElement) { // Set quantity to a large number itemQuantityElement.value = '999999999'; // Trigger input event to simulate quantity change itemQuantityElement.dispatchEvent(new Event('input', { bubbles: true })); } // Set item price if provided var currentPrice = parseFloat(itemPriceElement.value.trim()); if (!isNaN(itemPrice) && itemPriceInput.value.trim() !== '' && currentPrice !== itemPrice) { itemPriceElement.value = itemPrice; // Trigger input event to simulate input change itemPriceElement.dispatchEvent(new Event('input', { bubbles: true })); } } }); } // Create inputs for item name and price function createInputs() { var button = document.createElement('button'); button.textContent = 'Toggle Selected Items'; button.id = 'toggleButton'; // Add id for easy access button.addEventListener('click', toggleItems); // Style the button button.style.position = 'fixed'; button.style.top = '10px'; button.style.right = '15px'; button.style.zIndex = '99999'; button.style.backgroundColor = '#AB47BC'; button.style.color = 'white'; button.style.padding = '10px 20px'; button.style.transition = 'transform 0.2s ease, background-color 0.2s ease'; // Append button to the body document.body.appendChild(button); // Create input for item name var itemNameInput = document.createElement('input'); itemNameInput.type = 'text'; itemNameInput.placeholder = 'Enter item name'; itemNameInput.id = 'itemNameInput'; itemNameInput.style.position = 'fixed'; itemNameInput.style.top = 'calc(10px + 50px)'; itemNameInput.style.right = '15px'; itemNameInput.style.zIndex = '99999'; itemNameInput.style.height = '36px'; itemNameInput.style.width = '200px'; itemNameInput.style.fontSize = '13px'; // Adjusted font size // Append input to the body document.body.appendChild(itemNameInput); // Create input for item price var itemPriceInput = document.createElement('input'); itemPriceInput.type = 'number'; itemPriceInput.placeholder = 'Enter item price'; itemPriceInput.id = 'itemPriceInput'; itemPriceInput.style.position = 'fixed'; itemPriceInput.style.top = 'calc(56px + 50px)'; itemPriceInput.style.right = '15px'; itemPriceInput.style.zIndex = '99999'; itemPriceInput.style.height = '36px'; itemPriceInput.style.width = '200px'; itemPriceInput.style.fontSize = '13px'; // Adjusted font size // Append input to the body document.body.appendChild(itemPriceInput); // Create text below the text boxes var creditText = document.createElement('div'); creditText.textContent = 'Made by Fists [2830940] and ChatGPT'; creditText.style.position = 'fixed'; creditText.style.top = 'calc(92px + 50px)'; creditText.style.right = '15px'; creditText.style.zIndex = '99999'; creditText.style.textAlign = 'center'; creditText.style.fontSize = '10px'; // Adjusted font size creditText.style.color = 'white'; // Append text to the body document.body.appendChild(creditText); // Create a separate box behind the elements var backgroundBox = document.createElement('div'); backgroundBox.style.position = 'fixed'; backgroundBox.style.top = 'calc(-3px)'; // Move 3 pixels closer to the top backgroundBox.style.right = 'calc(-3px)'; // Move 3 pixels closer to the right backgroundBox.style.width = '220px'; // Adjusted width backgroundBox.style.height = '170px'; // Adjusted height backgroundBox.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; // Semi-transparent black backgroundBox.style.zIndex = '99998'; // Behind other elements // Append background box to the body document.body.appendChild(backgroundBox); // Ensure the box doesn't interact with the page backgroundBox.addEventListener('click', function(event) { event.stopPropagation(); }); } // Delay execution by 2 seconds setTimeout(createInputs, 2000); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址