Greasy Fork is available in English.

Demonoid remove clutter

Removes VPN ads and donation messages

Per 29-06-2022. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name        Demonoid remove clutter
// @namespace   jxq8p6u6r9wtn2f6617i
// @match       https://demonoid.is/*
// @match       https://www.demonoid.is/*
// @match       https://dnoid.pw/*
// @match       https://www.dnoid.pw/*
// @match       https://dnoid.to/*
// @match       https://www.dnoid.to/*
// @grant       none
// @version     1.0.1
// @description Removes VPN ads and donation messages
// @run-at      document-start
// @inject-into content
// @license     MIT
// ==/UserScript==

(function () {
	"use strict";
	
	const { HTMLUnknownElement } = window;


	function hide(element, state = true) {
		if (element && element.hidden !== state) {
			element.hidden = state;
		}
	}


	function inject(unwrap = (x)=>x, exporter = unwrap) {
		const proxyHandler = new window.Object();
		proxyHandler.apply = exporter(function (write, that, args) {
			if (args[0]?.toLowerCase?.().indexOf?.("<script") === -1) {
				return write.apply(that, args);
			}
		});

		const doc = unwrap(Document.prototype);
		doc.write = new window.Proxy(doc.write, proxyHandler);
	}


	if (typeof globalThis.XPCNativeWrapper === "function") {
		inject(XPCNativeWrapper.unwrap, (f) => exportFunction(f, window));
	} else {
		const script = document.createElement("script");
		script.text = `"use strict";(${inject})();`
		(document.head ?? document.documentElement).prepend(script);
		script.remove();
	}


	hide(document.documentElement);


	window.addEventListener("DOMContentLoaded", () => {
		let selector = ".user_donation_box,#share-buttons,#downloadbox a:first-of-type,#downloadbox br:first-of-type,#rss_feed_link br,#rss_feed_link2 br";

		let adElement = document.evaluate("//*[contains(text(), 'Get VPN')]", document.body, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
		while (adElement && !(adElement instanceof HTMLUnknownElement)) {
			adElement = adElement.parentNode;
		}

		if (adElement) {
			selector += `,${adElement.tagName}`;
			for (const classe of adElement.classList) {
				// Add class selector twice to increase specificity
				selector += `.${classe}.${classe}`;
			}
		}

		const style = document.createElement("style");
		style.textContent = `${selector}{display:none!important;}`;
		document.head.prepend(style);

		hide(document.body.querySelector("td > hr + span")?.closest("tr")); // Sponsored Links box on torrent pages

		const btcNags = document.body.querySelectorAll("a[href^='bitcoin:']");
		for (const nag of btcNags) {
			hide(nag.closest("span, p"));
		}
	});


	window.addEventListener("DOMContentLoaded", hide.bind(null, document.documentElement, false));
})();