Remove Mooncell Ads Placeholder

Remove the entire ad area when using an ad blocker

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Remove Mooncell Ads Placeholder
// @name:zh-CN   移除 Mooncell 的广告占位符
// @namespace    https://github.com/EricChen1/remove-mooncell-ads
// @version      0.2
// @description  Remove the entire ad area when using an ad blocker
// @description:zh-CN 使用广告拦截器时,移除(没清理干净的)整块广告区域
// @author       Eric Chen
// @match        https://fgo.wiki/*
// @icon         https://fgo.wiki/favicon.ico
// @license      GPL-3.0
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    let adom = [document.querySelector("#mw-content-text > div.mw-parser-output > div.mp-container-left > div.mp-bbbanner.nomobile"), document.querySelector("#mw-content-text > div.mw-parser-output > div:nth-child(1)"), document.querySelector("#mw-content-text > div.mw-parser-output > div.nomobile"), document.querySelector("#mw-content-text > div.mw-parser-output > div:nth-child(4)")];
    if (document.location.href.includes('%E6%A8%A1%E6%8B%9F%E5%99%A8')) {
        adom[3].remove();
        //底部的占位符暂时没法找到怎么去除
    }
    switch (document.location.href) {
        case 'https://fgo.wiki/w/%E9%A6%96%E9%A1%B5':
            adom[0].remove();
            break;
        case 'https://fgo.wiki/w/%E8%8B%B1%E7%81%B5%E5%9B%BE%E9%89%B4':
        case 'https://fgo.wiki/w/%E7%A4%BC%E8%A3%85%E5%9B%BE%E9%89%B4':
        case 'https://fgo.wiki/w/%E6%8C%87%E4%BB%A4%E7%BA%B9%E7%AB%A0%E5%9B%BE%E9%89%B4':
            adom[1].remove();
            break;
        case 'https://fgo.wiki/w/%E9%9C%80%E8%A6%81%E6%88%91%E5%B8%AE%E4%BD%A0Mooncell%E4%B9%88':
            adom[2].remove();
            break;
        default:
            console.log('该 Mooncell 页面不为首页、任一图鉴页面或其他特殊页面');
            break;
    }
})();