NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name AGENTS TRADING // @namespace https://steamcommunity.com/market/search?q=%D0%BD%D0%B0%D1%88%D0%B8%D0%B2%D0%BA%D0%B0&descriptions=1&category_730_ItemSet%5B%5D=tag_set_op9_characters&category_730_ProPlayer%5B%5D=any&category_730_StickerCapsule%5B%5D=any&category_730_TournamentTeam%5B%5D=any&category_730_Weapon%5B%5D=any&appid=730 // @namespace https://steamcommunity.com/market/search?q=%D0%BD%D0%B0%D1%88%D0%B8%D0%B2%D0%BA%D0%B0&descriptions=1&category_730_ItemSet%5B%5D=tag_set_op10_characters&category_730_ProPlayer%5B%5D=any&category_730_StickerCapsule%5B%5D=any&category_730_TournamentTeam%5B%5D=any&category_730_Weapon%5B%5D=any&appid=730 // @version 1.1337 // @description Steam Inventory Helper extension should be installed and enabled // @description Script works correctly only with UAH currency // @author 3rdUnknown // @copyright 2021 // @license MIT // @match https://steamcommunity.com/market/listings/730/* // @grant none // @run-at document-idle // @updateURL https://openuserjs.org/meta/3rdUnknown/AGENTS_TRADING.meta.js // ==/UserScript== (function () { 'use strict'; let i = setInterval(function () { if (document.querySelectorAll(".sih-images li")) { // Wait when SIH will finished updating items list clearInterval(i); let currentPrice = document.querySelectorAll("span.market_commodity_orders_header_promote")[1].innerHTML; // Convert UAH price to float currentPrice = currentPrice.slice(0, -1) currentPrice = currentPrice.replace(/,/g, '.') console.log(">" + currentPrice + "<") let agentsArr = document.querySelectorAll("div.market_listing_row"); let agentsDiv, selectedPatch, patchesInAgentsBlock, agentPrice, agentPriceValue, agentName; let priceDiff, priceDiffPercentage; let minPatches = 2; let bestPatchesArr = [ 'Нашивка | Здоровье', 'Нашивка | Босс', 'Нашивка | Вой', 'Нашивка | Медная лямбда', 'Нашивка | Гнев', 'Нашивка | Феникс' ] for (let elem of agentsArr) { agentsDiv = elem.querySelectorAll("div.sih-images li"); // Count number of patches for specific agent patchesInAgentsBlock = agentsDiv.length; console.log("agent has " + patchesInAgentsBlock + " patches"); // Select only agents with number of patches more or equal than minPatches if (patchesInAgentsBlock < minPatches) { elem.remove(); console.log(">> agent removed"); } else { for (var step = 0; step < minPatches; step++) { // Found rare patches selectedPatch = agentsDiv[step].getElementsByTagName("img")[0].getAttribute("title"); if (bestPatchesArr.includes(selectedPatch)) { console.log("Best patch: " + selectedPatch) agentName = elem.querySelectorAll("span.market_listing_item_name")[0] agentName.innerHTML = agentName.innerHTML + '<font color="red"> BEST>> </font>' } } // Highlight price diff agentPrice = elem.querySelectorAll("span.market_listing_price_with_fee")[0] // Convert UAH price to float agentPriceValue = agentPrice.innerText.slice(0, -1) agentPriceValue = agentPriceValue.replace(/,/g, '.') priceDiff = (agentPriceValue - currentPrice).toFixed(2) priceDiffPercentage = ((priceDiff / currentPrice) * 100).toFixed(0) agentPrice.innerHTML = '⬆️ <font color="red">' + priceDiff + '</font><font color="orange"> +' + priceDiffPercentage + '%</font><br>' + agentPrice.innerHTML console.log(">> 3 patches found with price >" + agentPriceValue + "< and diff: " + (priceDiff)); } } } }, 1000); })();