Greasy Fork

Free Spanish Press

Remove adBlockers detector for spanish press

目前为 2020-09-28 提交的版本。查看 最新版本

// ==UserScript==
// @name         Free Spanish Press
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Remove adBlockers detector for spanish press
// @author       ALeX Molero
// @match        *://*.elmundo.es/*
// @match        *://*.abc.es/*
// @match        *://*.20minutos.es/*
// @match        *://*.elpais.com/*
// @match        *://*.libertaddigital.com/*
// @grant        none
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// ==/UserScript==

/* jshint esversion: 6 */

(function() {
    'use strict';
    const $ = jQuery;
    const divElement = '.fc-ab-root';
    const timeOut = 100;

    const adblockerDetection = (selector, callback) => {
        if (jQuery(selector).length) {
            callback();
        } else {
            setTimeout(() => {
                adblockerDetection(selector, callback);
            }, timeOut);
        }
    };

    $( document ).ready(() => {
        adblockerDetection(divElement, () => {
            $(divElement).remove();
            $('body').css("overflow", "auto");
        });
    });
})();