平时经常从优快云打印博客看,发现一般JS打印优快云博客,出现右边文字显示不全,阅读效果较差。
我在参考了爪洼洼的《打印优快云网页内容》中JS代码基础上增加了页面样式调整,将整个页面内容调整到一个合适的范围打印。
写下这个内容主要是方便以后,自己打印需要。
具体如下:
打印优快云博文内容,将以下js复制放入Chrome开发者选项里边的console,回车即可。
(function(){
$("#side").remove();
$("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
$(".nav_top_2011, #header, #navigator,#toolbarBox").remove();
$(".csdn-side-toolbar,.template-box,.reward-user-box").remove();
$(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box,#dmp_ad_58").remove();
$("aside").remove();
$(".tool-box, .blog-footer-bottom").remove();
$(".more-toolbox.more-toolbox-active, .left-toolbox").remove();
$(".bottom-pub-footer.footer-box pub_fo,.pub-footer-new").remove();
$("main").css('display','content');
$("main").css('float','left');
$("#mainBox").css('width','1048px');
$(".blog-content-box").css('width','1080px');
$("#mainBox").css('margin-left','0px');
$("#mainBox").css('margin-right','0px');
//$("[class='main_father clearfix d-flex justify-content-center']").css("width","1048px");
$(".main_father.clearfix.d-flex.justify-content-center").css("width","1048px");
$("tool-box").remove();
window.print();
})();
但是仍有一个问题没有解决就是如下:
对于较长的博客,仍然需要手动点击“展开阅读全文”。