Change portal image urls to https if necessary in the portal object

This commit is contained in:
Kevin 2013-04-17 22:53:14 -07:00
parent bec7ae8c95
commit 86a7996db5
2 changed files with 10 additions and 5 deletions

View File

@ -105,7 +105,15 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
&& urlPortal !== ent[0] && urlPortal !== ent[0]
) return; ) return;
if('imageByUrl' in ent[2] && 'imageUrl' in ent[2].imageByUrl) {
if(window.location.protocol === 'https:') {
ent[2].imageByUrl.imageUrl = ent[2].imageByUrl.imageUrl.indexOf('www.panoramio.com') !== -1
? ent[2].imageByUrl.imageUrl.replace(/^http:\/\/www/, 'https://ssl').replace('small', 'medium')
: ent[2].imageByUrl.imageUrl.replace(/^http:\/\//, '//');
}
} else {
ent[2].imageByUrl = {'imageUrl': DEFAULT_PORTAL_IMG};
}
ppp.push(ent); // delay portal render ppp.push(ent); // delay portal render
} else if(ent[2].edge !== undefined) { } else if(ent[2].edge !== undefined) {

View File

@ -44,10 +44,7 @@ window.renderPortalDetails = function(guid) {
var resoDetails = '<table id="resodetails">' + getResonatorDetails(d) + '</table>'; var resoDetails = '<table id="resodetails">' + getResonatorDetails(d) + '</table>';
setPortalIndicators(d); setPortalIndicators(d);
var img = d.imageByUrl && d.imageByUrl.imageUrl var img = d.imageByUrl.imageUrl;
? d.imageByUrl.imageUrl
: DEFAULT_PORTAL_IMG;
var lat = d.locationE6.latE6; var lat = d.locationE6.latE6;
var lng = d.locationE6.lngE6; var lng = d.locationE6.lngE6;
var perma = '/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid; var perma = '/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;