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.44
// @description  remove AD. and change some styles !
// @author       Wenhan
// @match        http://*.gamersky.com/
// @match        https://*.gamersky.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // 设定要去除元素的选择器规则
    var queryarr = [
        ".onlyOneBgtgs",
        "#ADback", //主广告
        "#FuGai", //弹窗广告
        "#ADcover", //弹窗广告
        "#adTips" //右下提示广告
    ];

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

    // 监听所有dom变化
    new MutationObserver(function(mutations, observer){

        queryarr.forEach(function(item){
              document.querySelector(item) ? document.querySelector(item).remove() : null;
        })

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

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

})();