打印CSDN、博客园文章

感谢作者,转载自CSDN 打印CSDN、博客园文章
网页右键->检查元素->console中执行

(function(){
	'use strict';
	var articleBox = $("div.article_content");
	articleBox.removeAttr("style");
	$("#btn-readmore").parent().remove();
	$("#side").remove();
	$("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
	$(".nav_top_2011, #header, #navigator").remove();
	$(".csdn-side-toolbar,.template-box,.reward-user-box").remove();
	$(".p4course_target, .recommend-box, #csdn-toolbar, #tool-box,#dmp_ad_58, .more-toolbox, .article-info-box, .btn-readmore").remove();
	$("aside").remove();
	$(".tool-box").remove();
	$(".hide-article-box").remove();
	$("main").css('display','content'); 
	$("main").css('float','left'); 
	$("#mainBox").css('width','100%');		
	$(".main_father.clearfix.d-flex.justify-content-center").css("width","100%");
	window.print();
})();

打印博客园

(function(){
	'use strict';
	$("#comment_form, #header, #leftmenu, #big_banner, #footer, #blog_post_info_block").remove();
	$("#content").css('margin','0');
	$("body").css('margin','0').css('padding','2px');
	window.print();
})();
posted @ 2021-01-15 23:16  晒网达人  阅读(248)  评论(0)    收藏  举报