allow portal highlighters for placeholder portals - several (e.g. uniques) work just fine
fix several other highlighters to check for required data on portals
This commit is contained in:
		| @@ -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); | ||||
|   } | ||||
|  | ||||
|   if (selected) { | ||||
|     marker.setStyle ({color: COLOR_SELECTED_PORTAL}); | ||||
|   | ||||
| @@ -27,6 +27,8 @@ window.plugin.portalHighlighterInactive = function() {}; | ||||
|  | ||||
| window.plugin.portalHighlighterInactive.highlight = function(data) { | ||||
|  | ||||
|   if (data.portal.options.timestamp > 0) { | ||||
|  | ||||
|     var daysUnmodified = (new Date().getTime() - data.portal.options.timestamp) / (24*60*60*1000); | ||||
|  | ||||
|     if (daysUnmodified >= 7) { | ||||
| @@ -41,6 +43,7 @@ window.plugin.portalHighlighterInactive.highlight = function(data) { | ||||
|  | ||||
|       data.portal.setStyle(params); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -27,8 +27,10 @@ window.plugin.portalHighlighterPortalsLevelColor = function() {}; | ||||
|  | ||||
| window.plugin.portalHighlighterPortalsLevelColor.colorLevel = function(data) { | ||||
|   var portal_level = data.portal.options.data.level; | ||||
|   if (portal_level !== undefined) { | ||||
|     var opacity = .6; | ||||
|     data.portal.setStyle({fillColor: COLORS_LVL[portal_level], fillOpacity: opacity}); | ||||
|   } | ||||
| } | ||||
|  | ||||
| var setup =  function() { | ||||
|   | ||||
| @@ -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}; | ||||
|   | ||||
| @@ -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'; | ||||
|   | ||||
| @@ -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; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user