// ==UserScript== // @name 搞定设计 || 创客贴 (屏蔽水印、会员小提示),下载PDF格式!!) // @version 0.2 // @icon http://dynamic-image.bear20.com/640x267/uploadImages/2020/289/34/9DTKT3Y2XR06.jpg // @description 搞定设计、创客贴 ,屏蔽水印,会员小提示,下载PDF格式!!(创客贴还不能保存PDF) // @match *://*.gaoding.com/design?id=* // @match *://*.chuangkit.com/design?id=* // @require http://cdn.staticfile.org/jquery/1.8.3/jquery.min.js // @grant none // @namespace http://tampermonkey.net/ // @downloadURL none // ==/UserScript== (function () { (function ($) { "use strict"; // A nice closure for our definitions function getjQueryObject(string) { // Make string a vaild jQuery thing var jqObj = $(""); try { jqObj = $(string) .clone(); } catch (e) { jqObj = $("") .html(string); } return jqObj; } function printFrame(frameWindow, content, options) { // Print the selected window/iframe var def = $.Deferred(); try { frameWindow = frameWindow.contentWindow || frameWindow.contentDocument || frameWindow; var wdoc = frameWindow.document || frameWindow.contentDocument || frameWindow; if(options.doctype) { wdoc.write(options.doctype); } wdoc.write(content); wdoc.close(); var printed = false; var callPrint = function () { if(printed) { return; } // Fix for IE : Allow it to render the iframe frameWindow.focus(); try { // Fix for IE11 - printng the whole page instead of the iframe content if (!frameWindow.document.execCommand('print', false, null)) { // document.execCommand returns false if it failed -http://stackoverflow.com/a/21336448/937891 frameWindow.print(); } // focus body as it is losing focus in iPad and content not getting printed $('body').focus(); } catch (e) { frameWindow.print(); } frameWindow.close(); printed = true; def.resolve(); } // Print once the frame window loads - seems to work for the new-window option but unreliable for the iframe $(frameWindow).on("load", callPrint); // Fallback to printing directly if the frame doesn't fire the load event for whatever reason setTimeout(callPrint, options.timeout); } catch (err) { def.reject(err); } return def; } function printContentInIFrame(content, options) { var $iframe = $(options.iframe + ""); var iframeCount = $iframe.length; if (iframeCount === 0) { // Create a new iFrame if none is given $iframe = $('