Amazon Item Not FBA (USA)

Know when viewing non-FBA item pages

Stan na 23-07-2020. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Amazon Item Not FBA (USA)
// @description Know when viewing non-FBA item pages
// @author      dehotjava
// @namespace   https://greasyfork.org/en/scripts/407562-amazon-item-not-fba
// @match       https://*.amazon.com/dp/*
// @match       https://*.amazon.com/*/dp/*
// @match       https://*.amazon.com/gp/product/*
// @match       https://*.amazon.com/*/ASIN/*
// @run-at      document-idle
// @version     2
// @grant       none
// @icon        https://www.amazon.com/favicon.ico
// ==/UserScript==

function blink(outputelemnt, textToBlink) {
    let show = true;

    setInterval( () => {
        if (show) {
            document.getElementById(outputelemnt).textContent = textToBlink;
            show = false;
        } else {
            document.getElementById(outputelemnt).textContent = "*";
            show = true;
        }
    }, 1000);
}

var info_merchant = document.getElementById('merchant-info');
var info_oos = document.getElementById('outOfStock');
var info_unqual = document.getElementById('unqualifiedBuyBox');

if (document.getElementById('twister') != null) {
    for (const li of document.querySelectorAll('#variation_color_name>ul>li')) {
        li.addEventListener('click', function() {
            location.href = li.getAttribute('data-dp-url');
        });
    }
}

if ((info_merchant != null && info_merchant.innerHTML.search('Fulfilled by Amazon') == -1 && info_merchant.innerHTML.search('Ships from and sold by Amazon.com') == -1) && !(info_oos != null) && !(info_unqual != null)) {
    document.getElementById('skiplink').remove();

    document.body.style.border = 'red';
    document.body.style.borderStyle = 'inset';
    document.body.style.borderWidth = '0.5em';

    var txt_caution = document.createElement("p");
    txt_caution.id = 'notfba';
    txt_caution.innerHTML = '* THIS ITEM IS NOT FULFILLED BY AMAZON *';
    txt_caution.style.background = 'black';
    txt_caution.style.color = 'red';
    txt_caution.style.fontSize = 'xx-large';
    txt_caution.style.margin = 'inherit';
    txt_caution.style.textAlign = 'center';
    txt_caution.style.textTransform = 'uppercase';
    document.documentElement.insertAdjacentElement('afterbegin', txt_caution);

    var txt_caution_cart = txt_caution.cloneNode(true);
    txt_caution_cart.id = 'notfba_cart';
    txt_caution_cart.innerHTML = '* THIS ITEM IS NOT FBA *';
    txt_caution_cart.style.background = 'inherit';
    txt_caution_cart.style.fontSize = 'medium';
    txt_caution_cart.style.margin = '0 0 14px 0';
    document.getElementById('addToCart_feature_div').prepend(txt_caution_cart);

    blink('notfba', '* THIS ITEM IS NOT FULFILLED BY AMAZON *');
    blink('notfba_cart', '* THIS ITEM IS NOT FBA *');
}