diff options
Diffstat (limited to 'misc/usps-fill-out-scheduled-pickup.js')
-rw-r--r-- | misc/usps-fill-out-scheduled-pickup.js | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/misc/usps-fill-out-scheduled-pickup.js b/misc/usps-fill-out-scheduled-pickup.js index a8359ce..dd4256f 100644 --- a/misc/usps-fill-out-scheduled-pickup.js +++ b/misc/usps-fill-out-scheduled-pickup.js @@ -10,14 +10,14 @@ /* First page config */ const fill = { - emailAddress: "youremail@example.com", - phoneNumber: "777-777-7777", - zipCode: "60606", - state: "IL", - city: "CHICAGO", - addressLineOne: "701 My Lovely Home St.", - lastName: "Smith", - firstName: "John" + emailAddress: "youremail@example.com", + phoneNumber: "777-777-7777", + zipCode: "60606", + state: "IL", + city: "CHICAGO", + addressLineOne: "701 My Lovely Home St.", + lastName: "Smith", + firstName: "John" } /* Misc config */ @@ -25,83 +25,83 @@ const packageLocationFill = "Porch" /* Fill funcs */ function fillInitialFields() { - for (let fieldName in fill) - document.getElementById(fieldName).value = fill[fieldName] + for (let fieldName in fill) + document.getElementById(fieldName).value = fill[fieldName] } function fillDogField() { - const f = document.querySelector("#second-radio-verification[name=isDogHere]") - f.checked = true - return f + const f = document.querySelector("#second-radio-verification[name=isDogHere]") + f.checked = true + return f } function fillPackageLocation() { - const f = document.getElementById("packageLocation") - f.value = packageLocationFill - return f + const f = document.getElementById("packageLocation") + f.value = packageLocationFill + return f } function fillPickupTime() { - const f = document.getElementById("pickup-regular-time") - f.click() - return f + const f = document.getElementById("pickup-regular-time") + f.click() + return f } function fillPickupDate() { - const f = document.querySelector("#schedule-pickup-cal td:not(.ui-datepicker-unselectable)") // Gets first date that is selectable - f.click() - return f + const f = document.querySelector("#schedule-pickup-cal td:not(.ui-datepicker-unselectable)") // Gets first date that is selectable + f.click() + return f } function fillTerms() { - const f = document.querySelector(".termsConditions") - f.checked = true - return f + const f = document.querySelector(".termsConditions") + f.checked = true + return f } function fillHazmat() { - const f = document.querySelector("#hazmat-no") - f.checked = true - return f + const f = document.querySelector("#hazmat-no") + f.checked = true + return f } function scrollToDetails() { - document.getElementById("quantityCheck").scrollIntoView() + document.getElementById("quantityCheck").scrollIntoView() } function showPickupDateInStepFour(pickupDateTD) { - const month = parseInt(pickupDateTD.dataset.month) + 1 - const year = pickupDateTD.dataset.year - const day = pickupDateTD.firstElementChild.innerText + const month = parseInt(pickupDateTD.dataset.month) + 1 + const year = pickupDateTD.dataset.year + const day = pickupDateTD.firstElementChild.innerText - const date = `${month}-${day}-${year}` + const date = `${month}-${day}-${year}` - const dateElement = document.createElement("div") - dateElement.class = "step-four-top-header" - dateElement.innerHTML = `<p class="step-four-row-header"></p>` - dateElement.innerHTML += `<p class="step-four-row-header" style="font-weight:bold;">Date of Pickup: ${date}</p>` + const dateElement = document.createElement("div") + dateElement.class = "step-four-top-header" + dateElement.innerHTML = `<p class="step-four-row-header"></p>` + dateElement.innerHTML += `<p class="step-four-row-header" style="font-weight:bold;">Date of Pickup: ${date}</p>` - const container = document.querySelector("div.pickup-summary-gray-box-wrapper div") - const sibiling = container.querySelector("div.step-four-top-header") - container.insertBefore(dateElement, sibiling) - return dateElement + const container = document.querySelector("div.pickup-summary-gray-box-wrapper div") + const sibiling = container.querySelector("div.step-four-top-header") + container.insertBefore(dateElement, sibiling) + return dateElement } /* Start */ fillInitialFields() document.querySelector("#webToolsAddressCheck").addEventListener("click", () => { - const magicChange = new Event("change") + const magicChange = new Event("change") - fillDogField() .dispatchEvent(magicChange) - fillPackageLocation().dispatchEvent(magicChange) + fillDogField() .dispatchEvent(magicChange) + fillPackageLocation().dispatchEvent(magicChange) - fillPickupTime() // Works through click + fillPickupTime() // Works through click - setTimeout(() => { - showPickupDateInStepFour(fillPickupDate()) // Need to wait for this (calendar) to load in first since it's loaded dynamically - fillHazmat() - fillTerms() - scrollToDetails() - }, 750) + setTimeout(() => { + showPickupDateInStepFour(fillPickupDate()) // Need to wait for this (calendar) to load in first since it's loaded dynamically + fillHazmat() + fillTerms() + scrollToDetails() + }, 750) }) |