Greasy Fork 支持简体中文。

军团珠宝跳转国服市集

跳转地址劫持

  1. // ==UserScript==
  2. // @name 军团珠宝跳转国服市集
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 跳转地址劫持
  6. // @author Rxdey
  7. // @match https://vilsol.github.io/timeless-jewels/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=github.io
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. const TRAD_URL = 'https://poe.game.qq.com/trade/search';
  16. const transformUrl = (url) => {
  17. let params = url.searchParams;
  18. let query = JSON.parse(decodeURIComponent(params.get('q')));
  19. // 识别不出英文名字类型,直接删除
  20. delete query.query.name;
  21. delete query.query.type;
  22. // 在线状态改成任何
  23. query.query.status.option = 'any';
  24. window.temp_Open(`${TRAD_URL}?q=${encodeURIComponent(JSON.stringify(query))}`);
  25. };
  26. window.temp_Open = window.open;
  27. // 劫持window.open
  28. window.open = (url, tag) => {
  29. // console.log(JSON.stringify(url));
  30. if (!/^https\:\/\/www\.pathofexile\.com\/trade\/search\//.test(url.href)) {
  31. window.temp_Open(url, tag);
  32. return;
  33. }
  34. transformUrl(url);
  35. };
  36.  
  37. })();