|
|
@ -5,7 +5,7 @@ const pagedjs = document.createElement("script");
|
|
|
|
pagedjs.src = "https://unpkg.com/pagedjs/dist/paged.polyfill.js";
|
|
|
|
pagedjs.src = "https://unpkg.com/pagedjs/dist/paged.polyfill.js";
|
|
|
|
pagedjs.id ="printview"
|
|
|
|
pagedjs.id ="printview"
|
|
|
|
|
|
|
|
|
|
|
|
const printLib = document.getElementById("print");
|
|
|
|
const printLib = document.getElementById("btn-print");
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener("load", () => {
|
|
|
|
window.addEventListener("load", () => {
|
|
|
|
fetchContents();
|
|
|
|
fetchContents();
|
|
|
@ -13,7 +13,10 @@ window.addEventListener("load", () => {
|
|
|
|
//document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
//document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
printLib.addEventListener("click", () => printViewToggle())
|
|
|
|
printLib.addEventListener("click", () =>{
|
|
|
|
|
|
|
|
printViewToggle();
|
|
|
|
|
|
|
|
console.log(btnPrint);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function fetchContents() {
|
|
|
|
function fetchContents() {
|
|
|
|
fetch("https://hub.xpub.nl/soupboat/atlas-api/contributions")
|
|
|
|
fetch("https://hub.xpub.nl/soupboat/atlas-api/contributions")
|
|
|
@ -57,7 +60,9 @@ function printViewToggle() {
|
|
|
|
if (!printview) {
|
|
|
|
if (!printview) {
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
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 {
|
|
|
|
} else {
|
|
|
|
//document.getElementsByTagName("head")[0].removeChild(printview);
|
|
|
|
//document.getElementsByTagName("head")[0].removeChild(printview);
|
|
|
|