').attr({class:'portalDetails'}).html(portalDetailedDescription),
+ $('
![]()
').attr({class:'hide', src:img})
+ ),
+
+ modDetails,
+
+ randDetails,
+
+ resoDetails,
+
+ '
' + linkDetails.join('') + '
'
);
- runHooks('portalDetailsUpdated', {portalDetails: d});
+ runHooks('portalDetailsUpdated', {guid: guid, portal: portal, portalDetails: details, portalData: data});
}
+
+
+window.getRandPortalDetails = function(d) {
+
+ var randDetails;
+
+ if (d) {
+
+ // collect some random data that’s not worth to put in an own method
+ var links = {incoming: 0, outgoing: 0};
+ $.each(d.portalV2.linkedEdges||[], function(ind, link) {
+ links[link.isOrigin ? 'outgoing' : 'incoming']++;
+ });
+
+ function linkExpl(t) { return '
'+t+''; }
+ var linksText = [linkExpl('links'), linkExpl(' ↳ ' + links.incoming+' • '+links.outgoing+' ↴')];
+
+ var player = d.captured && d.captured.capturingPlayerId
+ ? '
' + getPlayerName(d.captured.capturingPlayerId) + ''
+ : null;
+ var playerText = player ? ['owner', player] : null;
+
+ var time = d.captured
+ ? '
'
+ + unixTimeToString(d.captured.capturedTime) + ''
+ : null;
+ var sinceText = time ? ['since', time] : null;
+
+ var linkedFields = ['fields', d.portalV2.linkedFields ? d.portalV2.linkedFields.length : 0];
+
+ // collect and html-ify random data
+ var randDetailsData = [];
+ if (playerText && sinceText) {
+ randDetailsData.push (playerText, sinceText);
+ }
+
+ randDetailsData.push (
+ getRangeText(d), getEnergyText(d),
+ linksText, getAvgResoDistText(d),
+ linkedFields, getAttackApGainText(d),
+ getHackDetailsText(d), getMitigationText(d)
+ );
+
+ // artifact details
+
+ //niantic hard-code the fact it's just jarvis shards/targets - so until more examples exist, we'll do the same
+ //(at some future point we can iterate through all the artifact types and add rows as needed)
+ var jarvisArtifact = artifact.getPortalData (guid, 'jarvis');
+ if (jarvisArtifact) {
+ // the genFourColumnTable function below doesn't handle cases where one column is null and the other isn't - so default to *something* in both columns
+ var target = ['',''], shards = ['shards','(none)'];
+ if (jarvisArtifact.target) {
+ target = ['target', '
'+(jarvisArtifact.target==TEAM_RES?'Resistance':'Enlightened')+''];
+ }
+ if (jarvisArtifact.fragments) {
+ shards = [jarvisArtifact.fragments.length>1?'shards':'shard', '#'+jarvisArtifact.fragments.join(', #')];
+ }
+
+ randDetailsData.push (target, shards);
+ }
+
+ randDetails = '
' + genFourColumnTable(randDetailsData) + '
';
+
+ }
+
+ return randDetails;
+}
+
+
// draws link-range and hack-range circles around the portal with the
// given details. Clear them if parameter 'd' is null.
-window.setPortalIndicators = function(d) {
+window.setPortalIndicators = function(p) {
if(portalRangeIndicator) map.removeLayer(portalRangeIndicator);
portalRangeIndicator = null;
if(portalAccessIndicator) map.removeLayer(portalAccessIndicator);
portalAccessIndicator = null;
- if(d === null) return;
+ // if we have a portal...
- var range = getPortalRange(d);
- var coord = [d.locationE6.latE6/1E6, d.locationE6.lngE6/1E6];
- portalRangeIndicator = (range.range > 0
- ? L.geodesicCircle(coord, range.range, {
- fill: false,
- color: RANGE_INDICATOR_COLOR,
- weight: 3,
- dashArray: range.isLinkable ? undefined : "10,10",
- clickable: false })
- : L.circle(coord, range.range, { fill: false, stroke: false, clickable: false })
+ if(p) {
+ var coord = p.getLatLng();
+
+ // range is only known for sure if we have portal details
+ // TODO? render a min range guess until details are loaded..?
+
+ var d = p.options.details;
+ if (d) {
+ var range = getPortalRange(d);
+ portalRangeIndicator = (range.range > 0
+ ? L.geodesicCircle(coord, range.range, {
+ fill: false,
+ color: RANGE_INDICATOR_COLOR,
+ weight: 3,
+ dashArray: range.isLinkable ? undefined : "10,10",
+ clickable: false })
+ : L.circle(coord, range.range, { fill: false, stroke: false, clickable: false })
+ ).addTo(map);
+ }
+
+ portalAccessIndicator = L.circle(coord, HACK_RANGE,
+ { fill: false, color: ACCESS_INDICATOR_COLOR, weight: 2, clickable: false }
).addTo(map);
+ }
- portalAccessIndicator = L.circle(coord, HACK_RANGE,
- { fill: false, color: ACCESS_INDICATOR_COLOR, weight: 2, clickable: false }
- ).addTo(map);
}
// highlights portal with given GUID. Automatically clears highlights
diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js
index 353189d9..e3c67998 100644
--- a/code/portal_detail_display_tools.js
+++ b/code/portal_detail_display_tools.js
@@ -184,7 +184,8 @@ window.getResonatorDetails = function(d) {
resoDetails.push(renderResonatorDetails(slot, l, v, dist, nick));
});
- return genFourColumnTable(resoDetails);
+ return '
' + genFourColumnTable(resoDetails) + '
';
+
}
// helper function that renders the HTML for a given resonator. Does
diff --git a/code/portal_info.js b/code/portal_info.js
index fd27b4ee..5a85d4ee 100644
--- a/code/portal_info.js
+++ b/code/portal_info.js
@@ -194,10 +194,8 @@ window.potentialPortalLevel = function(d) {
}
-window.getPortalImageUrl = function(d) {
- if (d.imageByUrl && d.imageByUrl.imageUrl) {
- url = d.imageByUrl.imageUrl;
-
+window.fixPortalImageUrl = function(url) {
+ if (url) {
if (window.location.protocol === 'https:') {
url = url.indexOf('www.panoramio.com') !== -1
? url.replace(/^http:\/\/www/, 'https://ssl').replace('small', 'medium')