From f9bfc8ad86ff69149b5ac204fcd593826cd0e5e2 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 22 Nov 2023 20:22:16 +0100 Subject: [PATCH] load printThis from node_modules --- libraries/printThis.js | 335 ---------------------- package-lock.json | 33 +++ package.json | 1 + src/public/app/services/library_loader.js | 2 +- src/public/app/widgets/note_detail.js | 9 +- src/routes/assets.js | 4 + 6 files changed, 44 insertions(+), 340 deletions(-) delete mode 100755 libraries/printThis.js diff --git a/libraries/printThis.js b/libraries/printThis.js deleted file mode 100755 index cb8076f4e..000000000 --- a/libraries/printThis.js +++ /dev/null @@ -1,335 +0,0 @@ -/* - * printThis v1.15.0 - * @desc Printing plug-in for jQuery - * @author Jason Day - * - * Resources (based on): - * - jPrintArea: http://plugins.jquery.com/project/jPrintArea - * - jqPrint: https://github.com/permanenttourist/jquery.jqprint - * - Ben Nadal: http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm - * - * Licensed under the MIT licence: - * http://www.opensource.org/licenses/mit-license.php - * - * (c) Jason Day 2015-2018 - * - * Usage: - * - * $("#mySelector").printThis({ - * debug: false, // show the iframe for debugging - * importCSS: true, // import parent page css - * importStyle: false, // import style tags - * printContainer: true, // grab outer container as well as the contents of the selector - * loadCSS: "path/to/my.css", // path to additional css file - use an array [] for multiple - * pageTitle: "", // add title to print page - * removeInline: false, // remove all inline styles from print elements - * removeInlineSelector: "body *", // custom selectors to filter inline styles. removeInline must be true - * printDelay: 333, // variable print delay - * header: null, // prefix to html - * footer: null, // postfix to html - * base: false, // preserve the BASE tag, or accept a string for the URL - * formValues: true, // preserve input/form values - * canvas: false, // copy canvas elements - * doctypeString: '...', // enter a different doctype for older markup - * removeScripts: false, // remove script tags from print content - * copyTagClasses: false // copy classes from the html & body tag - * beforePrintEvent: null, // callback function for printEvent in iframe - * beforePrint: null, // function called before iframe is filled - * afterPrint: null // function called before iframe is removed - * }); - * - * Notes: - * - the loadCSS will load additional CSS (with or without @media print) into the iframe, adjusting layout - */ -; -(function($) { - - function appendContent($el, content) { - if (!content) return; - - // Simple test for a jQuery element - $el.append(content.jquery ? content.clone() : content); - } - - function appendBody($body, $element, opt) { - // Clone for safety and convenience - // Calls clone(withDataAndEvents = true) to copy form values. - var $content = $element.clone(opt.formValues); - - if (opt.formValues) { - // Copy original select and textarea values to their cloned counterpart - // Makes up for inability to clone select and textarea values with clone(true) - copyValues($element, $content, 'select, textarea'); - } - - if (opt.removeScripts) { - $content.find('script').remove(); - } - - if (opt.printContainer) { - // grab $.selector as container - $content.appendTo($body); - } else { - // otherwise just print interior elements of container - $content.each(function() { - $(this).children().appendTo($body) - }); - } - } - - // Copies values from origin to clone for passed in elementSelector - function copyValues(origin, clone, elementSelector) { - var $originalElements = origin.find(elementSelector); - - clone.find(elementSelector).each(function(index, item) { - $(item).val($originalElements.eq(index).val()); - }); - } - - var opt; - $.fn.printThis = function(options) { - opt = $.extend({}, $.fn.printThis.defaults, options); - var $element = this instanceof jQuery ? this : $(this); - - var strFrameName = "printThis-" + (new Date()).getTime(); - - if (window.location.hostname !== document.domain && navigator.userAgent.match(/msie/i)) { - // Ugly IE hacks due to IE not inheriting document.domain from parent - // checks if document.domain is set by comparing the host name against document.domain - var iframeSrc = "javascript:document.write(\" - - + + +