From 4caea29fd3e664020d1f1f4fbec81d546ee7f70b Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sun, 28 Jul 2013 18:39:12 +0100 Subject: [PATCH] don't try and display an address when none is available fix #454 --- code/portal_detail_display_tools.js | 4 +++- plugins/show-address.user.js | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index 085887cc..92c931b8 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -17,7 +17,9 @@ window.getRangeText = function(d) { window.getPortalDescriptionFromDetails = function(details) { var descObj = details.portalV2.descriptiveText; // FIXME: also get real description? - var desc = descObj.TITLE + '\n' + descObj.ADDRESS; + var desc = descObj.TITLE; + if(descObj.ADDRESS) + desc += '\n' + descObj.ADDRESS; if(descObj.ATTRIBUTION) desc += '\nby '+descObj.ATTRIBUTION+' ('+descObj.ATTRIBUTION_LINK+')'; return desc; diff --git a/plugins/show-address.user.js b/plugins/show-address.user.js index 62f0ab5a..ee1db13d 100644 --- a/plugins/show-address.user.js +++ b/plugins/show-address.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-show-address@vita10gy // @name IITC plugin: show portal address in sidebar // @category Portal Info -// @version 0.2.2.@@DATETIMEVERSION@@ +// @version 0.2.3.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -26,8 +26,12 @@ window.plugin.portalAddress.portalDetail = function(data) { // country, so get rid of it. If the country is in the [2] then it // doesn't matter because address is usually short enough to fit. var d = data.portalDetails.portalV2; - var address = d.descriptiveText.ADDRESS.split(',').splice(0,3).join(','); - $('.imgpreview').append('
'+address+'
'); + var address = d.descriptiveText.ADDRESS; + if (address) { + address = address.split(',').splice(0,3).join(','); + $('.imgpreview').append('
'+address+'
'); + } + } var setup = function() {