Skip to content

Commit 2ca9414

Browse files
committed
Add eventlistener to enable print button
1 parent 768ca4f commit 2ca9414

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

web/app.js

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

20062021
bindWindowEvents() {

0 commit comments

Comments
 (0)