Last active
October 23, 2023 17:20
-
-
Save falfox/1c8c815489aade5458f890cb6b87712a to your computer and use it in GitHub Desktop.
Revisions
-
falfox revised this gist
Oct 23, 2023 . No changes.There are no files selected for viewing
-
falfox revised this gist
Sep 6, 2023 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,12 @@ let destiny2 = tx.filter(t => { 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) }) -
falfox revised this gist
Sep 6, 2023 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ 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,"") -
falfox created this gist
Sep 6, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ 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) console.log({ sum })