RedirectMePLS

forum and market redirector

  1. // ==UserScript==
  2. // @name RedirectMePLS
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description forum and market redirector
  6. // @author maybebrill
  7. // @license MIT
  8. // @match *://*.lolz.guru/*
  9. // @match *://*.zelenka.guru/*
  10. // @match *://*.lolz.market/*
  11. // @match *://*.zelenka.market/*
  12. // @match *://*.lolz.live/*
  13. // @match *://*.lzt.market/*
  14. // @run-at document-start
  15. // @grant none
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. const forum = 'lolz.live'; // замените на свою желаемую ссылку, доступные: lolz.live, lolz.guru, zelenka.guru
  22. const market = 'lzt.market'; // замените на свою желаемую ссылку, доступные: lzt.market, lolz.market, zelenka.market
  23.  
  24. const currentUrl = window.location.href;
  25. const url = new URL(currentUrl);
  26. if ((url.hostname.includes('lolz.guru') || url.hostname.includes('zelenka.guru') || url.hostname.includes('lolz.live')) && !url.hostname.includes(forum)) {
  27. const newUrl = new URL(currentUrl);
  28. newUrl.hostname = newUrl.hostname.replace(/lolz\.guru|zelenka\.guru|lolz\.live/, forum);
  29. window.location.replace(newUrl.toString());
  30. }
  31. if ((url.hostname.includes('lolz.market') || url.hostname.includes('zelenka.market') || url.hostname.includes('lzt.market')) && !url.hostname.includes(market)) {
  32. const newUrl = new URL(currentUrl);
  33. newUrl.hostname = newUrl.hostname.replace(/lolz\.market|zelenka\.market|lzt\.market/, market);
  34. window.location.replace(newUrl.toString());
  35. }
  36. })();