|
@@ -548,12 +548,18 @@ const model = {
|
|
|
renderPokemon(this.nameSearchResults ?? [], nameSearchResultsTarget);
|
|
|
},
|
|
|
|
|
|
+ resultsToDisplay: 10,
|
|
|
+
|
|
|
+ setResultsToDisplay(count) {
|
|
|
+ colorDisplayElements.output.value = this.resultsToDisplay = clamp(0, count, 100);
|
|
|
+ this.renderColorSearchResults();
|
|
|
+ },
|
|
|
+
|
|
|
renderColorSearchResults() {
|
|
|
- const count = parseInt(colorDisplayElements.resultsToDisplay.value);
|
|
|
const dexNums = new Set();
|
|
|
const toRender = [];
|
|
|
for (const pkmn of this.ranked) {
|
|
|
- if (toRender.length >= count) {
|
|
|
+ if (toRender.length >= this.resultsToDisplay) {
|
|
|
break;
|
|
|
}
|
|
|
if (filterElements.hideNoStart.checked && pkmn.traits.includes("nostart")) {
|
|
@@ -626,16 +632,13 @@ const randomizeTargetColor = () =>
|
|
|
|
|
|
targetColorElements.randomColor.addEventListener("click", randomizeTargetColor);
|
|
|
|
|
|
-colorDisplayElements.resultsToDisplay.addEventListener(
|
|
|
- "input",
|
|
|
- ({ target: { value } }) => {
|
|
|
- colorDisplayElements.output.value = value;
|
|
|
- }
|
|
|
-);
|
|
|
+colorDisplayElements.lessResults.addEventListener("click", () => {
|
|
|
+ model.setResultsToDisplay(model.resultsToDisplay - 10);
|
|
|
+});
|
|
|
|
|
|
-colorDisplayElements.resultsToDisplay.addEventListener("change", () =>
|
|
|
- model.renderColorSearchResults()
|
|
|
-);
|
|
|
+colorDisplayElements.moreResults.addEventListener("click", () => {
|
|
|
+ model.setResultsToDisplay(model.resultsToDisplay + 10);
|
|
|
+});
|
|
|
|
|
|
Array.from(filterElements).forEach(el =>
|
|
|
el.addEventListener("change", () => model.renderColorSearchResults())
|