Last active
October 23, 2023 17:20
-
-
Save falfox/1c8c815489aade5458f890cb6b87712a to your computer and use it in GitHub Desktop.
Find out how much I spent on Destiny 2 by checking the Steam transaction history page at https://store.steampowered.com/account/history/
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
| let tb = document.querySelector('table.wallet_history_table') | |
| let tx = [...tb.querySelectorAll('tbody tr')].map(tr => { | |
| let totalRaw = tr.querySelector('.wht_total')?.textContent?? "" | |
| let total = totalRaw.replace("Credit", '').trim().substring(3).replace(/\s/g,"") | |
| let items = tr.querySelector('.wht_items > div')?.textContent.trim() ?? "" | |
| let isGift = tr.querySelector('.help_purchase_img') !== null | |
| return { | |
| total, | |
| items, | |
| isGift | |
| } | |
| }) | |
| let destiny2 = tx.filter(t => { | |
| return t.items.startsWith('Destiny 2') && !t.isGift | |
| }) | |
| let sum = destiny2.reduce((acc, cur) => acc + parseInt(cur.total), 0) | |
| const numberFormat = new Intl.NumberFormat("id-ID", { | |
| style: "currency", | |
| currency: "IDR" | |
| }); | |
| console.log({ | |
| sum, | |
| inRupiah: numberFormat.format(sum) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment