btn pagedjs

master
grgr 2 years ago
parent 82b654c85b
commit 72f3eed19f

@ -3,6 +3,9 @@ const contributionsList = document.getElementById("contributions");
const pagedjs = document.createElement("script");
pagedjs.src = "https://unpkg.com/pagedjs/dist/paged.polyfill.js";
pagedjs.id ="printview"
const printLib = document.getElementById("print");
window.addEventListener("load", () => {
fetchContents();
@ -10,6 +13,8 @@ window.addEventListener("load", () => {
//document.getElementsByTagName("head")[0].appendChild(pagedjs);
});
printLib.addEventListener("click", () => printViewToggle())
function fetchContents() {
fetch("https://hub.xpub.nl/soupboat/atlas-api/contributions")
.then((response) => response.json())
@ -44,3 +49,19 @@ function atlasLink() {
group.appendChild(link);
}
}
function printViewToggle() {
var printview = document.getElementById("printview")
if (!printview) {
document.getElementsByTagName("head")[0].appendChild(pagedjs);
console.log("first")
} else {
//document.getElementsByTagName("head")[0].removeChild(printview);
pagejs.remove();
console.log("aooooo che cazzo");
}
}

@ -14,6 +14,7 @@
<body>
<div class="container">
<div class="atlas">
<button id="print">libretto</button>
<svg
width="1000"
height="1000"

@ -69,7 +69,7 @@
.contribution {
border-bottom: none;
overflow: auto;
overflow: hidden;
}

Loading…
Cancel
Save