Here are some Scripts I have created to Ease up use of some Websites, I was not aware of Tamper Money till June 2020, I just use to execute scripts via Console in Chrome but not a very neat method and very cumbersome. However I learnt about Tamper monkey and found it to be very useful. In the date entry operations its quiet useful as you can modify the webpage as per user needs for faster work.

List of Scripts

  1. Check Aadhaar
  2. Download Aadhaar
  3. MPCZ Portal Charges

Date Time Picker in Eaadhaar Site

UIDAI updated their website to download aadhaar card, earlier they had jQuery input mask plugin so it was easier to type in DateTime and Enrollment number however after the update it was no longer the case and we had to add "/" and ":" with hands. So just to add this functionality to this site I created script. Of course the scripts would only work in current scenario because of excessive use of id tag. But I uploaded these scripts here so that I may be able to use them in future without having to recreate it from scratch.

Check Aadhaar Status Site

(function() {
    'use strict';
    const timeField = document.getElementById("datetimepicker1").children[0];
    timeField.removeAttribute("readonly");
    timeField.setAttribute("maxlength", "19");
    try{
        timeField.addEventListener('keydown', function(event){
            if( event.which === 8 ){
                return;
            }
            const i = timeField.value.length;
            if( i === 2 || i === 5 ){
                timeField.value += "/";
            } else if( i === 10 ){
                timeField.value += " ";
            } else if( i === 13 || i === 16) {
                timeField.value += ":";
            }
        });
    }
    catch(e){
        console.log("Time Field Does Not Exit");
    }
})();

Download Aadhaar Site

(function() {
    'use strict';
    try{
        const timeField = document.getElementById("dateTime");
        timeField.addEventListener('keydown', function(event){
            if( event.which === 8 ){
                return;
            }
            const i = timeField.value.length;
            if( i === 2 || i === 5 ){
                timeField.value += "/";
            } else if( i === 10 ){
                timeField.value += " ";
            } else if( i === 13 || i === 16) {
                timeField.value += ":";
            }
        });
    }
    catch(e){
        console.log("Time Field Does Not Exit");
    }
})();

MPCZ Portal Charges Now customer always ask for Receipts, and receipts never print commission amount. So why not, this script simply updates the receipt and includes the Commission and makes customer happy :).

(function() {
    'use strict';
    function getPercent(num) { if( num < 1000 ) { return 10; } else { let per = Math.round(num/100); per = per - per%5; return per; } };
    const tbody = document.getElementById("printarea").children[1];
    document.getElementsByTagName("table")[0].setAttribute("width", "100%");
    document.getElementsByTagName("table")[0].setAttribute("cellpadding", "5");
    tbody.children[4].children[0].innerText = "BILL AMOUNT";
    const amount = +tbody.children[4].children[1].innerText;
    const dateRow = tbody.children[5];
    const portalChargeRow = document.createElement("tr");
    const portalChargetd1 = document.createElement("td");
    portalChargetd1.innerHTML = "<strong>KIOSK CHARGE<strong>";
    const portalChargetd2 = document.createElement("td");
    portalChargetd2.innerText = getPercent(amount).toFixed(2);
    portalChargeRow.appendChild(portalChargetd1);
    portalChargeRow.appendChild(portalChargetd2);
    portalChargetd2.setAttribute("style", "color:blue;");
    const totalAmount = (amount + getPercent(amount)).toFixed(2);
    const totalChargeRow = document.createElement("tr");
    const totalChargeTd1 = document.createElement("td");
    const totalChargeTd2 = document.createElement("td");
    totalChargeTd2.setAttribute("style", "color:blue;");
    totalChargeTd1.innerHTML = "<strong>TOTAL AMOUNT</strong>";
    totalChargeTd2.innerText = totalAmount;
    totalChargeRow.appendChild(totalChargeTd1);
    totalChargeRow.appendChild(totalChargeTd2);
    tbody.insertBefore(portalChargeRow, dateRow);
    tbody.insertBefore(totalChargeRow, dateRow);
})();

Next Post Previous Post