From be878ac77eeecacddd7726b66c5b07aa1e6daef2 Mon Sep 17 00:00:00 2001 From: Trygve Date: Fri, 1 Nov 2024 11:54:27 +0100 Subject: [PATCH] =?UTF-8?q?fjerna=20d=C3=B8d=20kode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- registrering.php | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/registrering.php b/registrering.php index 33b1dc5..3628147 100644 --- a/registrering.php +++ b/registrering.php @@ -88,22 +88,16 @@ function register_runner(id) { }) update() - //document.getElementById("search").focus() + document.getElementById("search").focus() }; -function create_rows(csv) { - csv = csv.split('\n') - rows = "#Navn"; - for (i in csv) { - data = csv[i].split(",") - rows += create_row(data[0], data[1], false) - } - return rows -} function filterTable() { var input, filter, table, tr, td, i, txtValue; input = document.getElementById("search"); filter = input.value; table = document.getElementById("runners").getElementsByTagName("tbody")[0]; + if (!table) { + setTimeout(filterTable, 100); + } tr = table.getElementsByTagName("tr"); if (filter == "") { @@ -123,21 +117,15 @@ function filterTable() { } } } -function update_row(id, name, passed) { - row = document.getElementById(id) - row.innerHTML = create_row(id, name, passed) - row.classList.add("bg-success"); -} function update() { const table = document.getElementById("runners"); control = get_control(); - const myRequest = new Request(`table.php?registrering,`+control); - fetch(myRequest) + let request = new Request(`table.php?registrering,`+control); + fetch(request) .then((response) => response.text()) - .then((text) => { - table.innerHTML = text; - }); + .then((text) => {table.innerHTML = text;}) + filterTable() }