Skip to content

Instantly share code, notes, and snippets.

@abhijithvijayan
Last active April 22, 2024 08:08
Show Gist options
  • Save abhijithvijayan/46a9dc8248b26c68f5241d16fb6bee96 to your computer and use it in GitHub Desktop.
Save abhijithvijayan/46a9dc8248b26c68f5241d16fb6bee96 to your computer and use it in GitHub Desktop.

Revisions

  1. abhijithvijayan revised this gist Jan 18, 2024. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions clear-tax-rent-receipt.js
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,18 @@

    // date of repayment against the receipt number
    var dateOfPayments = {
    1: "Apr 03 2023",
    2: "May 06 2023",
    3: "Jun 08 2023",
    4: "Jul 08 2023",
    5: "Aug 06 2023",
    6: "Sep 04 2023",
    7: "Oct 06 2023",
    8: "Nov 07 2023",
    9: "Dec 06 2023",
    10: "Jan 02 2024",
    11: "Feb 04 2024",
    12: "Mar 01 2024"
    1: "<DATE>",
    2: "<DATE>",
    3: "<DATE>",
    4: "<DATE>",
    5: "<DATE>",
    6: "<DATE>",
    7: "<DATE>",
    8: "<DATE>",
    9: "<DATE>",
    10: "<DATE>",
    11: "<DATE>",
    12: "<DATE>"
    };

    function receiptCleanser(dateOfPayments = {}) {
  2. abhijithvijayan revised this gist Dec 25, 2023. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions clear-tax-rent-receipt.js
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,18 @@

    // date of repayment against the receipt number
    var dateOfPayments = {
    1: "Apr 02 2022",
    2: "May 01 2022",
    3: "Jun 02 2022",
    4: "Jul 04 2022",
    5: "Aug 03 2022",
    6: "Sep 04 2022",
    7: "Oct 03 2022",
    8: "Nov 02 2022",
    9: "Dec 04 2022",
    10: "Jan 02 2023",
    11: "Feb 04 2023",
    12: "Mar 01 2023"
    1: "Apr 03 2023",
    2: "May 06 2023",
    3: "Jun 08 2023",
    4: "Jul 08 2023",
    5: "Aug 06 2023",
    6: "Sep 04 2023",
    7: "Oct 06 2023",
    8: "Nov 07 2023",
    9: "Dec 06 2023",
    10: "Jan 02 2024",
    11: "Feb 04 2024",
    12: "Mar 01 2024"
    };

    function receiptCleanser(dateOfPayments = {}) {
  3. abhijithvijayan revised this gist Mar 5, 2023. No changes.
  4. abhijithvijayan revised this gist Mar 5, 2023. 1 changed file with 18 additions and 17 deletions.
    35 changes: 18 additions & 17 deletions clear-tax-rent-receipt.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,22 @@
    // For https://cleartax.in/save/rent
    function receiptCleanser() {

    // date of repayment against the receipt number
    var dateOfPayments = {
    1: "Apr 02 2022",
    2: "May 01 2022",
    3: "Jun 02 2022",
    4: "Jul 04 2022",
    5: "Aug 03 2022",
    6: "Sep 04 2022",
    7: "Oct 03 2022",
    8: "Nov 02 2022",
    9: "Dec 04 2022",
    10: "Jan 02 2023",
    11: "Feb 04 2023",
    12: "Mar 01 2023"
    };

    function receiptCleanser(dateOfPayments = {}) {
    // removing watermark
    [...document.querySelectorAll("a[href='/save/rent']")].forEach((x) => x.parentNode?.remove());

    @@ -12,22 +29,6 @@ function receiptCleanser() {
    // removing future provisional watermark
    [...document.querySelectorAll("span")].filter((t) => t.textContent == "Provisional").forEach((t) => t.parentNode?.remove());

    // date of repayment against the receipt number
    let dateOfPayments = {
    1: "Apr 02 2022",
    2: "May 01 2022",
    3: "Jun 02 2022",
    4: "Jul 04 2022",
    5: "Aug 03 2022",
    6: "Sep 04 2022",
    7: "Oct 03 2022",
    8: "Nov 02 2022",
    9: "Dec 04 2022",
    10: "Jan 02 2023",
    11: "Feb 04 2023",
    12: "Mar 01 2023"
    };

    // replacing date of receipt with the actual payment date
    [...document.querySelectorAll("p")].filter((t) => t.textContent.startsWith("Receipt No:")).forEach((t) => {
    let receiptNumber = Number(t.textContent.match(/[0-9]+/)[0]);
  5. abhijithvijayan revised this gist Mar 5, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions clear-tax-rent-receipt.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    // For https://cleartax.in/save/rent
    (() => {
    function receiptCleanser() {
    // removing watermark
    [...document.querySelectorAll("a[href='/save/rent']")].forEach((x) => x.parentNode?.remove());

    @@ -37,4 +37,4 @@
    t.parentNode.children[1].textContent = `Date: ${dateOfPayments[receiptNumber]}`;
    }
    })
    })();
    }
  6. abhijithvijayan renamed this gist Mar 5, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions clear-tax-sanitize.js → clear-tax-rent-receipt.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    // For https://cleartax.in/save/rent
    (() => {
    // removing watermark
    [...document.querySelectorAll("a[href='/save/rent']")].forEach((x) => x.parentNode?.remove());
  7. abhijithvijayan revised this gist Mar 5, 2023. 1 changed file with 33 additions and 31 deletions.
    64 changes: 33 additions & 31 deletions clear-tax-sanitize.js
    Original file line number Diff line number Diff line change
    @@ -1,37 +1,39 @@
    // removing watermark
    [...document.querySelectorAll("a[href='/save/rent']")].forEach((x) => x.parentNode?.remove());
    (() => {
    // removing watermark
    [...document.querySelectorAll("a[href='/save/rent']")].forEach((x) => x.parentNode?.remove());

    // removing month string from receipt heading
    [...document.querySelectorAll("strong")].filter((t) => t.textContent == "RENT RECEIPT").forEach((t) => t.parentNode?.children?.[1]?.remove());
    // removing month string from receipt heading
    [...document.querySelectorAll("strong")].filter((t) => t.textContent == "RENT RECEIPT").forEach((t) => t.parentNode?.children?.[1]?.remove());

    // make Pan -> PAN
    [...document.querySelectorAll("strong")].filter((t) => t.textContent.includes("Pan")).forEach((t) => t.textContent = t.textContent.replace("Pan", "PAN"));
    // make Pan -> PAN
    [...document.querySelectorAll("strong")].filter((t) => t.textContent.includes("Pan")).forEach((t) => t.textContent = t.textContent.replace("Pan", "PAN"));

    // removing future provisional watermark
    [...document.querySelectorAll("span")].filter((t) => t.textContent == "Provisional").forEach((t) => t.parentNode?.remove());
    // removing future provisional watermark
    [...document.querySelectorAll("span")].filter((t) => t.textContent == "Provisional").forEach((t) => t.parentNode?.remove());

    // date of repayment against the receipt number
    let dateOfPayments = {
    1: "Apr 02 2022",
    2: "May 01 2022",
    3: "Jun 02 2022",
    4: "Jul 04 2022",
    5: "Aug 03 2022",
    6: "Sep 04 2022",
    7: "Oct 03 2022",
    8: "Nov 02 2022",
    9: "Dec 04 2022",
    10: "Jan 02 2023",
    11: "Feb 04 2023",
    12: "Mar 01 2023"
    };
    // date of repayment against the receipt number
    let dateOfPayments = {
    1: "Apr 02 2022",
    2: "May 01 2022",
    3: "Jun 02 2022",
    4: "Jul 04 2022",
    5: "Aug 03 2022",
    6: "Sep 04 2022",
    7: "Oct 03 2022",
    8: "Nov 02 2022",
    9: "Dec 04 2022",
    10: "Jan 02 2023",
    11: "Feb 04 2023",
    12: "Mar 01 2023"
    };

    // replacing date of receipt with the actual payment date
    [...document.querySelectorAll("p")].filter((t) => t.textContent.startsWith("Receipt No:")).forEach((t) => {
    let receiptNumber = Number(t.textContent.match(/[0-9]+/)[0]);
    let date = t.parentNode?.children?.[1]?.textContent;
    // replacing date of receipt with the actual payment date
    [...document.querySelectorAll("p")].filter((t) => t.textContent.startsWith("Receipt No:")).forEach((t) => {
    let receiptNumber = Number(t.textContent.match(/[0-9]+/)[0]);
    let date = t.parentNode?.children?.[1]?.textContent;

    if (typeof receiptNumber === "number" && dateOfPayments[receiptNumber] && typeof date === "string" && date.startsWith("Date")) {
    t.parentNode.children[1].textContent = `Date: ${dateOfPayments[receiptNumber]}`;
    }
    })
    if (typeof receiptNumber === "number" && dateOfPayments[receiptNumber] && typeof date === "string" && date.startsWith("Date")) {
    t.parentNode.children[1].textContent = `Date: ${dateOfPayments[receiptNumber]}`;
    }
    })
    })();
  8. abhijithvijayan revised this gist Mar 5, 2023. 1 changed file with 35 additions and 1 deletion.
    36 changes: 35 additions & 1 deletion clear-tax-sanitize.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,37 @@
    // removing watermark
    [...document.querySelectorAll("a[href='/save/rent']")].forEach((x) => x.parentNode?.remove());

    // removing month string from receipt heading
    [...document.querySelectorAll("strong")].filter((t) => t.textContent == "RENT RECEIPT").forEach((t) => t.parentNode?.children?.[1]?.remove());
    [...document.querySelectorAll("strong")].filter((t) => t.textContent.includes("Pan")).forEach((t) => t.textContent = t.textContent.replace("Pan", "PAN"));

    // make Pan -> PAN
    [...document.querySelectorAll("strong")].filter((t) => t.textContent.includes("Pan")).forEach((t) => t.textContent = t.textContent.replace("Pan", "PAN"));

    // removing future provisional watermark
    [...document.querySelectorAll("span")].filter((t) => t.textContent == "Provisional").forEach((t) => t.parentNode?.remove());

    // date of repayment against the receipt number
    let dateOfPayments = {
    1: "Apr 02 2022",
    2: "May 01 2022",
    3: "Jun 02 2022",
    4: "Jul 04 2022",
    5: "Aug 03 2022",
    6: "Sep 04 2022",
    7: "Oct 03 2022",
    8: "Nov 02 2022",
    9: "Dec 04 2022",
    10: "Jan 02 2023",
    11: "Feb 04 2023",
    12: "Mar 01 2023"
    };

    // replacing date of receipt with the actual payment date
    [...document.querySelectorAll("p")].filter((t) => t.textContent.startsWith("Receipt No:")).forEach((t) => {
    let receiptNumber = Number(t.textContent.match(/[0-9]+/)[0]);
    let date = t.parentNode?.children?.[1]?.textContent;

    if (typeof receiptNumber === "number" && dateOfPayments[receiptNumber] && typeof date === "string" && date.startsWith("Date")) {
    t.parentNode.children[1].textContent = `Date: ${dateOfPayments[receiptNumber]}`;
    }
    })
  9. abhijithvijayan created this gist Mar 5, 2023.
    3 changes: 3 additions & 0 deletions clear-tax-sanitize.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    [...document.querySelectorAll("a[href='/save/rent']")].forEach((x) => x.parentNode?.remove());
    [...document.querySelectorAll("strong")].filter((t) => t.textContent == "RENT RECEIPT").forEach((t) => t.parentNode?.children?.[1]?.remove());
    [...document.querySelectorAll("strong")].filter((t) => t.textContent.includes("Pan")).forEach((t) => t.textContent = t.textContent.replace("Pan", "PAN"));