From a2b626c3f01f9b6bc50d67e1746745afc4cea8f3 Mon Sep 17 00:00:00 2001 From: Alvaro Gutierrez Perez Date: Tue, 2 Aug 2016 15:51:16 +0200 Subject: [PATCH] When sorting pokemons by ID, allow to subsort them by CP or IV --- js/main.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 10ab923..a089be2 100644 --- a/js/main.js +++ b/js/main.js @@ -387,7 +387,8 @@ var mapView = { sortButtons += '
CP
'; sortButtons += '
IV
'; sortButtons += '
Name
'; - sortButtons += '
ID
'; + sortButtons += '
ID/CP
'; + sortButtons += '
ID/IV
'; sortButtons += '
Time
'; sortButtons += '
Candy
'; sortButtons += ''; @@ -633,7 +634,7 @@ var mapView = { return 0; }); break; - case 'id': + case 'id/cp': sortedPokemon.sort(function(a, b) { if (a.id < b.id) return -1; if (a.id > b.id) return 1; @@ -642,6 +643,15 @@ var mapView = { return 0; }); break; + case 'id/iv': + sortedPokemon.sort(function(a, b) { + if (a.id < b.id) return -1; + if (a.id > b.id) return 1; + if (a.iv > b.iv) return -1; + if (a.iv < b.iv) return 1; + return 0; + }); + break; case 'cp': sortedPokemon.sort(function(a, b) { if (a.cp > b.cp) return -1;