Last active
July 2, 2025 20:50
-
-
Save AJolly/ff02d798f001057fb3de8b27096a84a5 to your computer and use it in GitHub Desktop.
Amazon Bypass Need anything else? Checkout UserScript
This file contains hidden or 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 Amazon Auto Checkout and No Thanks | |
// @version 0.4 | |
// @description Automatically clicks the "Continue to checkout" button on Amazon cart pages and "No Thanks" on product pages | |
// @match https://www.amazon.com/cart/byc/ref=ox_sc_byg_proceed* | |
// @match https://www.amazon.com/gp/product/* | |
// @match https://www.amazon.com/dp/* | |
// @match https://www.amazon.com/*/dp/* | |
// @match https://www.amazon.com/cart/smart-wagon* | |
// @namespace https://gist.github.com/AJolly | |
// @author AJolly | |
// @license MIT | |
// @downloadURL https://gist.github.com/AJolly/ff02d798f001057fb3de8b27096a84a5/raw/?cache-bust=112 | |
// @updateURL https://gist.github.com/AJolly/ff02d798f001057fb3de8b27096a84a5/raw/?cache-bust=112 | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Function to click the "Continue to checkout" button | |
function clickCheckoutButton() { | |
const checkoutButton = document.querySelector('a[name="sc-byc-ptc-button"]'); | |
if (checkoutButton) { | |
checkoutButton.click(); | |
console.log('Auto-clicked the "Continue to checkout" button'); | |
} else { | |
console.log('Checkout button not found'); | |
} | |
const chartButton = document.querySelector('a[href^="/cart"]'); | |
if (chartButton) { | |
chartButton.click(); | |
console.log('Auto-clicked the "Continue to checkout" button'); | |
} | |
} | |
// Function to click the "No Thanks" button on product pages | |
//Check will this work on <span class="a-button-inner"><input class="a-button-input" type="submit" aria-labelledby="attachSiNoCoverage-announce"><span id="attachSiNoCoverage-announce" class="a-button-text" aria-hidden="true"> No Thanks </span></span>? | |
function clickNoThanksButton() { | |
const noThanksButton = document.querySelector('#attachSiNoCoverage'); | |
if (noThanksButton) { | |
noThanksButton.click(); | |
console.log('Auto-clicked the "No Thanks" button'); | |
} else { | |
console.log('No Thanks button not found'); | |
} | |
} | |
console.log('AMZ Proceed and No Thanks Script Loaded'); | |
// Determine which function to run based on the current URL | |
if (window.location.href.includes('/cart/')) { | |
// Run the checkout function when the page is fully loaded | |
window.addEventListener('load', clickCheckoutButton); | |
// Also run the checkout function immediately in case the page is already loaded | |
clickCheckoutButton(); | |
} else /** if (window.location.href.includes('/gp/product/')) */{ | |
// Run the No Thanks function when the page is fully loaded | |
window.addEventListener('load', clickNoThanksButton); | |
// Also run the No Thanks function immediately in case the page is already loaded | |
clickNoThanksButton(); | |
} | |
/** | |
* This script waits for a specific element to appear on the page and then clicks it. | |
* It uses MutationObserver for efficiency. | |
*/ | |
// --- Configuration --- | |
// IMPORTANT: Replace this with the CSS selector for your "No Thanks" button. | |
const noThanksbuttonSelector = '#attachSiNoCoverage'; | |
// ------------------- | |
const targetNode = document.body; | |
const config = { childList: true, subtree: true }; | |
// The function that will be called when the DOM changes | |
const callback = (mutationsList, observer) => { | |
const noThanksButton = document.querySelector(noThanksbuttonSelector); | |
if (noThanksButton) { | |
console.log(`Found button with selector "${noThanksbuttonSelector}". Clicking it.`); | |
noThanksButton.click(); | |
// Once we've found and clicked the button, we don't need to watch anymore. | |
//observer.disconnect(); | |
//console.log('Observer disconnected.'); | |
} | |
}; | |
// Create an observer instance and start observing | |
const observer = new MutationObserver(callback); | |
observer.observe(targetNode, config); | |
console.log(`Observer started. Waiting for button with selector: ""`); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment