diff --git a/code/portal_marker.js b/code/portal_marker.js index 7f208078..c88f78f0 100644 --- a/code/portal_marker.js +++ b/code/portal_marker.js @@ -30,12 +30,9 @@ window.setMarkerStyle = function(marker, selected) { marker.setStyle(styleOptions); - // don't run highlighters if we only have placeholder data - if (marker.options.data.level !== undefined) { - // FIXME? it's inefficient to set the marker style (above), then do it again inside the highlighter - // the highlighter API would need to be changed for this to be improved though. will it be too slow? - highlightPortal(marker); - } + // FIXME? it's inefficient to set the marker style (above), then do it again inside the highlighter + // the highlighter API would need to be changed for this to be improved though. will it be too slow? + highlightPortal(marker); if (selected) { marker.setStyle ({color: COLOR_SELECTED_PORTAL}); diff --git a/plugins/portal-highlighter-forgotten.user.js b/plugins/portal-highlighter-forgotten.user.js index 9fc2cc15..aaa1a150 100644 --- a/plugins/portal-highlighter-forgotten.user.js +++ b/plugins/portal-highlighter-forgotten.user.js @@ -27,19 +27,22 @@ window.plugin.portalHighlighterInactive = function() {}; window.plugin.portalHighlighterInactive.highlight = function(data) { - var daysUnmodified = (new Date().getTime() - data.portal.options.timestamp) / (24*60*60*1000); + if (data.portal.options.timestamp > 0) { - if (daysUnmodified >= 7) { + var daysUnmodified = (new Date().getTime() - data.portal.options.timestamp) / (24*60*60*1000); - var fill_opacity = Math.min(1,((daysUnmodified-7)/24)*.85 + .15); + if (daysUnmodified >= 7) { - var blue = Math.max(0,Math.min(255,Math.round((daysUnmodified-31)/62*255))); + var fill_opacity = Math.min(1,((daysUnmodified-7)/24)*.85 + .15); - var colour = 'rgb(255,0,'+blue+')'; + var blue = Math.max(0,Math.min(255,Math.round((daysUnmodified-31)/62*255))); - var params = {fillColor: colour, fillOpacity: fill_opacity}; + var colour = 'rgb(255,0,'+blue+')'; - data.portal.setStyle(params); + var params = {fillColor: colour, fillOpacity: fill_opacity}; + + data.portal.setStyle(params); + } } } diff --git a/plugins/portal-highlighter-level-color.user.js b/plugins/portal-highlighter-level-color.user.js index 9b8c173c..76572c3f 100644 --- a/plugins/portal-highlighter-level-color.user.js +++ b/plugins/portal-highlighter-level-color.user.js @@ -27,8 +27,10 @@ window.plugin.portalHighlighterPortalsLevelColor = function() {}; window.plugin.portalHighlighterPortalsLevelColor.colorLevel = function(data) { var portal_level = data.portal.options.data.level; - var opacity = .6; - data.portal.setStyle({fillColor: COLORS_LVL[portal_level], fillOpacity: opacity}); + if (portal_level !== undefined) { + var opacity = .6; + data.portal.setStyle({fillColor: COLORS_LVL[portal_level], fillOpacity: opacity}); + } } var setup = function() { diff --git a/plugins/portal-highlighter-missing-resonators.user.js b/plugins/portal-highlighter-missing-resonators.user.js index 2bbf49e7..c3959d4a 100644 --- a/plugins/portal-highlighter-missing-resonators.user.js +++ b/plugins/portal-highlighter-missing-resonators.user.js @@ -30,7 +30,7 @@ window.plugin.portalsMissingResonators.highlight = function(data) { if(data.portal.options.team != TEAM_NONE) { var res_count = data.portal.options.data.resCount; - if(res_count < 8) { + if(res_count !== undefined && res_count < 8) { var fill_opacity = ((8-res_count)/8)*.85 + .15; var color = 'red'; var params = {fillColor: color, fillOpacity: fill_opacity}; diff --git a/plugins/portal-highlighter-needs-recharge.user.js b/plugins/portal-highlighter-needs-recharge.user.js index 7f8a18b8..bdee1253 100644 --- a/plugins/portal-highlighter-needs-recharge.user.js +++ b/plugins/portal-highlighter-needs-recharge.user.js @@ -29,7 +29,7 @@ window.plugin.portalHighlighterNeedsRecharge.highlight = function(data) { var d = data.portal.options.data; var health = d.health; - if(data.portal.options.team != TEAM_NONE && health < 100) { + if(health !== undefined && data.portal.options.team != TEAM_NONE && health < 100) { var color,fill_opacity; if (health > 95) { color = 'yellow'; diff --git a/plugins/show-portal-weakness.user.js b/plugins/show-portal-weakness.user.js index 68592038..494aff8e 100644 --- a/plugins/show-portal-weakness.user.js +++ b/plugins/show-portal-weakness.user.js @@ -27,7 +27,7 @@ window.plugin.portalWeakness = function() {}; window.plugin.portalWeakness.highlightWeakness = function(data) { - if(data.portal.options.team != TEAM_NONE) { + if(data.portal.options.resCount !== undefined && data.portal.options.data.health !== undefined && data.portal.options.team != TEAM_NONE) { var res_count = data.portal.options.data.resCount; var portal_health = data.portal.options.data.health;