URL Redirect Redirecter

Redirect the Redirected Url

当前为 2023-07-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name URL Redirect Redirecter
  3. // @namespace FaustVXUrlRedirect
  4. // @version 0.1
  5. // @description Redirect the Redirected Url
  6. // @author FaustVX
  7. // @match https://www.curseforge.com/*
  8. // @match https://legacy.curseforge.com/*
  9. // @match https://*.youtube.com/*
  10. // @grant none
  11. // @supportURL https://gist.github.com/FaustVX/0deb00258929a517a6e2796f9020e17c#comments
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. const run = function() {
  16. 'use strict';
  17. const urlSplit = window.location.href.split('/');
  18. const domainName = urlSplit[2].split('.');
  19. if (domainName[1] === "curseforge") {
  20. document.querySelectorAll('a[href*="/linkout?remoteUrl="]').forEach(function (a) {
  21. a.href = decodeURIComponent(decodeURIComponent(a.href.split('/linkout?remoteUrl=')[1]));
  22. });
  23. } else if (domainName[1] === "youtube") {
  24. document.querySelectorAll('a[href*="/redirect"]').forEach(function (a) {
  25. a.href = decodeURIComponent(a.href.split('&q=')[1]);
  26. });
  27. }
  28. };
  29.  
  30. function runWhenReady(callback) {
  31. const tryNow = function() {
  32. try {
  33. callback();
  34. } catch { }
  35. setTimeout(tryNow, 250);
  36. };
  37. tryNow();
  38. }
  39.  
  40. runWhenReady(run);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址