diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 3bb64e93..1258c992 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -202,21 +202,27 @@ window.getPortalMiscDetails = function(guid,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(', #')]; - } + // 2014-02-06: stock site changed from supporting 'jarvis shards' to 'amar artifacts'(?) - so let's see what we can do to be generic... + var artifactTypes = { + 'jarvis': { 'name': 'Jarvis', 'fragmentName': 'shard(s)' }, + 'amar': { 'name': 'Amar', 'fragmentName': 'artifact(s)' }, + }; - randDetailsData.push (target, shards); - } + $.each(artifactTypes,function(type,details) { + var artdata = artifact.getPortalData (guid, type); + if (artdata) { + // 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 = [details.fragmentName,'(none)']; + if (artdata.target) { + target = ['target', ''+(artdata.target==TEAM_RES?'Resistance':'Enlightened')+'']; + } + if (artdata.fragments) { + shards = [details.fragmentName, '#'+artdata.fragments.join(', #')]; + } + + randDetailsData.push (target, shards); + } + }); randDetails = '' + genFourColumnTable(randDetailsData) + '
';