@@ -2424,7 +2424,7 @@ function getPokemonPopupContent (pokemon) {
24242424 //let content = ' ' ;
24252425
24262426 let pokemonName;
2427- if (pokemon.form !== 0 && pokemon.form !== null ) {
2427+ if (pokemon.form > 0 ) {
24282428 pokemonName = getFormName(pokemon.form) + ' ' + getPokemonName(pokemon.pokemon_id);
24292429 } else {
24302430 pokemonName = getPokemonName(pokemon.pokemon_id);
@@ -2439,15 +2439,13 @@ function getPokemonPopupContent (pokemon) {
24392439 const pkmn = masterfile.pokemon[pokemon.pokemon_id];
24402440 let pokemonTypes = [];
24412441 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());
24512449 }
24522450 }
24532451 }
@@ -2809,7 +2807,7 @@ function getPokestopPopupContent (pokestop) {
28092807 pokestop.time_since = getTimeSince(lastUpdatedDate);
28102808 const templateData = getTemplateData('pokestop', pokestop);
28112809 return templateData;
2812-
2810+ /*
28132811 let content = '<div class =" text-center" >';
28142812 if (pokestop.name === null || pokestop.name === '') {
28152813 content += ' <h6><b>Unknown Pokestop Name</b></h6>' ;
@@ -2907,12 +2905,15 @@ function getPokestopPopupContent (pokestop) {
29072905 '</div >' +
29082906 '</div >';
29092907 return content;
2908+ */
29102909}
29112910
29122911function getGymPopupContent (gym) {
29132912 const now = new Date();
29142913 const raidBattleDate = new Date(gym.raid_battle_timestamp * 1000);
29152914 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);
29162917
29172918 const isRaid = raidEndDate >= now && parseInt(gym.raid_level) > 0;
29182919 const isRaidBattle = raidBattleDate <= now && isRaid;
@@ -2976,6 +2977,10 @@ function getGymPopupContent (gym) {
29762977 gym.guarding_pokemon_name = getPokemonName(gym.guarding_pokemon_id);
29772978 gym.team_name = getTeamName(gym.team_id);
29782979 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);
29792984 const templateData = getTemplateData('gym', gym);
29802985 return templateData;
29812986 /*
@@ -3163,45 +3168,11 @@ function getCellPopupContent (cell) {
31633168 cell.time_since = getTimeSince(new Date(cell.updated * 1000));
31643169 const templateData = getTemplateData(' cell' , cell);
31653170 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- */
31773171}
31783172
31793173function getSubmissionTypeCellPopupContent (cell) {
31803174 const templateData = getTemplateData(' submission_cell' , cell);
31813175 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- */
32053176}
32063177
32073178function degreesToCardinal (d) {
@@ -3218,66 +3189,18 @@ function getWeatherPopupContent (weather) {
32183189 weather.time_since = getTimeSince(new Date(weather.updated * 1000));
32193190 const templateData = getTemplateData(' weather' , weather);
32203191 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- */
32473192}
32483193
32493194function getNestPopupContent(nest) {
32503195 nest.pokemon_name = getPokemonName(nest.pokemon_id);
32513196 nest.last_updated = new Date(nest.updated * 1000);
32523197 const templateData = getTemplateData(' nest' , nest);
32533198 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- */
32673199}
32683200
32693201function getScanAreaPopupContent(name, size) {
32703202 const templateData = getTemplateData(' scanarea' , { name, size } );
32713203 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- */
32813204}
32823205
32833206
@@ -3918,17 +3841,6 @@ function getDeviceMarker (device, ts) {
39183841function getDevicePopupContent (device) {
39193842 const data = getTemplateData(' device' , device);
39203843 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- */
39323844}
39333845
39343846function isDeviceOffline (device, ts) {
0 commit comments