Steam

Steam

Not enough ratings
SteamDB but item (with quantity) script
By Black_Blade
This is a small script for making a quantity buy from SteamDB under items of a game
(Need fixing please hold)
   
Award
Favorite
Favorited
Unfavorite
What is this script for?
This script was made on request
Its to simply make the ability to buy more than a single item of an object in-game item, by adding a text field to enter the number of items you like to buy, and a button to proceed
Setup (For Chrome)
For Chrome:
  1. Go to the game page on SteamDB and into the item page
  2. Click F12 on your keyboard or Ctrl+Shift+I or Open the menu → More tools → Developer Tools
    this will open the Developer Tools area in the window
  3. At the bottom there you will see the console copy and paste the code into there and press enter
The Script (v1.1)
function setEventListener(itemVarbible) { $(".itemQuantityItem").blur(function(){ //console.log (this.id); let amount = $("#"+this.id).val(); let href = $("#btn_"+this.id).attr("href"); let buttonText = $("#btn_"+this.id).text(); let cutPoint = buttonText.indexOf("X"); if (buttonText.charAt(buttonText.indexOf("X")+1) == " ") { $("#btn_"+this.id).text([buttonText.slice(0, cutPoint+1), amount, buttonText.slice(cutPoint+1)].join('')); cutPoint = href.indexOf("?"); let newUrl = [href.slice(0, cutPoint), "/", amount, href.slice(cutPoint)].join(''); $("#btn_"+this.id).attr("href",newUrl); //console.log ("debug message: " + newUrl); } else { let cutNumberOut = buttonText.indexOf(" ",buttonText.indexOf("X")) - buttonText.indexOf ("X")-1; //console.log (cutNumberOut); $("#btn_"+this.id).text([buttonText.slice(0, cutPoint+1), amount, buttonText.slice(cutPoint+1+cutNumberOut)].join('')); cutPoint = href.indexOf("?"); let newUrl = [href.slice(0, cutPoint-cutNumberOut), amount, href.slice(cutPoint)].join(''); $("#btn_"+this.id).attr("href",newUrl); //console.log ("debug message: " + newUrl); } }); } let counter = 0; $('.economy-item-right').find(".btn").each(function() { if ( $(this).attr("href").substring(0,39) == "https://steamhost.cn/buyitem/") { $(this).after("<br />" + "<div class=\"add_amount_area\">" + "<input class=\"input-block itemQuantityItem\" id=\"itemQuantity-"+ counter +"\" type=\"number\" placeholder=\"quantity defualt is 1\">" + "<a class=\"btn btn-primary\" id=\"btn_itemQuantity-" + counter++ +"\" href=\""+$(this).attr("href")+"\">Buy X amount</a>" + "</div>"); } }); setEventListener();
How to use (after running the script)
The Script will add you a text box under each button for buying items on Steam on SteamDB item page
You enter the quantity you like to buy
Press the Buy X{Your amount} amount button under the text box
So what dose the script do?
All this script really does is search for buttons that link to:
https://steamhost.cn/buyitem/...
For example:
https://steamhost.cn/buyitem/123/1

Then adds a "/" with the amount you wish to buy at the end
For example, if you put in the input box 4:
https://steamhost.cn/buyitem/123/1/4

So if you don't want to use the script, you can also copy the link of the button and add a "/" followed by the number of items you like to buy, which will give the same result.