Skip to content

Instantly share code, notes, and snippets.

@lingsamuel
Created November 28, 2021 11:21
Show Gist options
  • Save lingsamuel/fa19af9520ee6765bef3d4abef8a4c6b to your computer and use it in GitHub Desktop.
Save lingsamuel/fa19af9520ee6765bef3d4abef8a4c6b to your computer and use it in GitHub Desktop.
steamcost_money.js
var a = Array.from(this.document.getElementsByClassName('wallet_table_row'));
var buy = a.filter(x => {let t = x.children[1].textContent; return !(t.includes('货币转换') || t.includes('社区市场') || t.includes('钱包资金'));})
var result = {}; buy.forEach(x=>{let price = x.children[3].textContent.trim().split(' '); let refundFactor = x.children[1].textContent.includes('退款') ? -1 : 1; if(price[0] in result) {result[price[0]] += refundFactor*parseFloat(price[1]);} else {result[price[0]] = refundFactor*parseFloat(price[1]);}});
result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment