NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Steam trade offer helper - no more Unavailable For Trade // @namespace https://steamcommunity.com/id/biscuithk/ // @description Gray out the items that are in the pending trade offers. // @version 150615 // @author Biscuit // @include /^https:\/\/steamcommunity\.com\/tradeoffer.*/ // @icon http://store.steampowered.com/favicon.ico // @grant none // ==/UserScript== $J(function() { var TradeOfferID, TradeOfferSelector = '', itemsA, itemsB; if (/^https:\/\/steamcommunity\.com\/tradeoffer\/(\d+)/.test(window.location.href)) { TradeOfferID = /^https:\/\/steamcommunity\.com\/tradeoffer\/(\d+)/.exec(window.location.href)[1]; TradeOfferSelector = 'div:not([id$="_' + TradeOfferID + '"]).tradeoffer > ' console.log('Trade Offer ' + TradeOfferID); } function ModifyStyle(itemsArr) { var selector = ''; for (var i = 0; i < itemsArr.length; i++) { selector += 'div[id$="_' + itemsArr[i] + (i==itemsArr.length-1?'"]':'"], '); } $J('head').append('<style type="text/css">' + selector + ' {filter: blur(2px) grayscale(1) opacity(0.5); -webkit-filter: blur(2px) grayscale(1) opacity(0.5); background-color: #716F6F !important;}</style>'); } $J.ajax({ cache : false, context : this, success : function(data){ itemsA = $J(TradeOfferSelector + '.tradeoffer_items_ctn.active > .tradeoffer_items.secondary > .tradeoffer_item_list > .trade_item', data).map(function(){ return /((\d+)\/){2}(\d+)/g.exec($J(this).data('economy-item'))[3]; }).get(); ModifyStyle(itemsA); console.log(itemsA); }, type : "GET", url : "/my/tradeoffers/" }); $J.ajax({ cache : false, context : this, success : function(data){ itemsB = $J(TradeOfferSelector + '.tradeoffer_items_ctn:not(.inactive) > .tradeoffer_items.primary > .tradeoffer_item_list > .trade_item', data).map(function(){ return /((\d+)\/){2}(\d+)/g.exec($J(this).data('economy-item'))[3]; }).get(); ModifyStyle(itemsB); console.log(itemsB); }, type : "GET", url : "/my/tradeoffers/sent/" }); });