Min Quantity Multi Search Path Of Exile

Only show searches with minimum quantity

  1. // ==UserScript==
  2. // @name Min Quantity Multi Search Path Of Exile
  3. // @version 1
  4. // @description Only show searches with minimum quantity
  5. // @author TheBerzzeekr
  6. // @match *://www.pathofexile.com/trade/*
  7. // @grant none
  8. // @namespace https://greasyfork.org/users/294634
  9. // ==/UserScript==
  10.  
  11. var quantityenabled = false;
  12. var minimumQuantity = 10;
  13.  
  14. var results;
  15. function init(){
  16.  
  17. results = document.getElementsByClassName("results")[0];
  18.  
  19. console.log(results);
  20. delete_lowQ();
  21.  
  22. }
  23.  
  24.  
  25. function delete_lowQ(){
  26.  
  27. if(results == null){
  28. results = document.getElementsByClassName("results")[0];
  29. setTimeout(delete_lowQ,1000);
  30. return;
  31. }
  32.  
  33. if(results.childElementCount==0) {setTimeout(delete_lowQ,1000);return;}
  34.  
  35. var child;
  36. var quantity;
  37.  
  38. for(var i=1;i<results.childElementCount;++i){
  39. child = results.children[i];
  40.  
  41. if(child.children[0].childElementCount!=3) continue;
  42.  
  43. if(child.classList.contains("checked")) continue;
  44.  
  45. child.classList.add("checked");
  46.  
  47. checkDIV(child);
  48.  
  49. }
  50.  
  51. setTimeout(delete_lowQ,1000);
  52. }
  53.  
  54. function checkDIV(element){
  55.  
  56. var quantity = element.getElementsByClassName("colourDefault");
  57. if(quantity==null || quantity.length==0) {setTimeout(function(){checkDIV(element);},500);return;}
  58.  
  59. parseQuantity(quantity[0],element);
  60.  
  61. }
  62.  
  63. function parseQuantity(quantity,daddy){
  64.  
  65. var text = quantity.innerHTML;
  66.  
  67. var altext = text.split("/");
  68.  
  69. var q = parseInt(altext[0]);
  70.  
  71. if(q<minimumQuantity) daddy.parentNode.removeChild(daddy);
  72.  
  73. }
  74.  
  75. init();
  76.  
  77.  
  78.  
  79.