@@ -982,21 +982,19 @@ function loadStorage () {
982982 const invasionFilterValue = retrieve ( 'invasion_filter' ) ;
983983 if ( invasionFilterValue === null ) {
984984 const defaultInvasionFilter = { } ;
985- let i ;
986- for ( i = 1 ; i <= 50 ; i ++ ) {
987- if ( defaultInvasionFilter [ 'i' + i ] === undefined ) {
988- defaultInvasionFilter [ 'i' + i ] = { show : true , size : 'normal' } ;
985+ for ( const i of Object . entries ( masterfile . invasions ) ) {
986+ if ( defaultInvasionFilter [ 'i' + i [ 0 ] ] === undefined ) {
987+ defaultInvasionFilter [ 'i' + i [ 0 ] ] = { show : true , size : 'normal' } ;
989988 }
990989 }
991990
992991 store ( 'invasion_filter' , JSON . stringify ( defaultInvasionFilter ) ) ;
993992 invasionFilter = defaultInvasionFilter ;
994993 } else {
995994 invasionFilter = JSON . parse ( invasionFilterValue ) ;
996- let i ;
997- for ( i = 1 ; i <= 50 ; i ++ ) {
998- if ( invasionFilter [ 'i' + i ] === undefined ) {
999- invasionFilter [ 'i' + i ] = { show : true , size : 'normal' } ;
995+ for ( const i of Object . entries ( masterfile . invasions ) ) {
996+ if ( invasionFilter [ 'i' + i [ 0 ] ] === undefined ) {
997+ invasionFilter [ 'i' + i [ 0 ] ] = { show : true , size : 'normal' } ;
1000998 }
1001999 }
10021000 }
@@ -3044,7 +3042,7 @@ const getPvpRanks = (league, pokemon) => {
30443042 if ( showPokemonName ) {
30453043 content += `<td>${ pokemonName } </td>`
30463044 } else {
3047- const img = `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( ranking . pokemon , ranking . form , ranking . evolution , pokemon . gender , pokemon . costume ) } .png " alt="${ pokemonName } " title="${ pokemonName } " height="20">`
3045+ const img = `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( ranking . pokemon , ranking . form , ranking . evolution , pokemon . gender , pokemon . costume ) } " alt="${ pokemonName } " title="${ pokemonName } " height="20">`
30483046 if ( ranking . evolution ) {
30493047 if ( showExperimentalStats && masterfile . pokemon [ ranking . pokemon ] . temp_evolutions [ ranking . evolution ] . unreleased ) {
30503048 content += `<td>*${ img } </td>`
@@ -3282,7 +3280,7 @@ const getPokemonPopupContent = (pokemon) => {
32823280 <h6><b>${ getName ( pokemon ) } ${ getGenderIcon ( pokemon . gender ) } ${ getWeatherIcon ( pokemon ) } </b></h6>
32833281 </div>
32843282 <div class="pokemon-thumbnail-grid${ typeof pokemon . atk_iv === 'number' ? '-iv' : '' } ">
3285- <img class="pokemon-thumbnail" src="${ availableIconStyles [ selectedIconStyle ] . path } /${ pokemonIcon } .png ">
3283+ <img class="pokemon-thumbnail" src="${ availableIconStyles [ selectedIconStyle ] . path } /${ pokemonIcon } ">
32863284 <div class="row text-nowrap" style="margin-left:auto; margin-right:auto;">
32873285 <div class="col">
32883286 ${ popupDetails . pokemon . types ? getTypes ( pokemon ) : '' }
@@ -3548,7 +3546,7 @@ const getPossibleInvasionRewards = pokestop => {
35483546 const makeShadowPokemon = pokemonId => {
35493547 return `
35503548 <div class="invasion-reward">
3551- <img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( pokemonId ) } .png "/>
3549+ <img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( pokemonId ) } "/>
35523550 <img class="invasion-reward-shadow" src="/img/misc/shadow.png"/>
35533551 </div>` ;
35543552 }
@@ -3625,7 +3623,7 @@ function getGymPopupContent (gym) {
36253623 '<div class="col-4">' + // START 1ST COL
36263624 '<div class="row pokemon-popup-image-holder">' ;
36273625 if ( hasRaidBoss ) {
3628- content += `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ pokemonIcon } .png ">` ;
3626+ content += `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ pokemonIcon } ">` ;
36293627 } else {
36303628 content += `<img src="/img/egg/${ gym . raid_level } .png">` ;
36313629 }
@@ -4274,7 +4272,7 @@ function getNestMarker (nest, geojson, ts) {
42744272 iconAnchor : [ 40 / 2 , anchorY ] ,
42754273 popupAnchor : [ 0 , - 8 - anchorY ] ,
42764274 className : 'nest-marker' ,
4277- html : `<div class="marker-image-holder">${ typesIcon } <br><img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( nest . pokemon_id ) } .png "/></div>` ,
4275+ html : `<div class="marker-image-holder">${ typesIcon } <br><img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( nest . pokemon_id ) } "/></div>` ,
42784276 //shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
42794277 //shadowSize: [48, 48]
42804278 } ) ;
@@ -4328,7 +4326,7 @@ function getPokemonMarkerIcon (pokemon, ts) {
43284326 iconAnchor : [ size / 2 , size / 2 ] ,
43294327 popupAnchor : [ 0 , size * - .6 ] ,
43304328 className : 'pokemon-marker' ,
4331- html : `<div class="marker-image-holder"><img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ pokemonIdString } .png " style="` +
4329+ html : `<div class="marker-image-holder"><img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ pokemonIdString } " style="` +
43324330 (
43334331 showPokemonGlow !== false && glowColor !== ''
43344332 ? `filter:drop-shadow(0 0 10px ${ glowColor } )drop-shadow(0 0 10px ${ glowColor } );-webkit-filter:drop-shadow(0 0 10px ${ glowColor } )drop-shadow(0 0 10px ${ glowColor } );`
@@ -4418,7 +4416,7 @@ function getPokestopMarkerIcon (pokestop, ts) {
44184416 //iconUrl = `${availableIconStyles[selectedIconStyle].path}/item/-3.png`;
44194417 iconUrl = '/img/item/-3.png' ;
44204418 if ( info && info . pokemon_id ) {
4421- iconHtml = `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( info . pokemon_id ) } .png " style="bottom: 15px;"/>` ;
4419+ iconHtml = `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( info . pokemon_id ) } " style="bottom: 15px;"/>` ;
44224420 }
44234421 if ( info && info . amount > 1 ) {
44244422 iconHtml += `<div class="amount-holder"><div>${ info . amount } </div></div>` ;
@@ -4438,7 +4436,7 @@ function getPokestopMarkerIcon (pokestop, ts) {
44384436 rewardString += '-' + info . form_id ;
44394437 }
44404438 // TODO: evolution https://github.com/versx/DataParser/issues/10
4441- iconUrl = `${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( info . pokemon_id , info . form_id , 0 , info . gender_id , info . costume_id , info . shiny ) } .png ` ;
4439+ iconUrl = `${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( info . pokemon_id , info . form_id , 0 , info . gender_id , info . costume_id , info . shiny ) } ` ;
44424440 } else if ( id === 8 ) {
44434441 // Pokecoin
44444442 rewardString = 'i-6' ;
@@ -4455,7 +4453,7 @@ function getPokestopMarkerIcon (pokestop, ts) {
44554453 rewardString = 'i-8' ;
44564454 iconUrl = '/img/item/-8.png' ;
44574455 if ( info && info . pokemon_id ) {
4458- iconHtml = `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( info . pokemon_id ) } .png " style="bottom: 15px;"/>` ;
4456+ iconHtml = `<img src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( info . pokemon_id ) } " style="bottom: 15px;"/>` ;
44594457 }
44604458 if ( info && info . amount > 1 ) {
44614459 iconHtml += `<div class="amount-holder"><div>${ info . amount } </div></div>` ;
@@ -4606,7 +4604,7 @@ function getGymMarkerIcon (gym, ts) {
46064604 if ( gym . raid_pokemon_id !== 0 && gym . raid_pokemon_id !== null ) {
46074605 // Raid Boss
46084606 raidSize = getIconSize ( 'raid' , gym . raid_pokemon_id , gym . raid_pokemon_form )
4609- raidIcon = `${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( gym . raid_pokemon_id , gym . raid_pokemon_form , gym . raid_pokemon_evolution , gym . raid_pokemon_gender , gym . raid_pokemon_costume ) } .png ` ;
4607+ raidIcon = `${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( gym . raid_pokemon_id , gym . raid_pokemon_form , gym . raid_pokemon_evolution , gym . raid_pokemon_gender , gym . raid_pokemon_costume ) } ` ;
46104608 } else {
46114609 // Egg
46124610 raidSize = getIconSize ( 'raid' , raidLevel )
@@ -6146,17 +6144,17 @@ function getSize (size) {
61466144}
61476145
61486146function getPokemonIcon ( pokemonId , form = 0 , evolution = 0 , gender = 0 , costume = 0 , shiny = false ) {
6149- const evolutionSuffixes = evolution ? [ '-e ' + evolution , '' ] : [ '' ] ;
6150- const formSuffixes = form ? [ '-f ' + form , '' ] : [ '' ] ;
6151- const costumeSuffixes = costume ? [ '-c ' + costume , '' ] : [ '' ] ;
6152- const genderSuffixes = gender ? [ '-g ' + gender , '' ] : [ '' ] ;
6153- const shinySuffixes = shiny ? [ '-shiny ' , '' ] : [ '' ] ;
6147+ const evolutionSuffixes = evolution ? [ '_e ' + evolution , '' ] : [ '' ] ;
6148+ const formSuffixes = form ? [ '_f ' + form , '' ] : [ '' ] ;
6149+ const costumeSuffixes = costume ? [ '_c ' + costume , '' ] : [ '' ] ;
6150+ const genderSuffixes = gender ? [ '_g ' + gender , '' ] : [ '' ] ;
6151+ const shinySuffixes = shiny ? [ '_s ' , '' ] : [ '' ] ;
61546152 for ( const evolutionSuffix of evolutionSuffixes ) {
61556153 for ( const formSuffix of formSuffixes ) {
61566154 for ( const costumeSuffix of costumeSuffixes ) {
61576155 for ( const genderSuffix of genderSuffixes ) {
61586156 for ( const shinySuffix of shinySuffixes ) {
6159- const result = `${ pokemonId } ${ evolutionSuffix } ${ formSuffix } ${ costumeSuffix } ${ genderSuffix } ${ shinySuffix } ` ;
6157+ const result = `${ pokemonId } ${ evolutionSuffix } ${ formSuffix } ${ costumeSuffix } ${ genderSuffix } ${ shinySuffix } .png ` ;
61606158 if ( availableForms . has ( result ) ) return result ;
61616159 }
61626160 }
@@ -6342,7 +6340,7 @@ function populateImage (row, type, set, meta) {
63426340 case 'img' :
63436341 return `<div class="filter-image-holder"><img class="lazy_load" data-src="/img/${ input . path } "/></div>` ;
63446342 case 'pokemon' :
6345- return `<div class="filter-image-holder"><img class="lazy_load" data-src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( input . pokemonId , input . form ) } .png "/></div>` ;
6343+ return `<div class="filter-image-holder"><img class="lazy_load" data-src="${ availableIconStyles [ selectedIconStyle ] . path } /${ getPokemonIcon ( input . pokemonId , input . form ) } "/></div>` ;
63466344 default :
63476345 return input ;
63486346 }
0 commit comments