Amazon Price Variation (Fork)

Embeds CamelCamelCamel price chart in Amazon

目前為 2017-11-05 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Amazon Price Variation (Fork)
// @namespace   PriceVariationDSR
// @description Embeds CamelCamelCamel price chart in Amazon
// @include     http://www.amazon.*/*
// @include     https://www.amazon.*/*
// @version     20171105
// @grant       none
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/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>");
	}
});