漫画台自动去除付费弹窗与阅读屏蔽

漫画台、神漫画、爱优漫等自动去除付费弹窗与阅读屏蔽插件

// ==UserScript==
// @name         漫画台自动去除付费弹窗与阅读屏蔽
// @namespace    https://greasyfork.org/
// @iconURL      http://resource.mhxk.com/manhuatai_pc/static/images/favicon.ico
// @version      1.2
// @description  漫画台、神漫画、爱优漫等自动去除付费弹窗与阅读屏蔽插件
// @author       DreamFly
// @match        http://*.manhuatai.com/*
// @match        https://*.manhuatai.com/*
// @match        http://*.taomanhua.com/*
// @match        https://*.taomanhua.com/*
// @match        http://*.iyouman.com/*
// @match        https://*.iyouman.com/*
// @match        http://*.kaimanhua.com/*
// @match        https://*.kaimanhua.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var search_id = function(id){
        if (id.search('^layui-layer') >= 0)
        {
            return true
        }

        return false
    };

    var search_class = function(className){
        if (className.search('^trans_scroll_page') >= 0){
            return true
        }

        return false
    };


    var loop = function () {
        //当显示付费弹框时再做处理

        let element_ids = [ ]
        let div_ids = document.getElementsByTagName('div')
        if (div_ids){
            for (let i = 0; i < div_ids.length; i++){
                let element = div_ids[i]
                if (element.id){
                    if (search_id(element.id)){
                        element_ids.push(element.id)
                    }
                }
            }
        }

        for (let j in element_ids) {
            let shade = document.getElementById(element_ids[j]);
            if (shade && shade.style.display != 'none') {
                shade.style.display = 'none';
            }
        }

        //处理
        let class_names = []
        let div_classs = document.getElementsByTagName('div')
        if (div_classs){
            for (let i = 0; i < div_classs.length; i++){
                let element = div_classs[i]
                if (element.className){
                    if (search_class(element.className)){
                        class_names.push(element.className)
                    }
                }
            }
        }

        for (let m in class_names) {
            let shades = document.getElementsByClassName(class_names[m]);
            if (shades) {
                for (let i = 0; i < shades.length; i++){
                    let shade = shades[i]
                    shade.className = shade.className.replace('lock','')
                    let child = shade.firstChild
                    if (child.length >= 3){
                        let img_bg = child.childNodes[1]
                        if (img_bg.style.display == 'none' || img_bg.style.display == '') {
                            img_bg.style.display = 'block';
                        }
                    }
                }
            }
        }

    };

    //开启滚动条
    document.body.style.overflow = 'unset';

    //循环执行
    setInterval(loop, 15);
})();