CSDN打印网页去除广告和纠正网页偏移问题
针对网上流行的方法要么不能真正的去除广告,要么是去除广告后使得网页产生偏移,造成打印内容不全。
下边这种方法能够很好的解决上述问题。使用方法是在谷歌或者其他浏览器上,找到控制台,并把下面的代码添加进去按enter键即可完成。简单高效。
(function(){
var e = $('.hide-article-box');
if(e.length > 0){
ok = true;
e.remove();
$('#article_content').removeAttr('style');
}
$("#side").remove();
$("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
$(".nav_top_2011, #header, #navigator").remove();
$(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box").remove();
$("aside").remove();
$(".tool-box").remove();
$("main").css('display','content');
$("main").css('float','left');
$("main").css('width','1000px');
$("main").css('margin-left','-400px');
$(".csdn-side-toolbar").remove();
$(".kp_box_58").remove();
$("#dmp_ad_58").remove();
$(".template-box").remove();
$(".light-box").remove();
$(".indexSuperise").remove();
$(".postTime").remove();
window.print();
})();