// ==UserScript==
// @name Amazon Camel Graph Revived/Fixed
// @version 1.0.14
// @description Add CamelCamelCamel graph + link to Amazon product pages.
// @namespace null
// @include https://www.amazon.*/*
// @include https://smile.amazon.*/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @downloadURL https://update.greasyfork.icu/scripts/24854/Amazon%20Camel%20Graph%20RevivedFixed.user.js
// @updateURL https://update.greasyfork.icu/scripts/24854/Amazon%20Camel%20Graph%20RevivedFixed.meta.js
// ==/UserScript==
var width = GM_getValue("width", 400);
var height = GM_getValue("height", 250);
var maxwidth = GM_getValue("maxwidth", 400);
var chart = GM_getValue("chart", "amazon-new-used"); //Possible other values are "amazon", "new", "used", "new-used", & "amazon-new-used"
var arr = document.domain.split(".");
var country = arr[arr.length - 1];
if (country=="com") {country = "us";}
var element = $(':input[id="ASIN"]');
var asin = $.trim(element.attr("value"));
if (asin=="") {
element = $(':input[id="ASIN"]');
asin = $.trim(element.attr("value"));
}
var link2 = "
";
var camelurl = 'https://' + country + '.camelcamelcamel.com/product/' + asin;
GM_xmlhttpRequest({
method: 'GET',
url: camelurl,
onload: function(response) {
var parser = new DOMParser ();
var responseDoc = parser.parseFromString (response.responseText, "text/html");
var chartpost = 0;
/* if (chart=="amazon"||chart=="amazon-new"||chart=="amazon-new-used"||chart=="amazon-used"){
if (!responseDoc.getElementById('price_type_1').disabled) {
$("#averageCustomerReviews_feature_div").append("