Desidime Redirect Removal

Desidime Remove Tracking

目前為 2022-02-21 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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})