Greasy Fork

来自缓存

Greasy Fork is available in English.

Remove Comic Ads

Remove ads from boylove.cc and manwa.me

当前为 2023-05-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         Remove Comic Ads
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Remove ads from boylove.cc and manwa.me
// @author       You
// @match        https://*boylove*.cc/*
// @match        https://*manwa.me/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        GM.addStyle
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const CSS_HIDE = '{ display: none !important;}'
    const CSS_OPACITY_0 = '{ opacity: 0 !important; height: 0px !important;}'

    let selectorsToHide = ['#fake_avivid_waterfall_webpush1', '.a__gs_cy', '.fake_avivid_waterfall_webpush_active_left', '.normal-top', '.ad-area-close', '.ad-area-close ~ div', '.reader-cartoon-chapter iframe',
                           '.reader-book-read-wraper article div:first-child', '.index-banner', '.manga-list:first-of-type', '.manga-list-2:nth-of-type(1)', '.manga-list-title:nth-of-type(1)', '.index-marquee'];

    // use opacity 0 instead of display none since some websites may check the ads divs later
    let selectorsToOpacity = ['.ad-area'];

    addStyle(selectorsToHide, CSS_HIDE);

    addStyle(selectorsToOpacity, CSS_OPACITY_0);

    function addStyle(selectors, style = CSS_HIDE) {
        let str = ``
        if(selectors){
            for (let selector of selectors) {
                str += `${selector} ${style} `;
            }
        }

        console.log(`=======================${str}`)
        GM.addStyle(str);
    }

})();