Skip to content

Instantly share code, notes, and snippets.

@htkcodes
Last active January 21, 2021 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htkcodes/6f70ab1af6547485609d13f2b3f5f58f to your computer and use it in GitHub Desktop.
Save htkcodes/6f70ab1af6547485609d13f2b3f5f58f to your computer and use it in GitHub Desktop.
Edits order details page on the fly requires tampermonkey
// ==UserScript==
// @name fckcustoms
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Customs are literally scammers
// @author You
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @match https://www.amazon.com/gp/your-account/order-details*
// @run-at document-body
// @grant none
// ==/UserScript==
(function() {
'use strict';
/*setMutationHandler(document, '#od-subtotals', function(nodes) {
this.disconnect();
nodes.forEach(function(n) {
});
});*/
(new MutationObserver(check)).observe(document, {childList: true, attributes: true, characterData: true, subtree: true,});
function check(changes, observer) {
if(document.querySelector('#od-subtotals')) {
observer.disconnect();
//Shipping price
// document.querySelector('#od-subtotals > .a-row:nth-child(3) .a-column:nth-child(2) > .a-color-base').innerHTML = "$15"
//coupon savings
$('#od-subtotals > .a-row:nth-child(3)').append(`<div class="a-row">
<div class="a-column a-span7 a-text-left">
<span class="a-color-base">
Promotion Applied:
</span>
</div>
<div class="a-column a-span5 a-text-right a-span-last">
<span class="a-color-base">
$-100.00
</span>
</div>
</div>`)
var sub = parseFloat(document.querySelector("#od-subtotals > .a-row:nth-child(2) .a-column:nth-child(2) > .a-color-base").innerText.replace(/[^\d.]/g, ''))
var ship =parseFloat(document.querySelector("#od-subtotals > .a-row:nth-child(3) .a-column:nth-child(2) > .a-color-base").innerText.replace(/[^\d.]/g, ''))
var coupon = parseFloat(-Math.abs(document.querySelector("#od-subtotals > .a-row:nth-child(3) > .a-row .a-column:nth-child(2) > .a-color-base").innerText.replace(/[^\d.]/g, '')))
var totalb = ship + sub + coupon;
document.querySelector("#od-subtotals > .a-row:nth-child(5) .a-column:nth-child(2) > .a-color-base").innerText = "$" + totalb
var tax = parseFloat(document.querySelector("#od-subtotals > .a-row:nth-child(6) .a-column:nth-child(2) > .a-color-base").innerText.replace(/[^\d.]/g, ''))
var grandTotal = totalb+tax
document.querySelector("#od-subtotals > .a-row:nth-child(8) .a-column:nth-child(2) > .a-color-base").innerText = "$" + grandTotal
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment