Greasy Fork

来自缓存

Greasy Fork is available in English.

Amazon CamelCamelCamel + Keepa Price Charts

Add a CamelCamelCamel and Keepa price charts to Amazon product pages.

当前为 2020-11-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           Amazon CamelCamelCamel + Keepa Price Charts
// @version        1.0.1
// @description    Add a CamelCamelCamel and Keepa price charts to Amazon product pages.
// @author         miki.it
// @namespace      null
// @include        https://www.amazon.*/*
// @include        https://smile.amazon.*/*
// ==/UserScript==

var tld = document.domain.split(".").pop();
var country = tld;
if (tld == "com") {
    country = "us";
}

var asin = document.getElementById("ASIN").value;
if (!asin) {
    throw new Error("Amazon CamelCamelCamel + Keepa Price Charts: unable to get ASIN!");
}

var parentElement = document.getElementById("unifiedPrice_feature_div");
if (!parentElement) {
    throw new Error("Amazon CamelCamelCamel + Keepa Price Charts: unable to get parent element!");
}

var camelChartContainer = document.createElement("div");
var camelLink = document.createElement("a");
camelLink.target = "_blank";
camelLink.href = "https://" + country + ".camelcamelcamel.com/product/" + asin;
var camelChart = new Image(600, 250);
camelChart.src = "https://charts.camelcamelcamel.com/" + country + "/" + asin + "/amazon-new-used.png?force=1&zero=0&w=600&h=250&desired=false&legend=1&ilt=1&tp=all&fo=0";
camelLink.appendChild(camelChart);
camelChartContainer.appendChild(camelLink);

var keepaChartContainer = document.createElement("div");
var keepaLink = document.createElement("a");
keepaLink.target = "_blank";
keepaLink.href = "https://keepa.com/#!product/8-" + asin;
var keepaChart = new Image(600, 250);
keepaChart.src = "https://graph.keepa.com/pricehistory.png?used=1&asin=" + asin + "&domain=" + tld;
keepaLink.appendChild(keepaChart);
keepaChartContainer.appendChild(keepaLink);

var chartsContainer = document.createElement("div");
chartsContainer.appendChild(camelChartContainer);
chartsContainer.appendChild(keepaChartContainer);
parentElement.appendChild(chartsContainer);