Added ignoring capabilities
This commit is contained in:
parent
d3daa82725
commit
ccfb32a05b
1 changed files with 97 additions and 29 deletions
92
picker.html
92
picker.html
|
@ -7,44 +7,112 @@
|
|||
tr {
|
||||
height: 30px;
|
||||
}
|
||||
label {
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
textarea {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.main {
|
||||
width:50vw;
|
||||
padding-top:10vw;
|
||||
margin:auto;
|
||||
display:block;
|
||||
}
|
||||
.footer {
|
||||
width:50vw;
|
||||
position: fixed;
|
||||
bottom: 5vh;
|
||||
left: 25vw;
|
||||
}
|
||||
</style>
|
||||
<div style="width:50vw; padding-top:10vw; margin:auto; display:block;">
|
||||
<body>
|
||||
<div class="main">
|
||||
<table>
|
||||
<tr>
|
||||
<td><button onClick="pickem('0')">Pick a Poke</button></td><td id="0"></td>
|
||||
<td><button onClick="pickem('0')">Pick a Poke</button></td><td id="0"></td><td><button onClick="ignorem('0')">Add to ignore list</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button onClick="pickem('1')">Pick a Poke</button></td><td id="1"></td>
|
||||
<td><button onClick="pickem('1')">Pick a Poke</button></td><td id="1"></td><td><button onClick="ignorem('1')">Add to ignore list</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button onClick="pickem('2')">Pick a Poke</button></td><td id="2"></td>
|
||||
<td><button onClick="pickem('2')">Pick a Poke</button></td><td id="2"></td><td><button onClick="ignorem('2')">Add to ignore list</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button onClick="pickem('3')">Pick a Poke</button></td><td id="3"></td>
|
||||
<td><button onClick="pickem('3')">Pick a Poke</button></td><td id="3"></td><td><button onClick="ignorem('3')">Add to ignore list</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button onClick="pickem('4')">Pick a Poke</button></td><td id="4"></td>
|
||||
<td><button onClick="pickem('4')">Pick a Poke</button></td><td id="4"></td><td><button onClick="ignorem('4')">Add to ignore list</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button onClick="pickem('5')">Pick a Poke</button></td><td id="5"></td>
|
||||
<td><button onClick="pickem('5')">Pick a Poke</button></td><td id="5"></td><td><button onClick="ignorem('5')">Add to ignore list</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td columnspan="2"><button onClick="reset()">Clear</button></td>
|
||||
<td><button onClick="reset()">Only clear team</button></td><td><button onClick="ignore_team()">Add team to ignore list</button></td><td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<label>Used Pokes</label>
|
||||
<textarea id="ignored_pkmn"></textarea>
|
||||
<button style="display:block; margin:auto;" onClick="copy_used()">Copy Used Pokes</button>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
var pkmn=['Abra', 'Aerodactyl', 'Aipom', 'Alakazam', 'Ampharos', 'Arbok', 'Arcanine', 'Ariados', 'Articuno', 'Azumarill', 'Bayleef', 'Beedrill', 'Bellossom', 'Bellsprout', 'Blastoise', 'Blissey', 'Bulbasaur', 'Butterfree', 'Caterpie', 'Chansey', 'Charizard', 'Charmander', 'Charmeleon', 'Chikorita', 'Chinchou', 'Clefable', 'Clefairy', 'Cleffa', 'Cloyster', 'Corsola', 'Crobat', 'Croconaw', 'Cubone', 'Cyndaquil', 'Delibird', 'Dewgong', 'Diglett', 'Ditto', 'Dodrio', 'Doduo', 'Donphan', 'Dragonair', 'Dragonite', 'Dratini', 'Drowzee', 'Dugtrio', 'Dunsparce', 'Eevee', 'Ekans', 'Electabuzz', 'Electrode', 'Elekid', 'Entei', 'Espeon', 'Exeggcute', 'Exeggutor', "Farfetch'd", 'Fearow', 'Feraligatr', 'Flaaffy', 'Flareon', 'Forretress', 'Furret', 'Gastly', 'Gengar', 'Geodude', 'Girafarig', 'Gligar', 'Gloom', 'Golbat', 'Goldeen', 'Golduck', 'Golem', 'Granbull', 'Graveler', 'Grimer', 'Growlithe', 'Gyarados', 'Haunter', 'Heracross', 'Hitmonchan', 'Hitmonlee', 'Hitmontop', 'Ho-Oh', 'Hoothoot', 'Hoppip', 'Horsea', 'Houndoom', 'Houndour', 'Hypno', 'Igglybuff', 'Ivysaur', 'Jigglypuff', 'Jolteon', 'Jumpluff', 'Jynx', 'Kabuto', 'Kabutops', 'Kadabra', 'Kakuna', 'Kangaskhan', 'Kingdra', 'Kingler', 'Koffing', 'Krabby', 'Lanturn', 'Lapras', 'Larvitar', 'Ledian', 'Ledyba', 'Lickitung', 'Machamp', 'Machoke', 'Machop', 'Magby', 'Magcargo', 'Magikarp', 'Magmar', 'Magnemite', 'Magneton', 'Mankey', 'Mantine', 'Mareep', 'Marill', 'Marowak', 'Meganium', 'Meowth', 'Metapod', 'Miltank', 'Misdreavus', 'Moltres', 'Mr. Mime', 'Muk', 'Murkrow', 'Natu', 'Nidoking', 'Nidoqueen', 'Nidoran-F', 'Nidoran-M', 'Nidorina', 'Nidorino', 'Ninetales', 'Noctowl', 'Octillery', 'Oddish', 'Omanyte', 'Omastar', 'Onix', 'Paras', 'Parasect', 'Persian', 'Phanpy', 'Pichu', 'Pidgeot', 'Pidgeotto', 'Pidgey', 'Pikachu', 'Piloswine', 'Pineco', 'Pinsir', 'Politoed', 'Poliwag', 'Poliwhirl', 'Poliwrath', 'Ponyta', 'Porygon', 'Porygon2', 'Primeape', 'Psyduck', 'Pupitar', 'Quagsire', 'Quilava', 'Qwilfish', 'Raichu', 'Raikou', 'Rapidash', 'Raticate', 'Rattata', 'Remoraid', 'Rhydon', 'Rhyhorn', 'Sandshrew', 'Sandslash', 'Scizor', 'Scyther', 'Seadra', 'Seaking', 'Seel', 'Sentret', 'Shellder', 'Shuckle', 'Skarmory', 'Skiploom', 'Slowbro', 'Slowking', 'Slowpoke', 'Slugma', 'Smeargle', 'Smoochum', 'Sneasel', 'Snorlax', 'Snubbull', 'Spearow', 'Spinarak', 'Squirtle', 'Stantler', 'Starmie', 'Staryu', 'Steelix', 'Sudowoodo', 'Suicune', 'Sunflora', 'Sunkern', 'Swinub', 'Tangela', 'Tauros', 'Teddiursa', 'Tentacool', 'Tentacruel', 'Togepi', 'Togetic', 'Totodile', 'Typhlosion', 'Tyranitar', 'Tyrogue', 'Umbreon', 'Unown', 'Ursaring', 'Vaporeon', 'Venomoth', 'Venonat', 'Venusaur', 'Victreebel', 'Vileplume', 'Voltorb', 'Vulpix', 'Wartortle', 'Weedle', 'Weepinbell', 'Weezing', 'Wigglytuff', 'Wobbuffet', 'Wooper', 'Xatu', 'Yanma', 'Zapdos', 'Zubat'];
|
||||
var len = pkmn.length;
|
||||
var ignored_pkmn=[];
|
||||
|
||||
function get_ignores () {
|
||||
var ignores = document.getElementById("ignored_pkmn").value;
|
||||
ignored_pkmn = ignores.split("\n").filter(line => line !== "").map(line => line.replace(/;|=/g,"")).sort();
|
||||
}
|
||||
|
||||
function pickem (id) {
|
||||
var ix = Math.floor(Math.random()*len);
|
||||
document.getElementById(id).innerHTML = pkmn[ix];
|
||||
var available = pkmn.filter(i => !ignored_pkmn.includes(i));
|
||||
var ix = Math.floor(Math.random()*available.length);
|
||||
var elem = document.getElementById(id);
|
||||
elem.innerHTML = available[ix];
|
||||
elem.style.color = "black";
|
||||
}
|
||||
|
||||
function ignorem (id) {
|
||||
var elem = document.getElementById(id);
|
||||
var to_ignore = elem.innerHTML;
|
||||
if (!ignored_pkmn.includes(to_ignore)) {
|
||||
ignored_pkmn[ignored_pkmn.length] = to_ignore;
|
||||
ignored_pkmn.sort();
|
||||
document.getElementById("ignored_pkmn").value = ignored_pkmn.join("\n");
|
||||
elem.style.color = "red";
|
||||
}
|
||||
}
|
||||
|
||||
function ignore_team () {
|
||||
for (i=0; i<6; i++) {
|
||||
var elem = document.getElementById(i.toString());
|
||||
var to_ignore = elem.innerHTML;
|
||||
document.getElementById(i.toString()).innerHTML = "";
|
||||
if (!ignored_pkmn.includes(to_ignore)) {
|
||||
ignored_pkmn[ignored_pkmn.length] = to_ignore;
|
||||
}
|
||||
elem.style.color = "black";
|
||||
}
|
||||
ignored_pkmn.sort();
|
||||
document.getElementById("ignored_pkmn").value = ignored_pkmn.join("\n");
|
||||
}
|
||||
|
||||
function reset () {
|
||||
for (i=0; i<6; i++) {
|
||||
document.getElementById(i.toString()).innerHTML = "";
|
||||
var elem = document.getElementById(i.toString());
|
||||
elem.innerHTML = "";
|
||||
elem.style.color = "black";
|
||||
}
|
||||
}
|
||||
|
||||
function copy_used() {
|
||||
document.getElementById("ignored_pkmn").select();
|
||||
document.execCommand("copy");
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
|
Reference in a new issue