Amazon.com Item Not FBA

Know when viewing non-FBA item pages

Από την 13/12/2020. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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.

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

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

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.

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

// ==UserScript==
// @name        Amazon.com Item Not FBA
// @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/*
// @match       https://*.amazon.ca/dp/*
// @match       https://*.amazon.ca/*/dp/*
// @match       https://*.amazon.ca/gp/product/*
// @match       https://*.amazon.ca/*/ASIN/*
// @run-at      document-idle
// @version     16
// @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 cart_add = document.getElementById('submit.add-to-cart') || document.getElementById('submit.add-to-cart-ubb');
var cart_fly = document.getElementById('nav-flyout-ewc');
var info_merchant = document.getElementById('merchant-info') || document.getElementById('usedbuyBox') || document.getElementById('buybox') || document.getElementById('desktop_qualifiedBuyBox');
var info_oos = document.getElementById('outOfStock') || document.getElementById('backInStock');
var info_unqual = document.getElementById('unqualifiedBuyBox');

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

if (
    (info_merchant != null &&
     info_merchant.innerText.search('Fulfilled by Amazon') == -1 &&
     info_merchant.innerText.search('Ships from and sold by Amazon.') == -1 &&
     info_merchant.innerText.search('Ships from\nAmazon') == -1 &&
     info_merchant.innerText.search('To buy, select') == -1 &&
     info_merchant.innerText.search('Early Access') == -1 &&
     info_merchant.innerText.search('Kindle Price') == -1 &&
     info_merchant.innerText.search('audiobook') == -1
    ) &&
    !(info_oos != null) &&
    !(info_unqual != null)
   ) {

    console.log(info_merchant)
    console.log(info_merchant.innerText)

    if (cart_fly != null && document.getElementById('nav-flyout-ewc').style.cssText.search('right') != -1) {
        cart_fly.style.marginRight = '8px';
        cart_fly.style.marginTop = '7px';
        cart_fly.style.clipPath = "inset(0px 0px 14px 0px)";
    }

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

    if (cart_add != null) {
        cart_add.parentElement.prepend(txt_caution_cart);
        blink('notfba_cart', '* THIS ITEM IS NOT FBA *');
    }

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