// ==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.10 // @author Xlbatross // @description 2025. 3. 26. 오후 12:35:46 // @downloadURL none // ==/UserScript== // function function EraseCommercial() { // 나무위키 파워링크 삭제 (class : LBjkIL12, Emxr1Fw8) // 나무위키 상단 이미지 삭제 (class : W-W1lQk) // 나무위키 구글 광고 이미지 삭제 (attribute : data-google-query-id) const elements = document.querySelectorAll('[class*="LBjkIL12"], [class*="Emxr1Fw8"], [class*="W-W1lQk-"], [data-google-query-id]'); if (elements.length > 0) { elements.forEach(element => { element.remove(); }); } } //EraseCommercial(); // MutationObserver 설정 const targetNode = document.body; const config = { childList: true, subtree: true }; const observer = new MutationObserver(mutations => { EraseCommercial(); }); // 초기 로드 시 MutationObserver 연결 observer.observe(targetNode, config); targetNode.addEventListener('keydown', function(event) { if (event.target.closest('input') && event.keyCode === 13) { observer.disconnect(); } }); targetNode.addEventListener('click', function(event) { const anchor = event.target.closest('a[href]'); if (anchor) { observer.disconnect(); } });