diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 0f4f1b2d..4902f4fb 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -44,7 +44,7 @@ window.renderPortalDetails = function(guid) { var resoDetails = '' + getResonatorDetails(d) + '
'; setPortalIndicators(d); - var img = d.imageByUrl.imageUrl; + var img = getPortalImageUrl(d); var lat = d.locationE6.latE6/1E6; var lng = d.locationE6.lngE6/1E6; var perma = '/intel?ll='+lat+','+lng+'&z=17&pll='+lat+','+lng; diff --git a/code/portal_info.js b/code/portal_info.js index 6772effb..11fddece 100644 --- a/code/portal_info.js +++ b/code/portal_info.js @@ -1,5 +1,3 @@ - - // PORTAL DETAILS TOOLS ////////////////////////////////////////////// // hand any of these functions the details-hash of a portal, and they // will return useful, but raw data. @@ -190,3 +188,20 @@ window.potentialPortalLevel = function(d) { } return(potential_level); } + + +window.getPortalImageUrl = function(d) { + if (d.imageByUrl && d.imageByUrl.imageUrl) { + url = d.imageByUrl.imageUrl; + + if (window.location.protocol === 'https:') { + url = url.indexOf('www.panoramio.com') !== -1 + ? url.replace(/^http:\/\/www/, 'https://ssl').replace('small', 'medium') + : url.replace(/^http:\/\//, '//'); + } + return url; + } else { + return DEFAULT_PORTAL_IMG; + } + +} diff --git a/plugins/portals-list.user.js b/plugins/portals-list.user.js index b5e90d8c..84dfa1a1 100644 --- a/plugins/portals-list.user.js +++ b/plugins/portals-list.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-portals-list@teo96 // @name IITC plugin: show list of portals // @category Info -// @version 0.0.15.@@DATETIMEVERSION@@ +// @version 0.0.16.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -67,7 +67,7 @@ window.plugin.portalslist.getPortals = function() { var d = portal.options.details; var name = d.portalV2.descriptiveText.TITLE; var address = d.portalV2.descriptiveText.ADDRESS; - var img = d.imageByUrl && d.imageByUrl.imageUrl ? d.imageByUrl.imageUrl : DEFAULT_PORTAL_IMG; + var img = getPortalImageUrl(d); var team = portal.options.team; var now = new Date(); var now_ms = now.getTime();// + (now.getTimezoneOffset() * 60000); diff --git a/plugins/show-linked-portals.user.js b/plugins/show-linked-portals.user.js index 75ef6ba8..d9669e67 100644 --- a/plugins/show-linked-portals.user.js +++ b/plugins/show-linked-portals.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-show-linked-portals@fstopienski // @name IITC plugin: Show linked portals // @category Portal Info -// @version 0.0.7.@@DATETIMEVERSION@@ +// @version 0.0.8.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -78,7 +78,7 @@ window.plugin.showLinkedPortal.getPortalByGuid = function (guid) { .append($('
')) .append($('').text('(' + portalDetails.portalV2.descriptiveText.ADDRESS + ')')) .html(); - var imageUrl = (portalDetails.imageByUrl ? portalDetails.imageByUrl.imageUrl : window.DEFAULT_PORTAL_IMG); + var imageUrl = getPortalImageUrl(portalDetails); portalInfoString = $('
').html($('').attr('src', imageUrl) .attr('class', 'minImg') .attr('alt', portalNameAdressAlt)