Tracking Redirect Nuker

Decode encoded URLs in links and replace them with the decoded URL

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Tracking Redirect Nuker
// @namespace    http://tampermonkey.net/
// @version      0.2.2
// @description  Decode encoded URLs in links and replace them with the decoded URL
// @author       yodaluca23
// @license      GNU GPLv3
// @match        *://*/*
// @exclude      *://*.indeed.com/*
// @exclude      *://indeed.com/*
// @grant        none
// ==/UserScript==
     
(function() {
    'use strict';

    function decodeAndReplaceLinks() {
        const links = document.querySelectorAll('a');
        links.forEach(link => {
            const href = link.getAttribute('href');
            const encodedIndexHttps = href.indexOf('https%3A%2F%2F');
            const encodedIndexHttp = href.indexOf('http%3A%2F%2F');
            if (encodedIndexHttps !== -1 || encodedIndexHttp !== -1) {
                const encodedPart = href.substring(Math.max(encodedIndexHttps, encodedIndexHttp));
                const decodedPart = decodeURIComponent(encodedPart);
                link.setAttribute('href', decodedPart);
            }
        });
    }

    // Run once when the page loads
    decodeAndReplaceLinks();

    // Run every time a change is detected on the page
    const observer = new MutationObserver(decodeAndReplaceLinks);
    observer.observe(document.body, { subtree: true, childList: true });
})();