Last active
December 19, 2015 23:49
-
-
Save rjocoleman/6036802 to your computer and use it in GitHub Desktop.
This file contains 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
// ==UserScript== | |
// @name Failed labels quick links | |
// @description Failed labels quick links | |
// @include https://shipping.etailer.co.nz/parcels/*/edit | |
// @version 0.3 | |
// @namespace https://gist.github.com/rjocoleman/6036802 | |
// @updateURL https://gist.github.com/rjocoleman/6036802/raw | |
// @downloadURL https://gist.github.com/rjocoleman/6036802/raw | |
// ==/UserScript== | |
var zNode = document.createElement('div'); | |
zNode.innerHTML = '<button id="suburbSwitch" class="haxButton" type="button">Copy City to Suburb and Submit!</button><br/><button id="prefixPostcode" class="haxButton" type="button">Add Zero to postcode and Submit!</button><br/><button id="noATL" class="haxButton" type="button">Make No ATL and Submit!</button>'; | |
zNode.setAttribute ('id', 'theContainer'); | |
document.body.appendChild(zNode); | |
// Activate buttons | |
document.getElementById("suburbSwitch").addEventListener("click", suburbSwitch, false); | |
document.getElementById("prefixPostcode").addEventListener("click", prefixPostcode, false); | |
document.getElementById("noATL").addEventListener("click", noATL, false); | |
function suburbSwitch(zEvent) { | |
// fill suburb with the contents of city | |
document.getElementById("parcel_delivery_address_attributes_suburb").value = document.getElementById("parcel_delivery_address_attributes_city").value; | |
document.forms[1].submit(); | |
} | |
function prefixPostcode(zEvent) { | |
// add a zero infront of the postcode | |
document.getElementById("parcel_delivery_address_attributes_postcode").value = "0"+document.getElementById("parcel_delivery_address_attributes_postcode").value; | |
document.forms[1].submit(); | |
} | |
function noATL(zEvent) { | |
// Tick Signature required | |
document.getElementById("parcel_delivery_address_attributes_signature_required").checked = true; | |
document.forms[1].submit(); | |
} | |
GM_addStyle ( (<><![CDATA[ | |
#theContainer { | |
position: absolute; | |
top: 0; | |
left: 0; | |
font-size: 20px; | |
background: orange; | |
border: 3px outset black; | |
margin: 5px; | |
opacity: 0.9; | |
z-index: 222; | |
padding: 5px 20px; | |
} | |
#haxButton { | |
cursor: pointer; | |
} | |
#theContainer p { | |
color: red; | |
background: white; | |
} | |
]]></>).toString () ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment