@@ -2424,7 +2424,7 @@ function getPokemonPopupContent (pokemon) {
2424
2424
//let content = ' ' ;
2425
2425
2426
2426
let pokemonName;
2427
- if (pokemon.form !== 0 && pokemon.form !== null ) {
2427
+ if (pokemon.form > 0 ) {
2428
2428
pokemonName = getFormName(pokemon.form) + ' ' + getPokemonName(pokemon.pokemon_id);
2429
2429
} else {
2430
2430
pokemonName = getPokemonName(pokemon.pokemon_id);
@@ -2439,15 +2439,13 @@ function getPokemonPopupContent (pokemon) {
2439
2439
const pkmn = masterfile.pokemon[pokemon.pokemon_id];
2440
2440
let pokemonTypes = [];
2441
2441
if (pkmn && pkmn.types && pkmn.types.length > 0) {
2442
- if (pkmn) {
2443
- const types = pkmn.types;
2444
- if (types && types.length > 0) {
2445
- if (types.length === 2) {
2446
- pokemonTypes.push(types[0].toLowerCase());
2447
- pokemonTypes.push(types[1].toLowerCase());
2448
- } else {
2449
- pokemonTypes.push(types[0].toLowerCase());
2450
- }
2442
+ const types = pkmn.types;
2443
+ if (types && types.length > 0) {
2444
+ if (types.length === 2) {
2445
+ pokemonTypes.push(types[0].toLowerCase());
2446
+ pokemonTypes.push(types[1].toLowerCase());
2447
+ } else {
2448
+ pokemonTypes.push(types[0].toLowerCase());
2451
2449
}
2452
2450
}
2453
2451
}
@@ -2809,7 +2807,7 @@ function getPokestopPopupContent (pokestop) {
2809
2807
pokestop.time_since = getTimeSince(lastUpdatedDate);
2810
2808
const templateData = getTemplateData('pokestop', pokestop);
2811
2809
return templateData;
2812
-
2810
+ /*
2813
2811
let content = '<div class =" text-center" >';
2814
2812
if (pokestop.name === null || pokestop.name === '') {
2815
2813
content += ' <h6><b>Unknown Pokestop Name</b></h6>' ;
@@ -2907,12 +2905,15 @@ function getPokestopPopupContent (pokestop) {
2907
2905
'</div >' +
2908
2906
'</div >';
2909
2907
return content;
2908
+ */
2910
2909
}
2911
2910
2912
2911
function getGymPopupContent (gym) {
2913
2912
const now = new Date();
2914
2913
const raidBattleDate = new Date(gym.raid_battle_timestamp * 1000);
2915
2914
const raidEndDate = new Date(gym.raid_end_timestamp * 1000);
2915
+ const updatedDate = new Date(gym.updated * 1000);
2916
+ const modifiedDate = new Date(gym.last_modified_timestamp * 1000);
2916
2917
2917
2918
const isRaid = raidEndDate >= now && parseInt(gym.raid_level) > 0;
2918
2919
const isRaidBattle = raidBattleDate <= now && isRaid;
@@ -2976,6 +2977,10 @@ function getGymPopupContent (gym) {
2976
2977
gym.guarding_pokemon_name = getPokemonName(gym.guarding_pokemon_id);
2977
2978
gym.team_name = getTeamName(gym.team_id);
2978
2979
gym.icon_path = availableIconStyles[selectedIconStyle];
2980
+ gym.time_until_battle = getTimeUntill(raidBattleDate);
2981
+ gym.time_until_end = getTimeUntill(raidEndDate);
2982
+ gym.time_since_updated = getTimeSince(updatedDate);
2983
+ gym.time_since_modified = getTimeSince(modifiedDate);
2979
2984
const templateData = getTemplateData('gym', gym);
2980
2985
return templateData;
2981
2986
/*
@@ -3163,45 +3168,11 @@ function getCellPopupContent (cell) {
3163
3168
cell.time_since = getTimeSince(new Date(cell.updated * 1000));
3164
3169
const templateData = getTemplateData(' cell' , cell);
3165
3170
return templateData;
3166
- /*
3167
- let content = ' <center>' ;
3168
- content += ' <h6><b>Level ' + cell.level + ' S2 Cell</b></h6>' ;
3169
- content += ' <b>Id:</b> ' + cell.id + ' <br>' ;
3170
-
3171
- const updatedDate = new Date(cell.updated * 1000);
3172
-
3173
- content += ' <b>Last Updated:</b> ' + updatedDate.toLocaleTimeString() + ' (' + getTimeSince(updatedDate) + ' )' ;
3174
- content += ' </center>' ;
3175
- return content;
3176
- */
3177
3171
}
3178
3172
3179
3173
function getSubmissionTypeCellPopupContent (cell) {
3180
3174
const templateData = getTemplateData(' submission_cell' , cell);
3181
3175
return templateData;
3182
- /*
3183
- let content = ' <center>' ;
3184
- content += ' <h6><b>Level ' + cell.level + ' S2 Cell</b></h6>' ;
3185
- content += ' <b>Id:</b> ' + cell.id + ' <br>' ;
3186
- content += ' <b>Total Count:</b> ' + cell.count + ' <br>' ;
3187
- content += ' <b>Pokestop Count:</b> ' + cell.count_pokestops + ' <br>' ;
3188
- content += ' <b>Gym Count:</b> ' + cell.count_gyms + ' <br>' ;
3189
-
3190
- const gymThreshold = [2, 6, 20];
3191
-
3192
- if (cell.count_gyms < 3) {
3193
- content += ' <b>Submissions untill Gym:</b> ' + (gymThreshold[cell.count_gyms] - cell.count);
3194
- } else {
3195
- content += ' <b>Submissions untill Gym:</b> Never' ;
3196
- }
3197
-
3198
- if ((cell.count === 1 && cell.count_gyms < 1) || (cell.count === 5 && cell.count_gyms < 2) || (cell.count === 19 && cell.count_gyms < 3)) {
3199
- content += ' <br><b>Next submission will cause a Gym!' ;
3200
- }
3201
-
3202
- content += '</center >';
3203
- return content;
3204
- */
3205
3176
}
3206
3177
3207
3178
function degreesToCardinal (d) {
@@ -3218,66 +3189,18 @@ function getWeatherPopupContent (weather) {
3218
3189
weather.time_since = getTimeSince(new Date(weather.updated * 1000));
3219
3190
const templateData = getTemplateData(' weather' , weather);
3220
3191
return templateData;
3221
-
3222
- /*
3223
- let content = ' <center>' ;
3224
- content += ' <h6><b>' + weatherName + ' </b><br></h6>' ;
3225
- content += ' <b>Boosted Types:</b><br>' + weatherType + ' <br>' ;
3226
- content += ' <b>Cell ID:</b> ' + weather.id + ' <br>' ;
3227
- content += ' <b>Cell Level:</b> ' + weather.level + ' <br>' ;
3228
- content += ' <b>Lat:</b> ' + weather.latitude + ' <br>' ;
3229
- content += ' <b>Lon:</b> ' + weather.longitude + ' <br>' ;
3230
- content += ' <b>Gameplay Condition:</b> ' + weather.gameplay_condition + ' <br>' ;
3231
- content += ' <b>Wind Direction:</b> ' + weather.wind_direction + ' ° (' + degreesToCardinal(weather.wind_direction) + ' )<br>' ;
3232
- content += ' <b>Cloud Level:</b> ' + weather.cloud_level + ' <br>' ;
3233
- content += ' <b>Rain Level:</b> ' + weather.rain_level + ' <br>' ;
3234
- content += ' <b>Wind Level:</b> ' + weather.wind_level + ' <br>' ;
3235
- content += ' <b>Snow Level:</b> ' + weather.snow_level + ' <br>' ;
3236
- content += ' <b>Fog Level:</b> ' + weather.fog_level + ' <br>' ;
3237
- content += ' <b>Special Effects Level:</b> ' + weather.special_effect_level + ' <br>' ;
3238
- content += ' <b>Severity:</b> ' + weather.severity + ' <br>' ;
3239
- content += ' <b>Weather Warning:</b> ' + weather.warn_weather + ' <br><br>' ;
3240
-
3241
- const updatedDate = new Date(weather.updated * 1000);
3242
-
3243
- content += ' <b>Last Updated:</b> ' + updatedDate.toLocaleTimeString() + ' (' + getTimeSince(updatedDate) + ' )' ;
3244
- content += ' </center>' ;
3245
- return content;
3246
- */
3247
3192
}
3248
3193
3249
3194
function getNestPopupContent(nest) {
3250
3195
nest.pokemon_name = getPokemonName(nest.pokemon_id);
3251
3196
nest.last_updated = new Date(nest.updated * 1000);
3252
3197
const templateData = getTemplateData(' nest' , nest);
3253
3198
return templateData;
3254
- /*
3255
- let content = `
3256
- < center>
3257
- < h6> Park: < b> ${nest.name} </b ></h6 >
3258
- Pokemon: <b >${ pokemonName} </b ><br >
3259
- Average: <b >${ nest.pokemon_avg.toLocaleString()} </b ><br >
3260
- Count: <b >${ nest.pokemon_count.toLocaleString()} </b ><br >
3261
- <br >
3262
- <small >Last Updated: <b >${ lastUpdated.toLocaleString()} </b ></small ><br >
3263
- </center >
3264
- `;
3265
- return content;
3266
- */
3267
3199
}
3268
3200
3269
3201
function getScanAreaPopupContent(name, size) {
3270
3202
const templateData = getTemplateData(' scanarea' , { name, size } );
3271
3203
return templateData;
3272
- /*
3273
- let content = `
3274
- <center >
3275
- <h6 >Area: <b >${ name} </b ></h6 >
3276
- Size: ${ size} km<sup >2</sup >
3277
- </center >
3278
- `;
3279
- return content;
3280
- */
3281
3204
}
3282
3205
3283
3206
@@ -3918,17 +3841,6 @@ function getDeviceMarker (device, ts) {
3918
3841
function getDevicePopupContent (device) {
3919
3842
const data = getTemplateData(' device' , device);
3920
3843
return data;
3921
- /*
3922
- const lastSeenDate = new Date(device.last_seen * 1000);
3923
- const lastSeen = lastSeenDate.toLocaleTimeString() + ' (' + getTimeSince(lastSeenDate) + ' )' ;
3924
- const ts = Math.round((new Date()).getTime() / 1000);
3925
- const isOffline = isDeviceOffline(device, ts);
3926
- const content = ' <center><h6><b>' + device.uuid + ' </b></h6></center><br>' +
3927
- ' <b>Instance:</b> ' + device.instance_name + ' <br>' +
3928
- ' <b>Last Seen:</b> ' + lastSeen + ' <br>' +
3929
- ' <b>Status:</b> ' + (isOffline ? ' Offline' : ' Online' );
3930
- return content;
3931
- */
3932
3844
}
3933
3845
3934
3846
function isDeviceOffline (device, ts) {
0 commit comments