Skip to content

Instantly share code, notes, and snippets.

@brunoluiz
Created January 5, 2022 10:54

Revisions

  1. brunoluiz created this gist Jan 5, 2022.
    13 changes: 13 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    let paymentReceivedRowId = 0;
    document.querySelectorAll('div.col-md-5.col-sm-8.pad-responsive-lr.pad-1-t-sm-down').forEach((n, idx) =>
    n.textContent.includes('PAYMENT RECEIVED') ? paymentReceivedRowId = idx : null
    );

    // navigate to the statement view
    let items = [];
    document.querySelectorAll('div.col-md-3.col-sm-4.pad-responsive-r.flex.flex-column-md.flex-justify-end').forEach((n, idx) => {
    if (idx === paymentReceivedRowId) return;
    items.push(n.textContent.replaceAll('£',''));
    });

    items.reduce((acc, item) => item !== '-1,899.31' ? acc + Number(item) : acc, 0);