poe网页市集过滤傻狗标价

过滤傻狗标价 类似=a/b/o 8 divine. =a/b/o 8 divine+ 等压价傻逼弱智

  1. // ==UserScript==
  2. // @license MIT
  3. // @name poe网页市集过滤傻狗标价
  4. // @namespace http://tampermonkey.net/
  5. // @version 2024-01-22
  6. // @description 过滤傻狗标价 类似=a/b/o 8 divine. =a/b/o 8 divine+ 等压价傻逼弱智
  7. // @author You
  8. // @match https://poe.game.qq.com/trade/search/*
  9. // @icon https://poecdn.game.qq.com/protected/image/trade/layout/logo.png?key=aifr8Q9qj0FYhhu8_rrfhw
  10. // @grant unsafeWindow
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. const errList = []
  17.  
  18. var thisXhr;
  19. if(typeof ajax_interceptor_qoweifjqon !== 'undefined' ){
  20. thisXhr = ajax_interceptor_qoweifjqon.originalXHR;
  21. }else{
  22. thisXhr = unsafeWindow.XMLHttpRequest;
  23. }
  24. const origSend = thisXhr.prototype.send;
  25. const origOpen = thisXhr.prototype.open;
  26. thisXhr.prototype.open = function() {
  27. if(arguments[1].match('jp/c/i')){
  28. this.responseType = "blob";
  29. }else{
  30. this.responseType = "";
  31. }
  32. return origOpen.apply(this, arguments)
  33. }
  34. thisXhr.prototype.send = function (...args) {
  35. this.addEventListener('load', () => {
  36. if (this.status === 200) {
  37. customLoad(this, args);
  38. }
  39. });
  40. origSend.apply(this, args);
  41. };
  42.  
  43. const customLoad = (xhr, ...args) => {
  44. const http = new URL(xhr.responseURL);
  45. const req = tryParseJSON(args[0]);
  46. const res = tryParseJSON(xhr.response);
  47. if(http.href.match('api/trade/search')){
  48. errList.length = 0
  49. }
  50. if(http.href.match('api/trade/fetch')){
  51. try{
  52. errList.push(...res.result.filter(a => {
  53. const currency = a.listing.price.currency
  54. if(currency){
  55. const matchReg = new RegExp(".*"+currency+"$","i")
  56. return !a.item.note.match(matchReg)
  57. }else {
  58. return false
  59. }
  60. }))
  61. }catch(e){
  62. console.log(e)
  63. }
  64. setTimeout(() => {
  65. document.querySelectorAll(".resultset .row").forEach( row => {
  66. const dataIdValue = row.getAttribute("data-id");
  67. if(errList.some( e=> e.id == dataIdValue)){
  68. row.classList.add("hidden");
  69.  
  70. }
  71.  
  72. })
  73. const h3Title = document.querySelector(".row.row-total h3").innerText.replace(/过滤.*/g,"")
  74. document.querySelector(".row.row-total h3").innerText = h3Title +" 过滤"+errList.length+"条傻狗标价"
  75. },500)
  76. console.log('errList',errList)
  77. }
  78. // debugger
  79. }
  80.  
  81.  
  82. const tryParseJSON = text => {
  83. let json;
  84. try {
  85. json = JSON.parse(text);
  86. } catch (e) {
  87. if (e instanceof SyntaxError) {
  88. return text;
  89. }
  90. throw e;
  91. }
  92. return json;
  93. };
  94. })();