Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jeffreytgilbert/8186879 to your computer and use it in GitHub Desktop.

Select an option

Save jeffreytgilbert/8186879 to your computer and use it in GitHub Desktop.
A little script to show the running balance on the chase cc page because they decided it's not important to keep a running balance...
(function(){
var amounts = document.querySelectorAll('#Posted tbody .amount');
var balance = Number(document.querySelector('#AccountDetailTable .card-accountdetailcol tbody tr td:nth-child(2)').innerText.substr(1).replace(',',''));
var iii=0;
var amount = '';
var element = null;
var elementsArray = [];
for(iii=0; iii < amounts.length; iii++) {
element = amounts[iii];
amount = element.innerText;
if(amount.substr(0,1) === '-'){
amount = amount.substr(2, amount.length-3);
amount = amount.replace(',','');
amount = amount * -1;
} else {
amount = amount.substr(1, amount.length-2);
amount = amount.replace(',','');
}
elementsArray.push({
'element':element,
'amount':Number(amount),
'order':iii
});
}
elementsArray.map(function(el){
el.element.style.whiteSpace = 'pre';
balance = Number(balance) - Number(el.amount);
el.element.innerHTML = '$'+el.amount.toFixed(2).toString()+' : $'+balance.toFixed(2).toString();
});
})();
@lucascolin
Copy link
Copy Markdown

This is awesome! Thanks Jeffrey!

All you have to do is open your credit card account activity page and run this script in the js console.

@goodcoder
Copy link
Copy Markdown

Don't work for me :) I also hate that they don't show running balance. I am switching to BOA for just this reason.

@shifan-w
Copy link
Copy Markdown

When I run the script, here is an error:
Uncaught TypeError: Cannot read property 'innerText' of null at :3:116 at :31:3

@DustGuts
Copy link
Copy Markdown

Fixed "Uncaught TypeError: Cannot read property 'innerText' of null at :3:116 at :31:3" with updated selectors:

var amounts = document.querySelectorAll("#activityTableslideInActivity > tbody > tr > td.sm-aligned-right.amount.BODY > span");
var balance = Number(document.querySelector('#activityContainerslideInActivity > div.overview-activity-container.util.print-hide.print-border-none > div > div > div.col-xs-12.recon-header-container > div.current-balance-section > dl > dd:nth-child(2)').innerText.substr(1).replace(',',''));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment