您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Calculates maximum affordable quantity when using max button in item market
当前为
// ==UserScript== // @name Torn Item Market Max Quantity Calculator // @namespace http://tampermonkey.net/ // @version 1.1 // @description Calculates maximum affordable quantity when using max button in item market // @author Weav3r // @match https://www.torn.com/page.php?sid=ItemMarket* // @icon https://www.google.com/s2/favicons?sz=64&domain=torn.com // @grant none // ==/UserScript== (function () { 'use strict'; // Helper function to parse element text based on a regex function getElementValue(element, regex) { if (!element) return null; const match = element.textContent.match(regex); if (!match) return null; return parseInt(match[1].replace(/,/g, '')); } // Get user's money from either mobile or desktop function getUserMoney() { const userMoneyElement = document.querySelector('#user-money'); if (!userMoneyElement) return null; return parseInt(userMoneyElement.dataset.money); } function handleMaxQuantityClick(event) { const maxButton = event.target.closest('.input-money-symbol'); if (!maxButton) return; const moneyGroup = maxButton.closest('.input-money-group'); const sellerRow = moneyGroup?.closest('.sellerRow___AI0m6'); const quantityInput = moneyGroup?.querySelector('input.input-money:not([type="hidden"])'); if (!moneyGroup || !sellerRow || !quantityInput) return; const userMoney = getUserMoney(); if (!userMoney) return; const priceElement = sellerRow.querySelector('.price___Uwiv2'); if (!priceElement) return; const price = getElementValue(priceElement, /\$([0-9,]+)/); if (!price) return; const affordableQuantity = Math.floor(userMoney / price); quantityInput.value = affordableQuantity; quantityInput.dispatchEvent(new Event('input', { bubbles: true })); } document.addEventListener('click', handleMaxQuantityClick); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址