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

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Advertisement:

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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')
    }
};