Block gojo2.xyz Redirects (All Pages) - Ultra Safe

Blocks redirects on gojo2.xyz without property overrides

目前为 2025-03-22 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Block gojo2.xyz Redirects (All Pages) - Ultra Safe
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.7
  5. // @description Blocks redirects on gojo2.xyz without property overrides
  6. // @author You
  7. // @match https://gojo2.xyz/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. console.log("Script injected at document-start on", window.location.href);
  17.  
  18. // Block navigation early
  19. window.addEventListener('beforeunload', function(e) {
  20. console.log("Navigation attempt detected to:", window.location.href);
  21. e.preventDefault();
  22. e.returnValue = '';
  23. }, { capture: true });
  24.  
  25. // Block setTimeout/setInterval without redefining
  26. const originalSetTimeout = window.setTimeout;
  27. window.setTimeout = function(fn, delay) {
  28. if (typeof fn === 'function') {
  29. const fnStr = fn.toString();
  30. if (fnStr.includes('location') || fnStr.includes('redirect') || fnStr.includes('href')) {
  31. console.log("Blocked setTimeout redirect attempt:", fnStr);
  32. return null;
  33. }
  34. }
  35. return originalSetTimeout(fn, delay);
  36. };
  37.  
  38. const originalSetInterval = window.setInterval;
  39. window.setInterval = function(fn, delay) {
  40. if (typeof fn === 'function') {
  41. const fnStr = fn.toString();
  42. if (fnStr.includes('location') || fnStr.includes('redirect') || fnStr.includes('href')) {
  43. console.log("Blocked setInterval redirect attempt:", fnStr);
  44. return null;
  45. }
  46. }
  47. return originalSetInterval(fn, delay);
  48. };
  49.  
  50. // Block meta refresh and scripts
  51. const observer = new MutationObserver(function(mutations) {
  52. mutations.forEach(function(mutation) {
  53. // Meta tags
  54. const metaTags = document.querySelectorAll('meta[http-equiv="refresh"]');
  55. metaTags.forEach(tag => {
  56. console.log("Found meta refresh tag:", tag.content);
  57. tag.remove();
  58. console.log("Removed meta refresh tag");
  59. });
  60. // Scripts
  61. const scripts = document.querySelectorAll('script');
  62. scripts.forEach(script => {
  63. if (script.textContent.includes('location') || script.textContent.includes('redirect') || script.textContent.includes('href')) {
  64. console.log("Blocked script with redirect potential:", script.textContent.slice(0, 50) + "...");
  65. script.remove();
  66. }
  67. });
  68. });
  69. });
  70. observer.observe(document.documentElement, { childList: true, subtree: true });
  71. console.log("Mutation observer started at document-start");
  72.  
  73. console.log("Redirect blocker fully active on", window.location.href);
  74. })();