|
|
@ -11,12 +11,21 @@ const printLib = document.getElementById("btn-print");
|
|
|
|
window.addEventListener("load", () => {
|
|
|
|
window.addEventListener("load", () => {
|
|
|
|
fetchContents();
|
|
|
|
fetchContents();
|
|
|
|
atlasLink();
|
|
|
|
atlasLink();
|
|
|
|
//document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
printLib.addEventListener("click", () => {
|
|
|
|
printLib.addEventListener("click", () => {
|
|
|
|
printViewToggle();
|
|
|
|
document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
console.log(btnPrint);
|
|
|
|
|
|
|
|
|
|
|
|
// pardon for this is really stupid but it works
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
let sections = [".libretto", ".container", ".content", ".contribution", ".contributions"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const section of sections) {
|
|
|
|
|
|
|
|
for (const el of document.querySelectorAll(section)) {
|
|
|
|
|
|
|
|
el.classList.add("full-height");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 1000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function fetchContents() {
|
|
|
|
function fetchContents() {
|
|
|
@ -57,10 +66,11 @@ function atlasLink() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function createIndexSection(contribution) {
|
|
|
|
function createIndexSection(contribution) {
|
|
|
|
|
|
|
|
if (contribution.audio) {
|
|
|
|
let table = document.createElement("table");
|
|
|
|
let table = document.createElement("table");
|
|
|
|
let title = document.createElement("h4");
|
|
|
|
let title = document.createElement("div");
|
|
|
|
|
|
|
|
title.classList.add("index-title");
|
|
|
|
title.innerHTML = contribution.title;
|
|
|
|
title.innerHTML = contribution.title;
|
|
|
|
if (contribution.audio){
|
|
|
|
|
|
|
|
let tracks = contribution.audio;
|
|
|
|
let tracks = contribution.audio;
|
|
|
|
tracks.forEach((track) => {
|
|
|
|
tracks.forEach((track) => {
|
|
|
|
let row = document.createElement("tr");
|
|
|
|
let row = document.createElement("tr");
|
|
|
@ -73,21 +83,7 @@ function createIndexSection(contribution) {
|
|
|
|
row.appendChild(col2);
|
|
|
|
row.appendChild(col2);
|
|
|
|
table.appendChild(row);
|
|
|
|
table.appendChild(row);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
trackList.appendChild(title);
|
|
|
|
trackList.appendChild(title);
|
|
|
|
trackList.appendChild(table);
|
|
|
|
trackList.appendChild(table);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function printViewToggle() {
|
|
|
|
|
|
|
|
var printview = document.getElementById("printview");
|
|
|
|
|
|
|
|
if (!printview) {
|
|
|
|
|
|
|
|
document.getElementsByTagName("head")[0].appendChild(pagedjs);
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
pagejs.remove();
|
|
|
|
|
|
|
|
console.log("aooooo che cazzo");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|