diff --git a/package.json b/package.json index 7af4a85..ed3c87c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "print-js", "homepage": "http://printjs.crabbly.com", "description": "A tiny javascript library to help printing from the web.", - "version": "1.0.34", + "version": "1.0.35", "main": "dist/print.js", "repository": "https://github.com/crabbly/Print.js", "license": "MIT", diff --git a/src/js/functions.js b/src/js/functions.js index 8f81192..2645297 100644 --- a/src/js/functions.js +++ b/src/js/functions.js @@ -61,6 +61,12 @@ export function loopNodesCollectStyles (elements, params) { for (let n = 0; n < elements.length; n++) { let currentElement = elements[n] + // Check if we are skiping this element + if (params.ignoreElements.indexOf(currentElement.getAttribute('id')) !== -1) { + currentElement.parentNode.removeChild(currentElement) + continue + } + // Form Printing - check if is element Input let tag = currentElement.tagName if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') { diff --git a/src/js/init.js b/src/js/init.js index cb54bca..6bf0bb5 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -33,7 +33,8 @@ export default { htmlData: '', documentTitle: 'Document', targetStyle: null, - targetStyles: null + targetStyles: null, + ignoreElements: [] } // Check if a printable document or object was supplied @@ -70,6 +71,7 @@ export default { params.documentTitle = typeof args.documentTitle !== 'undefined' ? args.documentTitle : params.documentTitle params.targetStyle = typeof args.targetStyle !== 'undefined' ? args.targetStyle : params.targetStyle params.targetStyles = typeof args.targetStyles !== 'undefined' ? args.targetStyles : params.targetStyles + params.ignoreElements = typeof args.ignoreElements !== 'undefined' ? args.ignoreElements : params.ignoreElements break default: throw new Error('Unexpected argument type! Expected "string" or "object", got ' + typeof args)