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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

Advertisement:

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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