토끼 광고차단

마나토끼, 뉴토끼, 북토끼 광고차단

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         토끼 광고차단
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  마나토끼, 뉴토끼, 북토끼 광고차단
// @author       You
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';
    // 마나토끼, 뉴토끼, 북토끼 광고차단
    const url = window.location.hostname;
    if (url.includes("newtoki") || url.includes("manatoki") || url.includes("booktoki")) {
        // URL차단은 안됨 브라우저가 스크립트보다 요청하는 속도가 더 빠름
        const blockedKeywordURL = "tokinbtoki"; // 차단할 키워드 URL

        // 숨길 요소들 선택자 정의
        const selectors = [
            "#hd_pop",
            "#id_mbv",
            ".col-15.col-md-9.col-sm-9",
            ".board-tail-banner",
            ".basic-banner",
            "#main-banner-view"
        ];

        // CSS 스타일로 요소 숨기기
        const addStyle = () => {
            const style = document.createElement("style");
            style.textContent = selectors.map(selector => `${selector} { display: none !important; visibility: hidden !important; }`).join("\n");
            (document.head || document.documentElement).appendChild(style);
        };

        // DOM로드 확인
        if (document.head) {
            addStyle(); // DOM렌더링되기 전에 새로운 CSS삽입
        } else {
            document.addEventListener("DOMContentLoaded", addStyle); // 해당 스크립트 파일 실행 시점이 늦는 앱 대비용 코드(잠깐 광고 여백이 보임)
        }

    }
})();