From 3532836a4db83da6e0029a48e7b84d44628d4a19 Mon Sep 17 00:00:00 2001 From: kiichan Date: Sat, 25 Apr 2020 06:57:18 -0500 Subject: [PATCH] Add counter, fix null addition to ignored list --- picker.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/picker.html b/picker.html index b7dda38..220d387 100644 --- a/picker.html +++ b/picker.html @@ -56,7 +56,7 @@ - + @@ -74,6 +74,11 @@ function get_ignores () { var ignores = document.getElementById("ignored_pkmn").value; ignored_pkmn = ignores.split("\n").filter(line => line !== "").sort(); + set_count(); + } + + function set_count() { + document.getElementById("count").innerHTML = (pkmn.length-ignored_pkmn.length-picked.filter(t => t).length).toString()+" Pokes left"; } function pickem (id) { @@ -84,6 +89,7 @@ elem.innerHTML = available[ix]; picked[Number(id)] = available[ix] elem.style.color = "white"; + set_count(); } function ignorem (id) { @@ -102,7 +108,7 @@ var elem = document.getElementById(i.toString()); var to_ignore = elem.innerHTML; document.getElementById(i.toString()).innerHTML = ""; - if (!ignored_pkmn.includes(to_ignore)) { + if (!ignored_pkmn.includes(to_ignore) & to_ignore !== "") { ignored_pkmn[ignored_pkmn.length] = to_ignore; } elem.style.color = "white"; @@ -110,6 +116,7 @@ } ignored_pkmn.sort(); document.getElementById("ignored_pkmn").value = ignored_pkmn.join("\n"); + set_count(); } function reset () { @@ -119,6 +126,7 @@ elem.style.color = "white"; picked[i] = null; } + set_count(); } function copy_used() {