{"version":3,"file":"script.js","mappings":"yBAIA,IAAMA,EAAeC,SAASC,iBAAiB,4BAE/CC,OAAOC,OAAOJ,GAAcK,KAAI,SAAAC,GAC5B,IAAMC,EAAcN,SAASO,eAAeF,EAAUG,IACtD,EAA4CC,KAAKC,MAAMJ,EAAYK,QAAQC,OAAnEC,EAAR,EAAQA,eAAgBC,EAAxB,EAAwBA,gBAgBxB,IAAMC,EAAWf,SAASgB,cAAT,WAA2BX,EAAUG,GAArC,0BACjBO,GAAYA,EAASE,iBAAiB,SAAS,SAAAC,GAf/C,IAAsBC,EACZC,EACAC,EAcNH,EAAEI,iBAEFT,GAAkBC,GAlBAK,EAkB+BL,EAjB3CM,EAAcpB,SAASuB,KAAKC,UAC5BH,EAAgBF,GAAqBnB,SAASgB,cAAcG,GAElEnB,SAASuB,KAAKC,UAAY,GAC1BxB,SAASuB,KAAKE,YAAYJ,GAE1BK,OAAOd,QAEPZ,SAASuB,KAAKC,UAAYJ,EAC1BO,SAASC,UAQ2DF,OAAOd,WAG/EN,MAAAA,GAAAA,EAAauB,gBAAgB,iB","sources":["webpack://print-page/./src/script.js"],"sourcesContent":["// import Sass\r\nimport './style.scss';\r\n\r\n// Print Page\r\nconst allPrintPage = document.querySelectorAll('.wp-block-ppb-print-page');\r\n\r\nObject.values(allPrintPage).map(printPage => {\r\n const printPageEl = document.getElementById(printPage.id);\r\n const { isPrintSection, sectionSelector } = JSON.parse(printPageEl.dataset.print);\r\n\r\n function printSection(printAreaSelector) {\r\n const bodyContent = document.body.innerHTML;\r\n const printContents = printAreaSelector && document.querySelector(printAreaSelector);\r\n\r\n document.body.innerHTML = '';\r\n document.body.appendChild(printContents);\r\n\r\n window.print();\r\n\r\n document.body.innerHTML = bodyContent;\r\n location.reload();\r\n }\r\n\r\n // Event fire on print button\r\n const printBtn = document.querySelector(`#${printPage.id} .ppbPrintPage button`);\r\n printBtn && printBtn.addEventListener('click', e => {\r\n e.preventDefault();\r\n\r\n isPrintSection && sectionSelector ? printSection(sectionSelector) : window.print();\r\n });\r\n\r\n printPageEl?.removeAttribute('data-print');\r\n});"],"names":["allPrintPage","document","querySelectorAll","Object","values","map","printPage","printPageEl","getElementById","id","JSON","parse","dataset","print","isPrintSection","sectionSelector","printBtn","querySelector","addEventListener","e","printAreaSelector","bodyContent","printContents","preventDefault","body","innerHTML","appendChild","window","location","reload","removeAttribute"],"sourceRoot":""}