// ==UserScript== // @name 方便知乎专栏的打印/Facilitate the PDF printing for the zhihu // @namespace http://tampermonkey.net/ // @version 1.0 // @description 使用该脚本可以完整的打印知乎专栏的内容。 // @author Huoleeeeee // @match *://zhuanlan.zhihu.com/* // @require http://code.jquery.com/jquery-1.11.0.min.js // @grant unsafeWindow // @downloadURL none // ==/UserScript== (function() { 'use strict'; var fa=$("body"); var btn=$("
"); var h = $(document).height()-$(window).height(); var json={ "background":"#31e16d", "height":"16px", "padding":"5px", "cursor": "pointer", "top":"300px", "right":"80px", "position": "fixed" }; btn.css(json); //添加按钮 btn.html("打印成pdf"); fa.append(btn); var bodywidth=$("#body").css("width"); var mainwidth=$("#main").css("width"); btn.click(function () { //滑动到底部加载所有图片 //网速不够的话可以调大该时间 $("html,body").animate({ scrollTop: h }, 500); btn.hide(); //滑动完之后再打印 setTimeout(function () { $(".ContentItem-actions").remove(); $(".ColumnPageHeader-Wrapper").remove(); $(".PostIndex-Contributions").remove() $(".Recommendations-Main").remove() $(".Comments-container").remove() window.print(); $(document).scrollTop(0); location.reload(); //网速不够的话可以调大该时间 }, 600); }); })();