From c9eb038d8145b5aecd680932243c3720294be842 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 5 Sep 2022 20:57:23 +0200 Subject: Move input box to top --- static/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'static/index.js') diff --git a/static/index.js b/static/index.js index ca76f1e..1f98336 100644 --- a/static/index.js +++ b/static/index.js @@ -100,12 +100,6 @@ function initialiseList() { var el_item, el; el_list.innerHTML = ""; - for (var i = 0; i < glist.length; i++) { - el_item = createItemElement(glist[i][0], glist[i][1]); - glist[i][2] = el_item; - el_list.appendChild(el_item); - } - el_item = document.createElement("div"); el_item.classList.add("item"); el_item.classList.add("make-new"); @@ -129,6 +123,12 @@ function initialiseList() { el_item.appendChild(el); el_list.appendChild(el_item); + + for (var i = 0; i < glist.length; i++) { + el_item = createItemElement(glist[i][0], glist[i][1]); + glist[i][2] = el_item; + el_list.appendChild(el_item); + } } function submitNewItem(string) { @@ -190,7 +190,7 @@ function insertItem(votes, string) { var el = createItemElement(votes, string); if (i == glist.length) { glist.push([votes, string, el]); - el_list.insertBefore(el, document.querySelector(".item.make-new")); + el_list.appendChild(el); } else { var refel = glist[i][2]; glist.splice(i, 0, [votes, string, el]); -- cgit v1.2.3-70-g09d2