diff --git a/code/artifact.js b/code/artifact.js
index f816c3c0..2d8a31d3 100644
--- a/code/artifact.js
+++ b/code/artifact.js
@@ -72,8 +72,9 @@ window.artifact.processData = function(data) {
artifact.clearData();
$.each (data.artifacts, function(i,artData) {
- if (artData.artifactId != 'jarvis') {
- // jarvis artifacts - fragmentInfos and targetInfos
+ // if we have no descriptions for a type, we don't know about it
+ if (!artifact.getArtifactDescriptions(artData.artifactId)) {
+ // jarvis and amar artifacts - fragmentInfos and targetInfos
// (future types? completely unknown at this time!)
console.warn('Note: unknown artifactId '+artData.artifactId+' - guessing how to handle it');
}
@@ -141,6 +142,15 @@ window.artifact.isArtifact = function(type) {
return type in artifact.artifactTypes;
}
+window.artifact.getArtifactDescriptions = function(type) {
+ var descriptions = {
+ 'jarvis': { 'title': "Jarvis Shards", 'fragmentName': "shards" },
+ 'amar': { 'title': "Amar Artifacts", 'fragmentName': "artifacts" }
+ };
+
+ return descriptions[type];
+}
+
// used to render portals that would otherwise be below the visible level
window.artifact.getArtifactEntities = function() {
var entities = [];
@@ -244,7 +254,9 @@ window.artifact.showArtifactList = function() {
}
$.each(artifact.artifactTypes, function(type,type2) {
- var name = typeNames[type] || ('New artifact type: '+type);
+ var description = artifact.getArtifactDescriptions(type);
+
+ var name = description ? description.title : ('unknown artifact type: '+type);
html += '
'+name+'
';
@@ -273,7 +285,8 @@ window.artifact.showArtifactList = function() {
if (data[type].target) {
row += '
';
}
- row += 'Shard: #'+data[type].fragments.join(', #')+' ';
+ var fragmentName = description ? description.fragmentName : 'fragment';
+ row += ''+fragmentName+': #'+data[type].fragments.join(', #')+' ';
sortVal = Math.min.apply(null, data[type].fragments); // use min shard number at portal as sort key
}
diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js
index 1258c992..f1841488 100644
--- a/code/portal_detail_display.js
+++ b/code/portal_detail_display.js
@@ -203,24 +203,24 @@ window.getPortalMiscDetails = function(guid,d) {
// artifact details
// 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)' },
- };
-
- $.each(artifactTypes,function(type,details) {
+ $.each(artifact.getArtifactTypes(),function(index,type) {
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(', #')];
- }
+ var details = artifact.getArtifactDescriptions(type);
+ if (details) {
+ // 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);
+ randDetailsData.push (target, shards);
+ } else {
+ console.warn('Unknown artifact type '+type+': no names, so cannot display');
+ }
}
});