Fuck CSDN

去除CSDN BBS&BLOG&DOWNLOAD&WWW ADP检测/广告/展开全文限制/复制小尾巴/离线网页限制/其它

目前为 2019-01-03 提交的版本。查看 最新版本

// ==UserScript==
// @namespace          Eternal
// @name                   Fuck CSDN
// @version                1.5
// @description          去除CSDN BBS&BLOG&DOWNLOAD&WWW ADP检测/广告/展开全文限制/复制小尾巴/离线网页限制/其它
// @author                 流星暴雨
// @grant                   none
// @match                  *blog.csdn.net/*
// @match                  *bbs.csdn.net/*
// @match                  *download.csdn.net/*
// @match                  *www.csdn.net/*
// @run-at                  document-body
// @homepageURL    https://gf.qytechs.cn/scripts/374950
// @supportURL         https://gf.qytechs.cn/scripts/374950
// ==/UserScript==

(function () {
	'use strict';
	var extension = true; //如为真则开启拓展功能 去除 联系方式/赚零钱/传资源

	var addTimer = function (isTrue, code, time) {
		var i = time == -1 ? undefined : (time ? time : 10000) / 10;
		var mySetInterval = window.setInterval_ ? setInterval_ : setInterval;
		var timer = mySetInterval(function () {
				i--;
				if (i < 0 || eval(isTrue)) {
					clearInterval(timer);
					eval(code);
				}
			}, 10);
	}

	var addRMTimer = function (ele, time, code) {
		addTimer(`$("${ele}").size() > 0`, `
                setTimeout(function () {
                "${code}" && eval("${code}");
                $("${ele}").remove();
			}, 50)`, time)
	}

	var hook = function () {
		window.setInterval_ = setInterval;
		var mysetInterval = function (fun, time) {
			if ((fun + '').match("check-adblock-time")) {
				return null;
			} else {
				return setInterval_(fun, time);
			}
		}
		setInterval = mysetInterval;
		document.body.insertBefore_ = document.body.insertBefore;
		var myinsertBefore = function (ele, box) {
			if (ele.innerHTML.match("ADP") || ele.innerHTML.match("广告")) {
				return document.body;
			} else {
				return document.body.insertBefore_(ele, box);
			}
		};
		document.body.insertBefore = myinsertBefore;
	}

	if (location.host.match("blog")) {
		$(function () {
			$("#article_content").css("height", '');
			$(".hide-article-box").remove();
			$(".fourth_column").remove();
			$(".pulllog-box").remove();
			$(".box-shadow").remove();
			$(".aside-box > div[data-track-click]").parent().remove();
			$(".BAIDU_DUP_fp_wrapper").remove();
			$(".adsbygoogle").parent().remove();
			$("#commentBox").prev().remove();
			$(".recommend-ad-box").remove();
			$("#adContent").remove();
			$("div[id*='kp_box']").remove();

			csdn.copyright && (csdn.copyright.init = function () {});

			$("img[onerror]").remove();

			if (extension) {
				$(".gitChat").remove();
				$(".persion_article").empty();
			}
		});
		addRMTimer(".right-item[class*='ads']");
		addRMTimer("#asideFooter > .aside-box:has('iframe')");
		addRMTimer("div[class*='box-box']:has('iframe'):contains('关闭')");

		hook();
	} else if (location.host.match("bbs")) {
		$(function () {
			$(".post_body > div[scrolling=no]").remove();
			$(".bbs_feed_ad_box").remove();
			$(".post_body > div").remove();
			$(".pulllog-box").remove();
			$("#adContent").remove();
			$("div[id*='kp_box']").remove();

			if (extension) {
				$(".gitChat").remove();
				$(".footer_box").empty();
				$(".footer_box").css("visibility", "hidden");
			}

			addRMTimer(".hide_topic_box", undefined, "$('#bbs_detail_wrap').css('max-height', '')");
		});
	} else if (location.host.match("download")) {
		addTimer("$", `
            $(".check-adblock-bg").parent().remove();
                $(function () {
                    $(".dl_mar").remove();
                    $(".right_bottom").remove();
                    $(".hot_arti_list > div").remove();
					$("#adContent").remove();
					$("#album_detail_wrap > div:not(.dl_more)").remove();
					$(".dl_edu").remove();
					$("div[id*='kp_box']").remove();

					if (extension) {
						$(".gitChat").remove();
						$(".fixed_dl").remove();
					}
				});
			`);

		hook();

		addTimer("document.body.insertBefore_ == undefined", `
        	document.body.insertBefore_ = document.body.insertBefore;
			var myinsertBefore = function (ele, box) {
				if (ele.innerHTML.match("ADP") || ele.innerHTML.match("广告")) {
					return document.body;
				} else {
					return document.body.insertBefore_(ele, box);
				}
			};
			document.body.insertBefore = myinsertBefore;
        `);
	} else if (location.host.match("www")) {
		$(function () {
			$(".banner-ad-box").remove();
			$(".slide-outer").remove();
			$(".indexSuperise").remove();
			$("div[id*='kp_box']").remove();

			addRMTimer("#adContent");

			if (extension) {
				$(".gitChat").remove();
				$(".persion_article").empty();
			}
		});
	}

	console.log("Fuck CSDN!")
})();

QingJ © 2025

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