CSDN禁止弹窗+允许复制,隐藏页面上一切无用的信息,还你一个干净的CSDN

向csdn宣战

目前為 2024-11-14 提交的版本,檢視 最新版本

// ==UserScript==
// @name       CSDN禁止弹窗+允许复制,隐藏页面上一切无用的信息,还你一个干净的CSDN
// @namespace    http://tampermonkey.net/
// @version      1.0.0.0
// @description  向csdn宣战
// @author       lalaki
// @match        https://*.csdn.net/*
// @icon        https://www.csdn.net/favicon.ico
// @homepage     lalaki.cn
// @license MIT
// @run-at      document-start
// ==/UserScript==
(function () {
    "use strict";
    const style = document.createElement("style");
    style.innerHTML = `.toolbar-container-right{display:none !important}#blog_extension{display:none !important}.body-show-la{opacity: 0;transition:opacity 0.5s ease}.body-show-la.show{opacity:1;}.passport-login-tip-container{display:none!important}#mainBox main{width:100%!important}.recommend-box{display:none!important}#toolbarBox,.hljs-button.signin.active,.article-search-tip,.passport-login-container,.passport-login-box{display:none!important}*{user-select:auto!important}#passportbox,.passport-login-container{pointer-events:none;display:none;position:fixed;top:-99999px!important;left:-9999px!important}.csdn-side-toolbar{display:none!important}#copyright-box{display:none;position:absolute;left:-999px;bottom:-2222px}.blog-footer-bottom{position:fixed;bottom:-9999px}.hljs-button.signin.active.blog-footer-bottom{display:none !important}`;
    document.head.prepend(style);
    const script = document.createElement("script");
    script.innerHTML = `
window.onload = () => {
	document.body.className += " body-show-la";
	function loopDom(ele) {
		const children = ele.children;
		const computedStyles = window.getComputedStyle(ele);
		if (computedStyles.userSelect === "none") {
			ele.style.userSelect = "auto";
		}
		const className = ele.className + "";
		const id = ele.id;
		if (
			id == "blogColumnPayAdvert" ||
			id == "treeSkill" ||
			id == "toolbarBox" ||
			id == "copyright-box" ||
			className.indexOf("csdn-side-toolbar") != -1 ||
			className.indexOf("more-toolbox-new") != -1 ||
			className.indexOf("blog_container_aside") != -1 ||
			className.indexOf("recommend-box") != -1 ||
			className.indexOf("blog-footer-bottom") != -1 ||
			className.indexOf("hljs-button signin active") != -1
		) {
			ele.remove();
		} else if (className.indexOf("hide-preCode-bt") != -1) {
			ele.click();
		}
		ele.oncontextmenu = "return true";
		ele.oncopy = (event) => {
			const selectedText = window.getSelection().toString();
			event.clipboardData.setData("text/plain", selectedText);
			event.preventDefault();
			return true;
		};
		for (let i = 0; i < children.length; i++) {
			loopDom(children[i]);
		}
	}
	loopDom(document.body);
   let errCount=0;
	const task = setInterval(() => {
		try {
			document.querySelector(".blog-footer-bottom").remove();
			document
				.querySelectorAll(".hljs-button.signin.active")
				.forEach((it) => it.remove());
			document.body.classList.toggle("show");
			clearInterval(task);
		} catch (e) {
        if(errCount>200){
            document.body.classList.toggle("show");
			    clearInterval(task);
        }
       errCount++;
      }
	}, 1);
};`;
    document.head.append(script);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址