Add counter, fix null addition to ignored list
This commit is contained in:
parent
5e69828f3a
commit
3532836a4d
1 changed files with 10 additions and 2 deletions
12
picker.html
12
picker.html
|
@ -56,7 +56,7 @@
|
||||||
<td><button onClick="pickem('5')">Pick a Poke</button></td><td id="5"></td><td><button onClick="ignorem('5')">Mark used</button></td>
|
<td><button onClick="pickem('5')">Pick a Poke</button></td><td id="5"></td><td><button onClick="ignorem('5')">Mark used</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td><td><button onClick="reset()">Clear current team</button></td><td><button onClick="ignore_team()">Mark team used</button></td><td></td>
|
<td id="count"></td><td><button onClick="reset()">Clear current team</button></td><td><button onClick="ignore_team()">Mark team used</button></td><td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,6 +74,11 @@
|
||||||
function get_ignores () {
|
function get_ignores () {
|
||||||
var ignores = document.getElementById("ignored_pkmn").value;
|
var ignores = document.getElementById("ignored_pkmn").value;
|
||||||
ignored_pkmn = ignores.split("\n").filter(line => line !== "").sort();
|
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) {
|
function pickem (id) {
|
||||||
|
@ -84,6 +89,7 @@
|
||||||
elem.innerHTML = available[ix];
|
elem.innerHTML = available[ix];
|
||||||
picked[Number(id)] = available[ix]
|
picked[Number(id)] = available[ix]
|
||||||
elem.style.color = "white";
|
elem.style.color = "white";
|
||||||
|
set_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
function ignorem (id) {
|
function ignorem (id) {
|
||||||
|
@ -102,7 +108,7 @@
|
||||||
var elem = document.getElementById(i.toString());
|
var elem = document.getElementById(i.toString());
|
||||||
var to_ignore = elem.innerHTML;
|
var to_ignore = elem.innerHTML;
|
||||||
document.getElementById(i.toString()).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;
|
ignored_pkmn[ignored_pkmn.length] = to_ignore;
|
||||||
}
|
}
|
||||||
elem.style.color = "white";
|
elem.style.color = "white";
|
||||||
|
@ -110,6 +116,7 @@
|
||||||
}
|
}
|
||||||
ignored_pkmn.sort();
|
ignored_pkmn.sort();
|
||||||
document.getElementById("ignored_pkmn").value = ignored_pkmn.join("\n");
|
document.getElementById("ignored_pkmn").value = ignored_pkmn.join("\n");
|
||||||
|
set_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset () {
|
function reset () {
|
||||||
|
@ -119,6 +126,7 @@
|
||||||
elem.style.color = "white";
|
elem.style.color = "white";
|
||||||
picked[i] = null;
|
picked[i] = null;
|
||||||
}
|
}
|
||||||
|
set_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_used() {
|
function copy_used() {
|
||||||
|
|
Reference in a new issue