amazon command

This adds commands of the amazon.

Από την 24/01/2021. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

// ==UserScript==
// @name         amazon command
// @namespace    amazon command
// @version      0.2
// @description  This adds commands of the amazon.
// @author       meguru
// @include      https://www.amazon.co.jp/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const createButton = (label, cmd) => {
        const button = document.createElement('button');
        if (!button) { console.log('failed create ${label}') };
        button.innerHTML = label;
        button.onclick = () => {
            window.location.href += cmd;
        };
        return button;
    }

    const refArea = document.getElementById('s-refinements');
    if (!refArea) {
        console.log('not find refArea');
        return;
    };

    const fromAmazonJpButton = createButton('from amazon.jp', '&emi=AN1VRQENFRJN5');
    let res = refArea.parentNode.insertBefore(fromAmazonJpButton, refArea);
    if (!res) {
        console.log('failed add button');
        return;
    };

    const offButton = createButton('50% off', '&pct-off=50-');
    res = refArea.parentNode.insertBefore(offButton, refArea);
    if (!res) {
        console.log('failed add button');
        return;
    };

})();