fdesouche.com popup ad remover

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

目前為 2016-01-07 提交的版本,檢視 最新版本

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

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

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

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

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