Skip to content

Instantly share code, notes, and snippets.

@Jwsonic
Last active March 2, 2017 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jwsonic/d7a1ef60d06b511b184a0a7c33b067e7 to your computer and use it in GitHub Desktop.
Save Jwsonic/d7a1ef60d06b511b184a0a7c33b067e7 to your computer and use it in GitHub Desktop.
CC stuff
const money = t => parseFloat(t.trim().replace(/[^0-9\.]+/g,""));
const pending = $('#sortTable tr').toArray().reduce((acc, node) => {
const trNode = $(node);
if(trNode.find('td.date').text() === 'Pending') {
return acc + money(trNode.find('td.amount').text());
}
return acc;
}, 0);
const balance = money($('.balance .value .nowrap').first().text());
const toPay = (balance - pending).toFixed(2);
$('#main').append(`<textarea id="copyme">${toPay}</textarea>`);
$('#copyme').select();
document.execCommand('copy');
window.location.pathname = '/CCServicing/MakePayment.do'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment