Plugin Show Linked Portals: Fix uncaught error of undefined "imageUrl"

This commit is contained in:
Xelio 2013-03-26 03:51:51 +08:00
parent eb3dc21835
commit 7e647228ce

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @id iitc-plugin-show-linked-portals@fstopienski // @id iitc-plugin-show-linked-portals@fstopienski
// @name IITC plugin: Show linked portals // @name IITC plugin: Show linked portals
// @version 0.0.1.@@DATETIMEVERSION@@ // @version 0.0.2.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@ // @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@ // @downloadURL @@DOWNLOADURL@@
@ -79,7 +79,8 @@ window.plugin.showLinkedPortal.getPortalByGuid = function (guid) {
portalInfoString = ''; portalInfoString = '';
var portalNameAdressAlt = "'" + portalDetails.portalV2.descriptiveText.TITLE + "' (" + portalDetails.portalV2.descriptiveText.ADDRESS + ")"; var portalNameAdressAlt = "'" + portalDetails.portalV2.descriptiveText.TITLE + "' (" + portalDetails.portalV2.descriptiveText.ADDRESS + ")";
var portalNameAdressTitle = "'<strong>" + portalDetails.portalV2.descriptiveText.TITLE + "</strong>'<br/> <em>(" + portalDetails.portalV2.descriptiveText.ADDRESS + ")</em>"; var portalNameAdressTitle = "'<strong>" + portalDetails.portalV2.descriptiveText.TITLE + "</strong>'<br/> <em>(" + portalDetails.portalV2.descriptiveText.ADDRESS + ")</em>";
portalInfoString = '<img src="' + portalDetails.imageByUrl.imageUrl + '" class="minImg" alt="' + portalNameAdressAlt + '" title="' + portalNameAdressTitle + '"/>'; var imageUrl = (portalDetails.imageByUrl ? portalDetails.imageByUrl.imageUrl : '');
portalInfoString = '<img src="' + imageUrl + '" class="minImg" alt="' + portalNameAdressAlt + '" title="' + portalNameAdressTitle + '"/>';
} }
return portalInfoString; return portalInfoString;
}; };