amazon subscribe and save button!!

adds a subscribe and save button to the left of the returns & orders button in the same style as the rest of amazon

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

// ==UserScript==
// @name         amazon subscribe and save button!!
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  adds a subscribe and save button to the left of the returns & orders button in the same style as the rest of amazon
// @author       Nicole_
// @match        https://www.amazon.com/*
// @icon         https://icons.duckduckgo.com/ip2/amazon.com.ico
// @license MIT
// @run-at       document-start
// ==/UserScript==
setTimeout(addbutton, 10)
setTimeout(addbutton, 20)
setTimeout(addbutton, 30)
setTimeout(addbutton, 40)
setTimeout(addbutton, 50)
setTimeout(addbutton, 100)
setTimeout(addbutton, 200)
document.addEventListener("DOMContentLoaded", function () {
    addbutton()
});
function addbutton(){
    let toprightbuttons = document.querySelector('.layoutToolbarPadding');
    if (toprightbuttons.innerHTML.includes("?ref_=nav_orders_first")){
        toprightbuttons.innerHTML = toprightbuttons.innerHTML.replace("/customer-preferences/edit?ie=UTF8&amp;preferencesReturnUrl=%2F&amp;ref_=topnav_lang", "/customer-preferences/edit").replace("https://www.amazon.com/gp/css/homepage.html?ref_=nav_youraccount_btn", "https://www.amazon.com/gp/css/homepage.html").replace('<a href="/gp/css/order-history?ref_=nav_orders_first" class="nav-a nav-a-2   nav-progressive-attribute" id="nav-orders" tabindex="0">\n  <span class="nav-line-1">Returns</span>\n  <span class="nav-line-2">&amp; Orders<span class="nav-icon nav-arrow"></span></span>\n</a>', '<a href="/gp/css/order-history" class="nav-a nav-a-2   nav-progressive-attribute" id="nav-orders" tabindex="0">\n  <span class="nav-line-1">Returns</span>\n  <span class="nav-line-2">&amp; Orders<span class="nav-icon nav-arrow"></span></span>\n</a><a href="/auto-deliveries/subscriptionList" class="nav-a nav-a-2   nav-progressive-attribute" id="nav-orders" tabindex="0">\n  <span class="nav-line-1">Subscribe</span>\n  <span class="nav-line-2">&amp; Save<span class="nav-icon nav-arrow"></span></span>\n</a>').replace('/gp/cart/view.html?ref_=nav_cart', '/gp/cart/view.html')
    }
};