Created
November 28, 2021 11:21
-
-
Save lingsamuel/fa19af9520ee6765bef3d4abef8a4c6b to your computer and use it in GitHub Desktop.
steamcost_money.js
This file contains 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
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