// ==UserScript== // @name CSDN增强 // @namespace xyz_xyz-CSDN%e5%a2%9e%e5%bc%ba // @version 1.0.0 // @description 免关注查看csdn文章;可以屏蔽掉csdn的广告;免登录复制 // @author xyz_xyz // @match https://*.csdn.net/* // @icon https://g.csdnimg.cn/static/logo/favicon32.ico // @grant none // ==/UserScript== (function () { 'use strict'; function modifyArticle() { const article = document.querySelector('.article_content.clearfix:not([data-fixed])'); if (article) { article.style.height = 'auto'; article.setAttribute('data-fixed', 'true'); console.log('已修改 article_content 样式'); } const mask = document.querySelector('.hide-article-box.hide-article-pos.text-center'); if (mask) { mask.remove(); console.log('已删除遮罩层'); } } function updateButtons() { document.querySelectorAll('pre.hljs div.hljs-button:not([data-fixed])').forEach(div => { div.outerHTML = '
'; console.log('已修复 hljs 复制按钮'); }); document.querySelectorAll('pre.prettyprint div.hljs-button:not([data-fixed])').forEach(div => { div.outerHTML = ''; console.log('已修复 prettyprint 复制按钮'); }); } function hideIframes() { document.querySelectorAll('iframe:not([data-fixed])').forEach(iframe => { iframe.style.display = 'none'; iframe.setAttribute('data-fixed', 'true'); console.log('已隐藏 iframe'); }); } function main() { modifyArticle(); updateButtons(); hideIframes(); } window.addEventListener('load', main); const observer = new MutationObserver(main); observer.observe(document.body, { childList: true, subtree: true }); })();