From 742a51b67454d5c0017fe328897488eb1251eafa Mon Sep 17 00:00:00 2001 From: derped Date: Sun, 18 Apr 2021 11:29:48 +0200 Subject: [PATCH] Fix page duplication when calling init. --- berichtsheft/assets/js/notebook.js | 4 ++-- berichtsheft/index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/berichtsheft/assets/js/notebook.js b/berichtsheft/assets/js/notebook.js index d165731..44a87ee 100644 --- a/berichtsheft/assets/js/notebook.js +++ b/berichtsheft/assets/js/notebook.js @@ -31,13 +31,14 @@ async function init() { [...app.children].forEach(child => app.removeChild(child)) userdata.pages.forEach((e,i) => { - pageAdd(e.type); + pageNew(e.type); populate(i+1); }) } function pageAdd(template) { pageNew(template); + userdata.pages.push(emptyPages[template]); populate(app.children.length); } @@ -46,7 +47,6 @@ function pageNew(template) { node.children[0].id = `Page-${app.children.length+1}`; app.appendChild(node); fixPageCount(); - userdata.pages.push(emptyPages[template]) } function populate(pnum) { diff --git a/berichtsheft/index.html b/berichtsheft/index.html index 5137c47..85ca659 100644 --- a/berichtsheft/index.html +++ b/berichtsheft/index.html @@ -8,7 +8,7 @@ Mein Berichtsheft -
+