Price Variation

Embeds CamelCamelCamel price chart in Amazon

目前為 2016-06-16 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Price Variation
  3. // @namespace PriceVariation
  4. // @description Embeds CamelCamelCamel price chart in Amazon
  5. // @include http://www.amazon.*/*
  6. // @include https://www.amazon.*/*
  7. // @version 20160613
  8. // @grant none
  9. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
  10. // ==/UserScript==
  11.  
  12. var width=500;
  13. var height = 200;
  14. var duration = "1y";
  15.  
  16. $(document).ready(function () {
  17. var element = $(':input[name="ASIN"]');
  18. var arr = document.domain.split(".");
  19. var country = arr[arr.length - 1];
  20. if (country == "com") { var country = "us"; }
  21. if (element) {
  22. var asin = $.trim(element.attr("value"));
  23. var link = "<a target='blank' href='http://"+country+".camelcamelcamel.com/product/" + asin + "'><img src='http://charts.camelcamelcamel.com/"+country+"/" + asin + "/amazon.png?force=1&zero=0&w="+width+"&h="+height+"&desired=false&legend=1&ilt=1&tp=" + duration + "&fo=0' /></a>";
  24. $("#availability").append("<div id='camelcamelcamel' style='margin-top: 0px; margin-left: 0px'>" + link + "</div>");
  25. }
  26. });