Amazon Price Variation (Fork)

Embeds CamelCamelCamel price chart in Amazon

Versione datata 10/12/2017. Vedi la nuova versione l'ultima versione.

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!)

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!)

// ==UserScript==
// @name        Amazon Price Variation (Fork)
// @namespace   dsr-price-variation-camel
// @description Embeds CamelCamelCamel price chart in Amazon
// @include     http://www.amazon.*/*
// @include     https://www.amazon.*/*
// @include     http://smile.amazon.*/*
// @include     https://smile.amazon.*/*
// @version     20171209
// @grant       none
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// ==/UserScript==

var width = 500;
var height = 200;
var duration = "1y";

//Possible other values are "amazon", "new", "used", "new-used", & "amazon-new-used" 
var chart = "amazon-new";

$(document).ready(function () {
	var element = $(':input[name="ASIN"]');
	var arr = document.domain.split(".");
	var country = arr[arr.length - 1];
	if (country == "com") { 
		country = "us"; 
	}

	if (element) {
		var prot = window.location.protocol;
		var asin = $.trim(element.attr("value"));
		var link = "<a target='blank' href='" + prot + "//" + country + ".camelcamelcamel.com/product/" + asin + "'>"  +
						"<img src='" + prot + "//charts.camelcamelcamel.com/" + country + "/" + asin + "/" + chart + ".png?force=1&zero=0&w=" + width + "&h=" + height + "&desired=false&legend=1&ilt=1&tp=" + duration + "&fo=0'/>" +
					"</a>";

		$("#availability").append("<div id='camelcamelcamel' style='margin-top: 0px; margin-left: 0px'>" + link + "</div>");
	}
});