Created
January 12, 2019 23:40
-
-
Save ethnt/2b06e3c00c9dbafa1870cc2246bb36b3 to your computer and use it in GitHub Desktop.
Revisions
-
ethnt created this gist
Jan 12, 2019 .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,20 @@ var available = parseFloat(document.querySelector('.balance .numbers').innerHTML.replace('$', '')); var pendingTransactionValues = Array.prototype.slice.call(document.querySelectorAll('.transaction-row.pending')).map(element => element.querySelector('.value .amount').innerHTML.split('$')); var total = 0.0; values.forEach(function (arr) { var sign = arr[0]; var value = parseFloat(arr[1]); if (sign === "-") { total += value } else { total -= value } }); var currentBalance = available + total; alert("Current balance: " + currentBalance)