Greasy Fork

Greasy Fork is available in English.

游民星空去广告

remove AD. and change some styles !

当前为 2021-01-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         游民星空去广告
// @namespace    http://tampermonkey.net/
// @version      0.41
// @description  remove AD. and change some styles !
// @author       Wenhan
// @match        http://*.gamersky.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 去除黑暗图片背景
    document.body.style.background = '#fff';

    // 监听所有dom变化
    new MutationObserver(function(mutations, observer){
        if(document.querySelector('.onlyOneBgtgs')){
            document.querySelector('.onlyOneBgtgs').remove();
        }

        // 去除主广告
        if(document.querySelector('#ADback')){
            document.querySelector('#ADback').remove();
        }

        // 去除弹窗广告
        if(document.querySelector('#FuGai')){
            document.querySelector('#FuGai').remove();
        }
        if(document.querySelector('#ADcover')){
            document.querySelector('#ADcover').remove();
        }


        // 去除右下提示广告
        if(document.querySelector('#adTips')){
            document.querySelector('#adTips').remove();
        }

        // 去除阴影样式
        if(document.querySelector('.Mid')){
            document.querySelector(".Mid").style.boxShadow = 'none';
        }

    }).observe(document.querySelector("body"), {childList: true, subtree: true});

})();