Amazon GET Requests Injector

It injects custom GET requests into amazon

当前为 2021-06-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Amazon GET Requests Injector
  3. // @description It injects custom GET requests into amazon
  4. // @match https://www.amazon.it/*
  5. // @match https://www.amazon.de/*
  6. // @match https://www.amazon.co.uk/*
  7. // @match https://www.amazon.fr/*
  8. // @match https://www.amazon.es/*
  9. // @match https://www.amazon.com/*
  10. // @grant none
  11. // @version 1.0
  12. // @author SH3LL
  13. // @grant GM_xmlhttpRequest
  14. // @namespace https://greasyfork.org/users/762057
  15. // ==/UserScript==
  16.  
  17. function price_filter(){
  18. let min = parseInt(prompt("Price will be filtered starting from:", "0"));
  19. if(!Number.isInteger(min)){window.alert("Your input is not an integer! Request aborted."); return;}
  20. let max = parseInt(prompt("Price will be filtered from "+min+" to: ", "999999"));
  21. if(!Number.isInteger(max)){window.alert("Your input is not an integer! Request aborted."); return;}
  22. window.location.href=window.location.href+"&low-price="+min+"&high-price="+max;
  23. return;
  24. }
  25.  
  26. function discount_filter(){
  27. let min = parseInt(prompt("Discount percentage will be filtered starting from: [0-99]", "0"));
  28. if(!Number.isInteger(min) || min <0 || min> 99){window.alert("Your input is not valid! Input must be between 0 and 99. Request aborted."); return;}
  29. let max = parseInt(prompt("Discount percentage will be filtered from "+min+"% to: ["+min+"-99]", "99"));
  30. if(!Number.isInteger(max) || max < min || max > 100){window.alert("Your input is not valid! Input must be between 0 and 100. The first number must be smaller than the second. Request aborted."); return;}
  31. window.location.href=window.location.href+"&pct-off="+min+"-"+max;
  32. return;
  33. }
  34.  
  35. function main(){
  36. let location;
  37. if(window.location.href.includes("&i=warehouse-deals")){
  38. location="warehouse";
  39. }
  40. let country = (window.location.href).split("www.amazon.")[1].split('/')[0];
  41. let amazon_url="https://www.amazon."+country;
  42. let navbar_hook = document.getElementById('navbar');
  43.  
  44. let mybar = document.createElement("div");
  45. mybar.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  46. if(window.location.href.includes("/s?")){
  47. let title = document.createElement("b");
  48. title.innerText="🔧 Get Requests Injector:"
  49. title.style.color="red";
  50. title.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  51. mybar.append(title);
  52. let oreder_desc_price = document.createElement("a");
  53. oreder_desc_price.innerText="📡 SORT [desc price]"
  54. oreder_desc_price.style.color="green";
  55. oreder_desc_price.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  56. oreder_desc_price.href = window.location.href + "&s=price-desc-rank"
  57. mybar.append(oreder_desc_price);
  58. let oreder_asc_price = document.createElement("a");
  59. oreder_asc_price.innerText="📡 SORT [asc price]"
  60. oreder_asc_price.style.color="green";
  61. oreder_asc_price.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  62. oreder_asc_price.href = window.location.href + "&s=price-asc-rank"
  63. mybar.append(oreder_asc_price);
  64. let sort_latest_arrivals = document.createElement("a");
  65. sort_latest_arrivals.innerText="📡 SORT [latest arrivals]"
  66. sort_latest_arrivals.style.color="green";
  67. sort_latest_arrivals.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  68. sort_latest_arrivals.href = window.location.href + "&s=date-desc-rank"
  69. mybar.append(sort_latest_arrivals);
  70. let filer_price_range = document.createElement("a");
  71. filer_price_range.innerText="📡 FILTER [price range]"
  72. filer_price_range.style.color="green";
  73. filer_price_range.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  74. filer_price_range.onclick = price_filter;
  75. mybar.append(filer_price_range);
  76. let filter_discount_range = document.createElement("a");
  77. filter_discount_range.innerText="📡 FILTER [% discount]"
  78. filter_discount_range.style.color="green";
  79. filter_discount_range.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  80. filter_discount_range.onclick = discount_filter;
  81. mybar.append(filter_discount_range);
  82. }else{
  83. let warning = document.createElement("b");
  84. warning.innerText="⛔ You must be in a search page in order to perform GET requests injection ⛔"
  85. warning.style.color="red";
  86. warning.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  87. mybar.append(warning);
  88. let link_global_search = document.createElement("a");
  89. link_global_search.innerText="🔗 GO to GlobalSearch"
  90. link_global_search.style.color="azure";
  91. link_global_search.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  92. link_global_search.href= amazon_url+"/s?k=.";
  93. mybar.append(link_global_search);
  94. let link_warehouse_search = document.createElement("a");
  95. link_warehouse_search.innerText="🔗 GO to WarehouseSearch"
  96. link_warehouse_search.style.color="azure";
  97. link_warehouse_search.style.padding = "5px 5px 5px 5px"; //top, right, bottom, left
  98. link_warehouse_search.href= amazon_url+"/s?k=.&i=warehouse-deals";
  99. mybar.append(link_warehouse_search);
  100. }
  101. navbar_hook.append(mybar);
  102. }
  103.  
  104. main();