|
|
|
@ -5,7 +5,7 @@ const pagedjs = document.createElement("script");
|
|
|
|
|
pagedjs.src = "https://unpkg.com/pagedjs/dist/paged.polyfill.js";
|
|
|
|
|
pagedjs.id ="printview"
|
|
|
|
|
|
|
|
|
|
const printLib = document.getElementById("print");
|
|
|
|
|
const printLib = document.getElementById("btn-print");
|
|
|
|
|
|
|
|
|
|
window.addEventListener("load", () => {
|
|
|
|
|
fetchContents();
|
|
|
|
@ -13,7 +13,10 @@ window.addEventListener("load", () => {
|
|
|
|
|
//document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
printLib.addEventListener("click", () => printViewToggle())
|
|
|
|
|
printLib.addEventListener("click", () =>{
|
|
|
|
|
printViewToggle();
|
|
|
|
|
console.log(btnPrint);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function fetchContents() {
|
|
|
|
|
fetch("https://hub.xpub.nl/soupboat/atlas-api/contributions")
|
|
|
|
@ -57,7 +60,9 @@ function printViewToggle() {
|
|
|
|
|
if (!printview) {
|
|
|
|
|
|
|
|
|
|
document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
|
console.log("first")
|
|
|
|
|
// sto provando sta porcata qui, ma non funzia uguale. quando la pagina si trasforma in pagedjs la variabile del btn non è più definita (????)
|
|
|
|
|
var btnPrint = document.getElementById("btn-print");
|
|
|
|
|
console.log(btnPrint);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//document.getElementsByTagName("head")[0].removeChild(printview);
|
|
|
|
|