Universal Redirect Anonymity

Replaces all link hrefs with anonredir.replit.app to preserve redirect privacy for the paranoid.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Universal Redirect Anonymity
// @name:es      Anonimato de Redirección Universal
// @name:fr      Anonymat par Redirection Universelle
// @name:zh-CN   通用重定向匿名
// @name:zh-TW   通用重定向匿名化
// @namespace    https://spin.rip/
// @match        *://*/*
// @exclude      *://anonredir.replit.app/*
// @grant        none
// @version      3.0
// @author       Spinfal
// @description  Replaces all link hrefs with anonredir.replit.app to preserve redirect privacy for the paranoid.
// @description:es Reemplaza todos los enlaces externos con redirecciones anonimizadas o agrega noreferrer para mayor privacidad.
// @description:fr Remplace tous les liens externes par des redirections anonymisées ou ajoute noreferrer pour plus de confidentialité.
// @description:zh-CN 将所有外部链接替换为匿名重定向或添加 noreferrer 以提高隐私性。
// @description:zh-TW 將所有外部連結替換為匿名重定向或添加 noreferrer 以提高隱私性。
// @license      AGPL-3.0 License
// @run-at       document-idle
// ==/UserScript==


/*
 * 'true' will use "anonredir.replit.app" which is a basic html, css, and js page that has no server backend. the code is fully open to view by viewing the page source
 * 'false' will NOT use "anonredir.replit.app", but instead will add "noreferrer noopener" to all a tags that this script can find
 *
 * what's the difference?
 * * 'true' ensures more privacy by redirecting from a new page completely unrelated to your previous page, and uses location.replace to prevent the page from being saved in history. it will also try to strip all common url tracking params.
 * * 'false' simply adds "noreferrer noopener", which hides the page you were referred from but doesn't use location.replace and does not remove common url tracking params.
*/
const useExternal = true;
const noreferrerRegex = /noreferrer/;
const skipReplacement = ["javascript:", "mailto:", "tel:"]; // any text here will cause the code to NOT edit a HREF attribute

(function () {
  function processLinks(links) {
    links.forEach(link => {
      const rel = link.rel;
      const href = link.href;

      if (!noreferrerRegex.test(rel)) {
        if (useExternal && !skipReplacement.some((text) => href.includes(text)) && href) {
          link.href = `https://anonredir.replit.app/redir-hop?url=${encodeURIComponent(href)}`;
        } else {
          link.rel = rel ? `${rel} noreferrer noopener` : 'noreferrer noopener';
        }
      }
    });
  }

  window.addEventListener('load', () => {
    // Process initial links
    const initialLinks = Array.from(
      document.querySelectorAll('a:not([rel*="noreferrer"])')
    );
    processLinks(initialLinks);

    // Set up MutationObserver for dynamic content
    const observer = new MutationObserver(mutations => {
      mutations.forEach(mutation => {
        Array.from(mutation.addedNodes).forEach(node => {
          if (node.tagName === 'A' && !noreferrerRegex.test(node.rel)) {
            processLinks([node]);
          }
        });
      });
    });

    observer.observe(document.body, {
      childList: true,
      subtree: true
    });
  }, { once: true });
})();