Keepa for Amazon Mobile

Insert Keepa chart into Amazon mobile. Tested on Adguard for Android.

  1. // ==UserScript==
  2. // @name Keepa for Amazon Mobile
  3. // @namespace https://p1kachu.net
  4. // @description Insert Keepa chart into Amazon mobile. Tested on Adguard for Android.
  5. // @author pikatenor
  6. // @version 0.1.0
  7. // @supportURL https://github.com/pikatenor/keepa-mobile
  8. // @include https://www.amazon.tld/dp/*
  9. // @include https://www.amazon.tld/*/dp/*
  10. // @include https://www.amazon.tld/gp/product/*
  11. // @include https://www.amazon.tld/gp/aw/d/*
  12. // @include https://www.amazon.*/dp/*
  13. // @include https://www.amazon.*/*/dp/*
  14. // @include https://www.amazon.*/gp/product/*
  15. // @include https://www.amazon.*/gp/aw/d/*
  16. // @grant GM_info
  17. // ==/UserScript==
  18.  
  19. (function(){
  20.  
  21. const domainIdMap = {
  22. 'com': 1,
  23. 'uk': 2,
  24. 'de': 3,
  25. 'fr': 4,
  26. 'co.jp': 5,
  27. 'ca': 6,
  28. 'in': 10,
  29. }
  30.  
  31. const isMobile = document.documentElement.classList.contains('a-mobile');
  32. const asin = document.getElementById('a')?.value || document.getElementById('twister-plus-asin')?.value; // #a ってマジかよ
  33. const domainId = domainIdMap[document.location.hostname.match('.*\.amazon\.(.*)$')[1]];
  34. const targetElement = document.getElementById('olpLinkWidget_feature_div');
  35.  
  36. if (isMobile && asin && domainId && targetElement) {
  37. targetElement.insertAdjacentHTML(
  38. 'afterend',
  39. `<a href="https://keepa.com/#!product/${domainId}-${asin}"><img style="width:100%; height:100%; margin-bottom:0.5em;" src="https://graph.keepa.com/pricehistory.png?type=2&width=658&height=450&amazon=1&new=1&used=1&salesrank=1&range=365&fba=0&fbm=0&bb=0&ld=1&wd=1&asin=${asin}&domain=${domainId}" id="keepa"></a>`
  40. );
  41. }
  42.  
  43. })();

QingJ © 2025

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