Last active
November 17, 2020 01:25
-
-
Save Ninjex/68244bce101e3568db3f to your computer and use it in GitHub Desktop.
AmznSauce
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
current_url = window.location.href; | |
if (window.addEventListener) { | |
window.addEventListener("storage", handler, false); | |
} else { | |
window.attachEvent("onstorage", handler); | |
}; | |
function handler(e) { | |
sids = JSON.parse(localStorage['sids']); | |
} | |
var sids = JSON.parse(localStorage['sids'] || '{}'); | |
var openChutes = new Array(); | |
function openNewTab(url) { | |
var win = window.open(url, '_blank'); | |
win.focus(); | |
} | |
window.openNewTab = openNewTab; | |
function checkInShipments() { | |
checkin_sids = document.getElementById('ShipmentForm')[0].value; | |
chute = document.getElementById('ShipmentForm')[1].value; | |
getOpenChutes(chute); | |
all_shipments = new Array(); | |
all_shipments = checkin_sids.split(' '); | |
if (openChutes.length < all_shipments.length) { | |
for(x = 0; x < openChutes.length; x++) { | |
ship = all_shipments[x]; | |
chute = openChutes[x] | |
url = `http://oops-web-iad.amazon.com/demand/CUSTOMER_SHIPMENT/${ship}/promptChute?chuteId=${chute}` | |
openNewTab(url); | |
delete sids[ship]; | |
localStorage['sids'] = JSON.stringify(sids); | |
} | |
} | |
else { | |
for(x = 0; x < all_shipments.length; x++) { | |
ship = all_shipments[x]; | |
chute = openChutes[x] | |
url = `http://oops-web-iad.amazon.com/demand/CUSTOMER_SHIPMENT/${ship}/promptChute?chuteId=${chute}` | |
openNewTab(url); | |
delete sids[ship]; | |
localStorage['sids'] = JSON.stringify(sids); | |
} | |
} | |
location.reload(); | |
} | |
window.checkInShipments = checkInShipments; | |
function getOpenChutes(chute) { | |
while(openChutes.length > 0) { openChutes.pop(); } | |
regx = 'chROOPS' + chute + '\\d{3}'; | |
var re = new RegExp(regx, 'g'); | |
markup = document.documentElement.innerHTML; | |
while(match = re.exec(markup) ) { | |
openChutes.push(match[0]); | |
} | |
} | |
window.getOpenChutes = getOpenChutes; | |
var form = ` | |
<form id="ShipmentForm"> | |
Shipment ID(s): | |
<input type="text" name="shipment-id"> | |
<select id="chute-id"> | |
<option id="chute-A" value="A">A</option> | |
<option id="chute-B" value="B">B</option> | |
<option id="chute-C" value="C">C</option> | |
<option id="chute-D" value="D">D</option> | |
<option id="chute-E" value="E">E</option> | |
<option id="chute-F" value="F">F</option> | |
<option id="chute-G" value="G">G</option> | |
<option id="chute-H" value="H">H</option> | |
<option id="chute-I" value="I">I</option> | |
<option id="chute-J" value="J">J</option> | |
<option id="chute-K" value="K">K</option> | |
<option id="chute-L" value="L">L</option> | |
</select> | |
<button onclick="checkInShipments();">Check In</button> | |
</form> | |
`; | |
document.body.getElementsByClassName('tool-header-right')[0].innerHTML += form; | |
var slist = Object.keys(sids).join(' '); | |
document.getElementById('ShipmentForm')[0].value = (slist.charAt(0) == ' ') | |
? slist.substring(1) | |
: slist; |
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
current_url = window.location.href; | |
if (window.addEventListener) { | |
window.addEventListener("storage", handler, false); | |
} else { | |
window.attachEvent("onstorage", handler); | |
}; | |
function handler(e) { | |
sids = JSON.parse(localStorage['sids']); | |
} | |
var source = document.querySelectorAll('td.non-filterable.highlight-data'); | |
var sids = JSON.parse(localStorage['sids'] || '{}'); | |
for(var i = 0; i < source.length; i++) { | |
var sid = source[i].innerHTML.split('referenceId=')[1].split('&')[0]; | |
var cb = document.createElement("input"); | |
cb.type = "checkbox"; | |
cb.name = "sid"; | |
cb.id = 'sid'; | |
cb.value = sid; | |
cb.checked = (sids[sid]) ? true : false; | |
source[i].appendChild(cb); | |
} | |
function add_shipments() { | |
var ships = document.getElementsByName('sid'); | |
for(var x = 0; x < ships.length; x++) { | |
ship = ships[x]; | |
if(ship.checked == true) { | |
sids[ship.value] = true; | |
} | |
} | |
} | |
function remove_shipments() { | |
var ships = document.getElementsByName('sid'); | |
for(var x = 0; x < ships.length; x++) { | |
ship = ships[x]; | |
if(ship.checked == true) { | |
delete sids[ship.value]; | |
} | |
} | |
} | |
[ | |
{ | |
text: '+', | |
fn: () => { | |
add_shipments(); | |
} | |
}, | |
{ | |
text: '-', | |
fn: () => { | |
remove_shipments(); | |
} | |
}, | |
{ | |
text: '?', | |
fn: () => { | |
prompt("SID(s):\n", Object.keys(sids).join(' ')); | |
} | |
}, | |
{ | |
text: '💣', | |
fn: () => { | |
sids = {}; | |
} | |
}, | |
{ | |
text: '✔', | |
fn: () => { | |
var ships = document.getElementsByName('sid'); | |
for(var x = 0; x < ships.length; x++) { | |
ships[x].checked = true; | |
} | |
} | |
}, | |
{ | |
text: '⍰', | |
fn: () => { | |
checked_list = {} | |
var ships = document.getElementsByName('sid'); | |
for(var x = 0; x < ships.length; x++) { | |
if(ships[x].checked == true) { | |
checked_list[ships[x].value] = true | |
} | |
} | |
prompt("SID(s):\n", Object.keys(checked_list).join(' ')); | |
} | |
} | |
].forEach((entry) => { | |
var button = document.createElement('button'); | |
label = document.createTextNode(entry.text); | |
button.appendChild(label); | |
button.name = "sid"; | |
button.addEventListener('click', () => { | |
entry.fn(); | |
localStorage['sids'] = JSON.stringify(sids); | |
}); | |
document.querySelector('.rodeo-navigation-container').appendChild(button); | |
}); | |
window.onkeydown=function(e){ | |
e = e || event | |
if (e.keyCode == 20) { | |
visible = document.getElementsByName('sid'); | |
for(var i = 0; i < visible.length; i++) { | |
visible[i].style.visibility = 'hidden'; | |
} | |
} else if (e.keyCode == 107) { | |
add_shipments(); | |
} else if (e.keyCode == 109){ | |
remove_shipments(); | |
} | |
} |
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
current_url = window.location.href; | |
if (window.addEventListener) { | |
window.addEventListener("storage", handler, false); | |
} else { | |
window.attachEvent("onstorage", handler); | |
}; | |
function handler(e) { | |
sids = JSON.parse(localStorage['sids']); | |
} | |
if(current_url.match(/shipmentId=\d{13,}/)) { | |
var url_sid = current_url.split('Id=')[1]; | |
var framework1 = document.querySelector('.fieldheader'); | |
var sids = JSON.parse(localStorage['sids'] || '{}'); | |
[ | |
{ | |
text: '+', | |
fn: () => { | |
sids[url_sid] = true; | |
} | |
}, | |
{ | |
text: '-', | |
fn: () => { | |
delete sids[url_sid]; | |
} | |
}, | |
{ | |
text: '?', | |
fn: () => { | |
prompt("SID(s):\n", Object.keys(sids).join(' ')); | |
} | |
}, | |
{ | |
text: '💣', | |
fn: () => { | |
sids = {}; | |
} | |
} | |
].forEach((entry) => { | |
var button = document.createElement('button'); | |
label = document.createTextNode(entry.text); | |
button.appendChild(label); | |
button.name = "sid"; | |
button.addEventListener('click', () => { | |
entry.fn(); | |
localStorage['sids'] = JSON.stringify(sids); | |
}); | |
framework1.appendChild(button); | |
}); | |
} | |
window.onkeydown=function(e){ | |
e = e || event | |
if (e.keyCode == 20) { | |
visible = document.getElementsByName('sid'); | |
for(var i = 0; i < visible.length; i++) { | |
visible[i].style.visibility = 'hidden'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment