Amazon GET Requests Injector

It injects custom GET requests into amazon

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