Amazon Delta Cart

"has {in,de}creased by $+-#.# +-#.#%", automatically calculated.

  1. // ==UserScript==
  2. // @name Amazon Delta Cart
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1.0
  5. // @description "has {in,de}creased by $+-#.# +-#.#%", automatically calculated.
  6. // @author Steven Bytnar
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
  8. // @include *://*.amazon.tld/gp/*
  9. // @include *://*.amazon.tld/*/gp/*
  10. // @include *://*.amazon.tld/dp/*
  11. // @include *://*.amazon.tld/*/dp/*
  12. // @include *://*.amazon.tld/*/dp/*
  13. // @grant none
  14. // ==/UserScript==
  15. // match http://*/*
  16.  
  17. // v1.1.0: switch from .com to .tld.
  18. // x@include https://*.amazon.tld/*
  19.  
  20.  
  21. (function(){
  22. "use strict";
  23.  
  24. $(document).ready(function(){
  25.  
  26. console.log("Delta Cart activated");
  27. var listitems = $("#cart-important-message-box .a-color-price");
  28.  
  29. var count = 0;
  30. var price = 0.0;
  31. $.each(listitems, function(index, value) {
  32. var val = parseFloat($.text(value).split('$')[1]);
  33. if (count % 2 == 1) {
  34. var diff = val - price;
  35. var diffpct = ((val-price)/price)*100.0;
  36. var color;
  37. var plus = '';
  38. if (diff < 0.0) {
  39. color = 'RED';
  40. } else {
  41. color = 'green';
  42. plus = '+';
  43. }
  44. $(this).parent().parent().css('color', color);
  45. color = "";
  46. value.append(' ' + color + 'by $' + plus + (diff).toFixed(2) + ' or ' + plus + (diffpct).toFixed(2) + '%');
  47. }
  48. count++;
  49. price = val;
  50. //console.log(index + ': ' + $.text(value));
  51. });
  52.  
  53.  
  54. });
  55.  
  56. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址