fdesouche.com popup ad remover

This script remove ad and anti adblock popups on fdesouche.com

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        fdesouche.com popup ad remover
// @namespace   http://userscripts.org/users/useridnumber
// @description This script remove ad and anti adblock popups on fdesouche.com
// @include     http://*.fdesouche.com/*
// @include     http://fdesouche.com/*
// @version     3
// @grant       none
// ==/UserScript==

var removeads = function removeads () {
    var items = {};
    var selects = jQuery("body>div>div>a[target='_blank']");
    selects.each(function (_, e) {
        var pNode = e.parentNode
        while (pNode.parentNode.nodeName === "DIV" && pNode.parentNode.className !== "") {
		pNode = pNode.parentNode;
	}
	pNode.parentNode.removeChild(pNode);
    });
}

removeads();

// Create an observer instance
var observer = new MutationObserver(function( mutations ) {
	mutations.forEach(function( mutation ) {
	var newNodes = mutation.addedNodes; // DOM NodeList
	if( newNodes !== null ) { // If there are new nodes added
		removeads();
		var selects = jQuery("body>div>h1");
		if (selects.length !== 0) {
			var node = selects[0];
			if (node.innerHTML.indexOf("Adblock") !== -1) {
				node = node.parentNode;
				node.style.visibility="hidden";
				document.__fds_popupClassName = node.className + "-bg";
				console.info("CAP:" + document.__fds_popupClassName);
			}
		}
		var selects = jQuery("body>div." + document.__fds_popupClassName);
		if (selects.length !== 0) {
			selects[0].style.visibility="hidden";
		}
	}
	});    
});

// Configuration of the observer:
var config = { 
	attributes: true, 
	childList: true, 
	characterData: true 
};
 
// Pass in the target node, as well as the observer options
observer.observe(document.body, config);