From ee08ab2a506d1ea08280279e14cea4c1899de1bf Mon Sep 17 00:00:00 2001 From: Francesco Luzzana Date: Mon, 9 May 2022 01:56:37 +0200 Subject: [PATCH] order and links --- contents.js | 15 ++++++--------- index.html | 4 ++-- style.css | 4 ++-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/contents.js b/contents.js index 8365842..77bba4b 100644 --- a/contents.js +++ b/contents.js @@ -3,7 +3,7 @@ const contributionsList = document.getElementById("contributions"); const pagedjs = document.createElement("script"); pagedjs.src = "https://unpkg.com/pagedjs/dist/paged.polyfill.js"; -pagedjs.id ="printview" +pagedjs.id = "printview"; const printLib = document.getElementById("btn-print"); @@ -13,7 +13,7 @@ window.addEventListener("load", () => { //document.getElementsByTagName("head")[0].appendChild(pagedjs); }); -printLib.addEventListener("click", () =>{ +printLib.addEventListener("click", () => { printViewToggle(); console.log(btnPrint); }); @@ -25,6 +25,7 @@ function fetchContents() { } function populateContributions(contributions) { + contributions.sort((a, b) => a.order - b.order); contributions.forEach((contribution) => { contributionsList.appendChild(createSection(contribution)); }); @@ -46,27 +47,23 @@ function atlasLink() { let groups = atlas.querySelectorAll("g"); for (const group of groups) { let link = document.createElementNS("http://www.w3.org/2000/svg", "a"); - link.setAttributeNS("http://www.w3.org/2000/svg", "href", "#" + group.id); + link.setAttribute("href", "#" + group.id); link.innerHTML = group.innerHTML; group.innerHTML = ""; group.appendChild(link); } } - - function printViewToggle() { - var printview = document.getElementById("printview") + 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"); } -} \ No newline at end of file +} diff --git a/index.html b/index.html index 3035063..6d8116e 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@
- + Caretakers
Erica, Gersande, Kamo
- + diff --git a/style.css b/style.css index 98f9615..a023177 100644 --- a/style.css +++ b/style.css @@ -165,7 +165,7 @@ dd { height: auto; } -#print { +#btn-print { display: inline-block; margin-top: 32px; background: none; @@ -174,7 +174,7 @@ dd { font-size: 1rem; } -#print:hover{ +#btn-print:hover{ cursor: pointer; }