Last active
December 24, 2020 12:10
-
-
Save rougetimelord/3f614106a25e6600a5443c3add1b018b to your computer and use it in GitHub Desktop.
Makes selling a ton of steam trading cards easier! Use as a bookmarklet (oneline it yourself) or declare it in the tab and call it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!window.sell) {window.sell=()=>{ | |
/*Steam always has two items in the DOM, the for loop finds the one that's real*/ | |
let items = document.getElementsByClassName('inventory_iteminfo'), index = 0; | |
for(let i = 0; i < items.length; i++) { | |
if(items[i].style.display === "") {index = i; break;} | |
} | |
let page = Number(document.getElementById('pagecontrol_cur').innerText); | |
/*Check if we can sell the item*/ | |
if(document.getElementById('iteminfo' + index + '_item_market_actions').style.display !== "none") { | |
console.log('selling'); | |
let price = Number( | |
document.getElementById( | |
'iteminfo' + index + '_item_market_actions').childNodes[0].childNodes[1].innerText.replace(/(\r\n|\n|\r)/gm,' ').replace(/\$/gm,'').split(' ')[2]) * 100 - 2; /*Gets the price and subtracts two cents*/ | |
if(price + 0.02 >= 0.20){ | |
console.log("high value item!!"); | |
return; | |
} | |
SellCurrentSelection(); /*Function exposed by steam*/ | |
document.getElementById('market_sell_currency_input').value = "$" + (price / 100); | |
let checkbox = document.getElementById('market_sell_dialog_accept_ssa'); | |
if(!checkbox.checked){checkbox.click()}; | |
let sell = document.getElementById('market_sell_dialog_accept'); | |
sell.click();sell.click(); | |
document.getElementById('market_sell_dialog_ok').click(); | |
} else { | |
console.log('gemming'); | |
document.getElementById('iteminfo' + index + '_item_scrap_link').click(); | |
setTimeout(()=>{ | |
document.getElementsByClassName('newmodal_buttons')[0].firstChild.click(); | |
setTimeout(() => { | |
document.getElementsByClassName('newmodal_buttons')[0].firstChild.click() | |
}, 500); | |
}, 500); | |
} | |
/*Scroll back*/ | |
setTimeout(()=>{console.log('done waiting')}, 1E4); | |
for(let i = 1; i < page; i++) { | |
document.getElementById('pagebtn_next').click(); | |
} | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment