Guest User

Untitled

a guest
May 15th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           Trade Add Bot
  3. // @version        1.3
  4. // @include       http://steamcommunity.com/tradeoffer/new/*
  5. // @match       http://steamcommunity.com/tradeoffer/new/*
  6. // @require        http://cdn.steamcommunity.com/public/javascript/prototype-1.7.js
  7. // ==/UserScript==
  8.  
  9. setTimeout(function() {
  10.     $$(".filter_ctn")[0].children[0].replace("<div class='selectableNone'>Looking for a specific item?" +
  11.         "<div style='margin-top:-10px;float:right;height:25px'>" +
  12.         "<input style='margin-top:-2px;width:70px' class='filter_search_box' type='text' id='filteramount' value='' placeholder='Amount' autocomplete='off'>" +
  13.         "<div id='addxfiltered' style='margin-bottom:15px' class='pagebtn'>&rarr;</div>")
  14.     $('addxfiltered').observe('click', function(event) {
  15.         var amount = parseInt($('filteramount').getValue());
  16.         if(isNaN(amount)) amount=16;
  17.         var items=document.evaluate('//div[@id="inventories"]//div[@class="inventory_ctn"][not(contains(@style,"display: none"))]//div[@class="itemHolder"][not(contains(@style,"display: none"))]/div[starts-with(@id,"item")]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
  18.        
  19.         console.debug("amt=" + amount + " items=" + items.snapshotLength);
  20.        
  21.         function MoveRetry(item) {
  22.             try { MoveItemToTrade(item)  }
  23.             catch(err) { setTimeout(MoveRetry, 35, item) }
  24.             function MoveIf(item) {
  25.                 if (document.GetElementById('#inventories').GetElementById(item.id)) {
  26.                     console.log("retry");
  27.                     MoveRetry(item)
  28.                 }
  29.             }
  30.             setTimeout(MoveIf, 200, item);
  31.         }
  32.        
  33.         for( i=0; i < items.snapshotLength && i < amount; i++) setTimeout( MoveRetry, 1*i, items.snapshotItem(i) )
  34.     });
  35. }, 10);
Advertisement
Add Comment
Please, Sign In to add comment