Skip to content

Commit 5196fa1

Browse files
committedNov 28, 2024
Add eventlistener to enable print button
1 parent 768ca4f commit 5196fa1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 

‎web/app.js

+14
Original file line numberDiff line numberDiff line change
@@ -2001,6 +2001,20 @@ const PDFViewerApplication = {
20012001
opts
20022002
);
20032003
}
2004+
window.addEventListener("message", event => {
2005+
const origins = [
2006+
/^http:\/\/localhost:5000.*/,
2007+
/^https:\/\/.*\.herokuapp\.com$/,
2008+
/^https:\/\/.*\.sharinpix\.com$/,
2009+
];
2010+
const originAllowed = origins.some(origin => origin.test(event.origin));
2011+
if (originAllowed && event.data.type === "image-download") {
2012+
const printButton = document.getElementById("printButton");
2013+
const secondaryPrintButton = document.getElementById("secondaryPrint");
2014+
printButton?.classList.remove("hidden");
2015+
secondaryPrintButton?.classList.remove("hidden");
2016+
}
2017+
});
20042018
},
20052019

20062020
bindWindowEvents() {

0 commit comments

Comments
 (0)