Desidime Redirect Removal

Desidime Remove Tracking

当前为 2022-02-21 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          Desidime Redirect Removal
// @version       2
// @run-at        document-start
// @description   Desidime Remove Tracking
// @include       https://www.desidime.com/*
// @author        MaskedWarrior
// @license MIT 
// @namespace https://greasyfork.org/users/878597
// @run-at       document-end

// ==/UserScript==

// Checks if page is loaded

function DesiRM(){
	// loads a href which DesiDime has added tracking
	qLinks = document.querySelectorAll("a[href*='links?ref']")
	// loops through each of the a href
	for (var J = qLinks.length - 1; J >= 0; --J) {
		// Get the URL compent (href)
		var oldHref = qLinks[J].getAttribute('href');
		// Get the OriginalURL
		var newHref1 = oldHref.split('&url=')[1];
		// Deocode the URl
		var newHref = decodeURIComponent(newHref1)
		// Change the links
		qLinks[J].setAttribute('href', newHref);
	}
}
function DesiRM2(){
	// loads a href which DesiDime has added tracking
	qLinks = document.querySelectorAll("a[data-href*='links?ref']")
	// loops through each of the a href
	for (var J = qLinks.length - 1; J >= 0; --J) {
		// Get the URL compent (href)
		var oldHref = qLinks[J].getAttribute('data-href');
		// Get the OriginalURL
		var newHref1 = oldHref.split('&url=')[1];
		// Deocode the URl
		var newHref = decodeURIComponent(newHref1)
		// Change the links
		qLinks[J].setAttribute('data-href', newHref);
    qLinks[J].setAttribute('target', '');

	}
}

document.onreadystatechange = () => {
	DesiRM()
  DesiRM2()
  
}
(new MutationObserver((mutations) => {
    let runCheck = false
    for (let mutation of mutations) {
        if (mutation.addedNodes.length || mutation.attributeName === 'href') {
            runCheck = true
            break;
        }
    }
    if (runCheck) {
      DesiRM()
      DesiRM2()
    }
})).observe(document.querySelector('body'), {attributeFilter: ['href'], childList: true, subtree: true})