Remove Comic Ads

Remove ads from boylove.cc and manwa.me

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Remove Comic Ads
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  Remove ads from boylove.cc and manwa.me
// @author       You
// @match        https://*boylove.cc/*
// @match        https://*boylove3.cc/*
// @match        https://*manwa.me/*
// @match        https://*manwa.fun/*
// @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:nth-of-type(1)', '.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',
                          '.ifpopup_content', '.ifpopup_div', '.row.stui-pannel', '.blocked_hint_msg_pc', '#index-marquee-block', '.app_download', '.reader-home-swiper', '.reader-home-title-fixed',
                          '#temp_block_01 + div', '#temp_block_02 + div', '#temp_block_03 + div', '#temp_block_04 + div',
                          '.reader-zone-list-view.list.no-hairlines + div', 'iframe', '.guess_mh_list + div'
                          ];

    // 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);
    }

})();