Skip to content

Instantly share code, notes, and snippets.

@adellhk
Created June 15, 2016 07:13
Show Gist options
  • Save adellhk/7c9061ee05edf30dc87358a2ac614e9c to your computer and use it in GitHub Desktop.
Save adellhk/7c9061ee05edf30dc87358a2ac614e9c to your computer and use it in GitHub Desktop.
Print a return label from Amazon without printing the instructions
if (isReturnInstructions()) {
divs = document.getElementsByClassName('a-section');
for (i = 0; i < divs.length; i++) {
div = divs[i];
if (! div.className.includes("page-break-avoid") && ! div.parentElement.className.includes("page-break-avoid")) {
div.className += (" no-print");
console.log("Div #"+ (i+1) + div.className);
}
}
}
function isReturnInstructions() {
return (window.location.pathname.indexOf("returns/label/") > -1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment