灵光落实 - 6 项
书签脚本
114中文阅读网去广告

书签脚本:屏蔽114中文阅读网顶部广告、底部广告和悬浮广告节点

查看代码 ↗
(function () {
    function stopAD(){
        // 针对 114中文阅读网的
        var tempBody = document.getElementsByTagName('body')[0]
        // 顶部的广告
        var adTopNode = document.getElementById('content')
        var adTop_node1 = adTopNode.firstElementChild.nextElementSibling
        var adTop_node2 = adTop_node1.nextElementSibling.nextElementSibling

        // 底部的广告
        var adBottomNode = document.getElementsByClassName('mb10')
        // 悬浮的广告
        // 记得 script 标签在最后面
        var node1 = tempBody.lastElementChild
        var node2 = node1.previousElementSibling
        
      

        for(var i = 0; i < adBottomNode.length; i++){
            adBottomNode[i].style.display = 'none'
        }

        if(node1 != null && node2 != null){
            tempBody.removeChild(node1)
            tempBody.removeChild(node2)
        }

        if(adTop_node1 != null && adTop_node2 != null){
            if(adTop_node1.outerHTML.indexOf('<script') != -1){
                return
            }
            adTopNode.removeChild(adTop_node1)
            adTopNode.removeChild(adTop_node2)
        } 


    }

    window.addEventListener('onload', function(e){
        stopAD()
    })

    stopAD()

})()

// javascript:(function(){if(window.name){eval(window,name)}else{var s=document.createElement("script");s.type="text/javascript";s.src="https://heycqing.github.io/blog/api/ad_api/114NoAd.js";document.body.insertBefore(s,document.body.firstChild);alert("点击除去😡广告")}})();
书签脚本
手机百度小说去广告

书签脚本:屏蔽手机百度小说广告,实时监听页面高度变化,支持页面广告和底部浮层

查看代码 ↗
(function () {
    function stopAD(){
        // 针对 手机百度小说的广告
        var adNode = document.getElementsByClassName('afd-ad')
        var adBottomNode = document.getElementsByClassName('banner')
        var bottomOperateTop = document.getElementsByClassName('bottomOperateTop')
        for (var i = 0; i < adNode.length; i++) {
            adNode[i].style.display = 'none';
        }
        for (var j = 0; j < adBottomNode.length; j++) {
            adBottomNode[j].style.display = 'none'
        }
        for (var k = 0; k < bottomOperateTop.length; k++) {
            bottomOperateTop[k].style.display = 'none'
        }
    }
    
    var originHeight = document.body.scrollHeight;
    console.log('originHeight', originHeight)
    stopAD()

    window.addEventListener('onload', function(e){
        stopAD()
    })

    // 监听页面高度变化
    window.addEventListener('scroll', function (e) {
        var lastHeight = document.body.scrollHeight
        console.log('lastHeight:', lastHeight)
        if(lastHeight > originHeight){
            originHeight = lastHeight
            stopAD()        
        }
    })

})()

// 使用
// https://heycqing.github.io/blog/api/ad_api/noAD.js
// javascript:(function(){var s = document.createElement('script'); s.type = 'text/javascript'; s.src = 'https://heycqing.github.io/blog/api/ad_api/noAD.js'; document.body.insertBefore(s, document.body.firstChild); alert('点击除去😡广告')})()

// javascript:(function(){if(window.name){eval(window,name)}else{var s=document.createElement("script");s.type="text/javascript";s.src="https://heycqing.github.io/blog/api/ad_api/noAD.js";document.body.insertBefore(s,document.body.firstChild);alert("点击除去😡广告")}})();