나무위키 광고 삭제

2025. 3. 26. 오후 12:35:46

目前為 2025-03-26 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        나무위키 광고 삭제
// @namespace   Violentmonkey Scripts
// @icon        https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://namu.wiki
// @match       https://namu.wiki/*
// @run-at      document-end
// @grant       none
// @version     1.0
// @author      Xlbatross
// @description 2025. 3. 26. 오후 12:35:46
// ==/UserScript==

const observer = new MutationObserver(mutations => {
    mutations.forEach(() => {
        // 나무위키 파워링크 삭제 (class : LBjkIL12, Emxr1Fw8)
        // 나무위키 상단 이미지 삭제 (class : W-W1lQk)
        // 나무위키 구글 광고 이미지 삭제 (attribute : data-google-query-id)
        document.querySelectorAll('[class*="LBjkIL12"], [class*="Emxr1Fw8"], [class*="W-W1lQk-"], [data-google-query-id]').forEach(element => {
            element.remove();
        });
    });
});
observer.observe(document.body, { childList: true, subtree: true });