diff --git a/src/routes/api.js b/src/routes/api.js
index 69fa6665..127c01dc 100644
--- a/src/routes/api.js
+++ b/src/routes/api.js
@@ -29,7 +29,6 @@ router.post('/search', async (req, res) => {
router.post('/get_template/:name', async (req, res) => {
const template = req.params.name;
const view = req.body.data;
- view.error = false;
const templateData = await utils.render(template, view);
res.send(templateData);
});
diff --git a/src/views/index-js.mustache b/src/views/index-js.mustache
index 77263b83..f3d872b8 100644
--- a/src/views/index-js.mustache
+++ b/src/views/index-js.mustache
@@ -2424,7 +2424,7 @@ function getPokemonPopupContent (pokemon) {
//let content = '';
let pokemonName;
- if (pokemon.form !== 0 && pokemon.form !== null) {
+ if (pokemon.form > 0) {
pokemonName = getFormName(pokemon.form) + ' ' + getPokemonName(pokemon.pokemon_id);
} else {
pokemonName = getPokemonName(pokemon.pokemon_id);
@@ -2439,15 +2439,13 @@ function getPokemonPopupContent (pokemon) {
const pkmn = masterfile.pokemon[pokemon.pokemon_id];
let pokemonTypes = [];
if (pkmn && pkmn.types && pkmn.types.length > 0) {
- if (pkmn) {
- const types = pkmn.types;
- if (types && types.length > 0) {
- if (types.length === 2) {
- pokemonTypes.push(types[0].toLowerCase());
- pokemonTypes.push(types[1].toLowerCase());
- } else {
- pokemonTypes.push(types[0].toLowerCase());
- }
+ const types = pkmn.types;
+ if (types && types.length > 0) {
+ if (types.length === 2) {
+ pokemonTypes.push(types[0].toLowerCase());
+ pokemonTypes.push(types[1].toLowerCase());
+ } else {
+ pokemonTypes.push(types[0].toLowerCase());
}
}
}
@@ -2809,7 +2807,7 @@ function getPokestopPopupContent (pokestop) {
pokestop.time_since = getTimeSince(lastUpdatedDate);
const templateData = getTemplateData('pokestop', pokestop);
return templateData;
-
+ /*
let content = '
';
if (pokestop.name === null || pokestop.name === '') {
content += '
Unknown Pokestop Name
';
@@ -2907,12 +2905,15 @@ function getPokestopPopupContent (pokestop) {
'' +
'';
return content;
+ */
}
function getGymPopupContent (gym) {
const now = new Date();
const raidBattleDate = new Date(gym.raid_battle_timestamp * 1000);
const raidEndDate = new Date(gym.raid_end_timestamp * 1000);
+ const updatedDate = new Date(gym.updated * 1000);
+ const modifiedDate = new Date(gym.last_modified_timestamp * 1000);
const isRaid = raidEndDate >= now && parseInt(gym.raid_level) > 0;
const isRaidBattle = raidBattleDate <= now && isRaid;
@@ -2976,6 +2977,10 @@ function getGymPopupContent (gym) {
gym.guarding_pokemon_name = getPokemonName(gym.guarding_pokemon_id);
gym.team_name = getTeamName(gym.team_id);
gym.icon_path = availableIconStyles[selectedIconStyle];
+ gym.time_until_battle = getTimeUntill(raidBattleDate);
+ gym.time_until_end = getTimeUntill(raidEndDate);
+ gym.time_since_updated = getTimeSince(updatedDate);
+ gym.time_since_modified = getTimeSince(modifiedDate);
const templateData = getTemplateData('gym', gym);
return templateData;
/*
@@ -3163,45 +3168,11 @@ function getCellPopupContent (cell) {
cell.time_since = getTimeSince(new Date(cell.updated * 1000));
const templateData = getTemplateData('cell', cell);
return templateData;
- /*
- let content = '';
- content += 'Level ' + cell.level + ' S2 Cell
';
- content += 'Id: ' + cell.id + '
';
-
- const updatedDate = new Date(cell.updated * 1000);
-
- content += 'Last Updated: ' + updatedDate.toLocaleTimeString() + ' (' + getTimeSince(updatedDate) + ')';
- content += '';
- return content;
- */
}
function getSubmissionTypeCellPopupContent (cell) {
const templateData = getTemplateData('submission_cell', cell);
return templateData;
- /*
- let content = '';
- content += 'Level ' + cell.level + ' S2 Cell
';
- content += 'Id: ' + cell.id + '
';
- content += 'Total Count: ' + cell.count + '
';
- content += 'Pokestop Count: ' + cell.count_pokestops + '
';
- content += 'Gym Count: ' + cell.count_gyms + '
';
-
- const gymThreshold = [2, 6, 20];
-
- if (cell.count_gyms < 3) {
- content += 'Submissions untill Gym: ' + (gymThreshold[cell.count_gyms] - cell.count);
- } else {
- content += 'Submissions untill Gym: Never';
- }
-
- if ((cell.count === 1 && cell.count_gyms < 1) || (cell.count === 5 && cell.count_gyms < 2) || (cell.count === 19 && cell.count_gyms < 3)) {
- content += '
Next submission will cause a Gym!';
- }
-
- content += '';
- return content;
- */
}
function degreesToCardinal (d) {
@@ -3218,32 +3189,6 @@ function getWeatherPopupContent (weather) {
weather.time_since = getTimeSince(new Date(weather.updated * 1000));
const templateData = getTemplateData('weather', weather);
return templateData;
-
- /*
- let content = '';
- content += '' + weatherName + '
';
- content += 'Boosted Types:
' + weatherType + '
';
- content += 'Cell ID: ' + weather.id + '
';
- content += 'Cell Level: ' + weather.level + '
';
- content += 'Lat: ' + weather.latitude + '
';
- content += 'Lon: ' + weather.longitude + '
';
- content += 'Gameplay Condition: ' + weather.gameplay_condition + '
';
- content += 'Wind Direction: ' + weather.wind_direction + '° (' + degreesToCardinal(weather.wind_direction) + ')
';
- content += 'Cloud Level: ' + weather.cloud_level + '
';
- content += 'Rain Level: ' + weather.rain_level + '
';
- content += 'Wind Level: ' + weather.wind_level + '
';
- content += 'Snow Level: ' + weather.snow_level + '
';
- content += 'Fog Level: ' + weather.fog_level + '
';
- content += 'Special Effects Level: ' + weather.special_effect_level + '
';
- content += 'Severity: ' + weather.severity + '
';
- content += 'Weather Warning: ' + weather.warn_weather + '
';
-
- const updatedDate = new Date(weather.updated * 1000);
-
- content += 'Last Updated: ' + updatedDate.toLocaleTimeString() + ' (' + getTimeSince(updatedDate) + ')';
- content += '';
- return content;
- */
}
function getNestPopupContent(nest) {
@@ -3251,33 +3196,11 @@ function getNestPopupContent(nest) {
nest.last_updated = new Date(nest.updated * 1000);
const templateData = getTemplateData('nest', nest);
return templateData;
- /*
- let content = `
-
- Park: ${nest.name}
- Pokemon: ${pokemonName}
- Average: ${nest.pokemon_avg.toLocaleString()}
- Count: ${nest.pokemon_count.toLocaleString()}
-
- Last Updated: ${lastUpdated.toLocaleString()}
-
- `;
- return content;
- */
}
function getScanAreaPopupContent(name, size) {
const templateData = getTemplateData('scanarea', { name, size });
return templateData;
- /*
- let content = `
-
- Area: ${name}
- Size: ${size} km2
-
- `;
- return content;
- */
}
@@ -3918,17 +3841,6 @@ function getDeviceMarker (device, ts) {
function getDevicePopupContent (device) {
const data = getTemplateData('device', device);
return data;
- /*
- const lastSeenDate = new Date(device.last_seen * 1000);
- const lastSeen = lastSeenDate.toLocaleTimeString() + ' (' + getTimeSince(lastSeenDate) + ')';
- const ts = Math.round((new Date()).getTime() / 1000);
- const isOffline = isDeviceOffline(device, ts);
- const content = '' + device.uuid + '
' +
- 'Instance: ' + device.instance_name + '
' +
- 'Last Seen: ' + lastSeen + '
' +
- 'Status: ' + (isOffline ? 'Offline' : 'Online');
- return content;
- */
}
function isDeviceOffline (device, ts) {
diff --git a/templates/gym.ejs b/templates/gym.ejs
index b93fd714..56d54654 100644
--- a/templates/gym.ejs
+++ b/templates/gym.ejs
@@ -21,13 +21,13 @@
<% if (has_raid_boss && is_raid_battle) { %>
-
<% if (pokemon_types && pokemon_types.length > 0) { %>
+
<% pokemon_types.forEach(function(type) { %>
<% }); %>
+
<% } %>
-
<% } %>
@@ -81,22 +81,38 @@
Team: <%= team_name %>
Slots Available: <%= available_slots %>
- <% if (guarding_pokemon_id) { %>
+ <% if (guarding_pokemon_id > 0) { %>
Guard: <%= guarding_pokemon_name %>
<% } %>
- <% if (total_cp) { %>
+ <% if (total_cp > 0) { %>
Total CP: <%= total_cp.toLocaleString() %>
<% } %>
- <% if (in_battle) { %>
+ <% if (in_battle > 0) { %>
Gym is under attack!
<% } %>
- <% if (ex_raid_eligible) { %>
+ <% if (ex_raid_eligible > 0) { %>
<% } %>
<% } %>
+
+
+ <% if (is_raid && !is_raid_battle) { %>
+ Raid Start: <%= new Date(raid_battle_timestamp * 1000).toLocaleString() %> (<%= time_until_battle %>)
+ <% } %>
+ <% if (is_raid) { %>
+ Raid End: <%= new Date(raid_end_timestamp * 1000).toLocaleString() %> (<%= time_until_end %>)
+ <% } %>
+
+ <% if (updated) { %> %>
+ Last Updated: <%= new Date(updated * 1000).toLocaleString() %> (<%= time_since_updated %>)
+ <% } %>
+ <% if (last_modified_timestamp) { %>
+ Last Modified: <%= new Date(last_modified_timestamp * 1000).toLocaleString() %> (<%= time_since_modified %>)
+ <% } %>
+
diff --git a/templates/pokestop.ejs b/templates/pokestop.ejs
index bb2c3028..58ea3915 100644
--- a/templates/pokestop.ejs
+++ b/templates/pokestop.ejs
@@ -43,8 +43,8 @@
<% } %>
- <% if (last_updated) { %>
- Last Updated: <%= last_updated.toLocaleString() %> (<%= time_since %>)
+ <% if (updated) { %>
+ Last Updated: <%= new Date(updated * 1000).toLocaleString() %> (<%= time_since %>)
<% } %>