Last active
April 22, 2024 08:08
-
-
Save abhijithvijayan/46a9dc8248b26c68f5241d16fb6bee96 to your computer and use it in GitHub Desktop.
Rent Receipt Sanitizer for https://cleartax.in/save/rent. Run the comment https://gist.github.com/abhijithvijayan/46a9dc8248b26c68f5241d16fb6bee96?permalink_comment_id=4492263#gistcomment-4492263
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 characters
| // For https://cleartax.in/save/rent | |
| (() => { | |
| // 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()); | |
| // 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]}`; | |
| } | |
| }) | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.