// ==UserScript== // @name 有道云笔记无广告 // @namespace noteyoudaonoad // @homepage https://zhengkai.blog.csdn.net/ // @version 20250222.4 // @description 删除指定的广告组件 , 适用于: ✅有道云笔记网页版https://note.youdao.com/ // @author Moshow郑锴 // @license MIT // @match https://note.youdao.com/web/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 观察DOM的变化 const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.addedNodes.length) { // 删除所有匹配选择器的 ad-component 元素 document.querySelectorAll('#flexible-list-left > div:nth-child(2) > div > ad-component').forEach(function(element) { element.remove(); }); // 查找匹配选择器的元素并移除 adListTag class document.querySelectorAll('#file-outer').forEach(function(element) { element.classList.remove('adListTag'); }); } }); }); // 配置观察选项 const config = { childList: true, subtree: true }; // 开始观察body元素 observer.observe(document.body, config); // 在DOM加载完成后执行一次函数 document.addEventListener('DOMContentLoaded', function() { // 删除所有匹配选择器的 ad-component 元素 document.querySelectorAll('#flexible-list-left > div:nth-child(2) > div > ad-component').forEach(function(element) { element.remove(); }); // 查找匹配选择器的元素并移除 adListTag class document.querySelectorAll('#file-outer').forEach(function(element) { element.classList.remove('adListTag'); }); }); })();