remove some long-dead code for portal titles - and fix it so a title:null doesn't break IITC
This commit is contained in:
parent
1fb27a75c4
commit
02ac86fc00
@ -41,46 +41,13 @@ window.renderPortalDetails = function(guid) {
|
||||
|
||||
|
||||
var img = fixPortalImageUrl(details ? details.image : data.image);
|
||||
var title = data.title;
|
||||
var title = (details && details.title) || (data && data.title) || '(untitled)';
|
||||
|
||||
var lat = data.latE6/1E6;
|
||||
var lng = data.lngE6/1E6;
|
||||
|
||||
var imgTitle = details ? getPortalDescriptionFromDetails(details) : data.title;
|
||||
imgTitle += '\n\nClick to show full image.';
|
||||
var portalDetailObj = details ? window.getPortalDescriptionFromDetailsExtended(details) : undefined;
|
||||
var imgTitle = title+'\n\nClick to show full image.';
|
||||
|
||||
var portalDetailedDescription = '';
|
||||
|
||||
if(portalDetailObj) {
|
||||
portalDetailedDescription = '<table description="Portal Photo Details" class="portal_details">';
|
||||
|
||||
// TODO (once the data supports it) - portals can have multiple photos. display all, with navigation between them
|
||||
// (at this time the data isn't returned from the server - although a count of images IS returned!)
|
||||
|
||||
if(portalDetailObj.submitter.name.length > 0) {
|
||||
if(portalDetailObj.submitter.team) {
|
||||
submitterSpan = '<span class="' + (portalDetailObj.submitter.team === 'RESISTANCE' ? 'res' : 'enl') + ' nickname">';
|
||||
} else {
|
||||
submitterSpan = '<span class="none">';
|
||||
}
|
||||
portalDetailedDescription += '<tr><th>Photo by:</th><td>' + submitterSpan
|
||||
+ escapeHtmlSpecialChars(portalDetailObj.submitter.name) + '</span>'+(portalDetailObj.submitter.voteCount !== undefined ? ' (' + portalDetailObj.submitter.voteCount + ' votes)' : '')+'</td></tr>';
|
||||
}
|
||||
if(portalDetailObj.submitter.link.length > 0) {
|
||||
portalDetailedDescription += '<tr><th>Photo from:</th><td><a href="'
|
||||
+ escapeHtmlSpecialChars(portalDetailObj.submitter.link) + '">' + escapeHtmlSpecialChars(portalDetailObj.submitter.link) + '</a></td></tr>';
|
||||
}
|
||||
|
||||
if(portalDetailObj.description) {
|
||||
portalDetailedDescription += '<tr class="padding-top"><th>Description:</th><td>' + escapeHtmlSpecialChars(portalDetailObj.description) + '</td></tr>';
|
||||
}
|
||||
// if(d.descriptiveText.map.ADDRESS) {
|
||||
// portalDetailedDescription += '<tr><th>Address:</th><td>' + escapeHtmlSpecialChars(d.descriptiveText.map.ADDRESS) + '</td></tr>';
|
||||
// }
|
||||
|
||||
portalDetailedDescription += '</table>';
|
||||
}
|
||||
|
||||
// portal level. start with basic data - then extend with fractional info in tooltip if available
|
||||
var levelInt = (teamStringToId(data.team) == TEAM_NONE) ? 0 : data.level;
|
||||
@ -127,7 +94,7 @@ window.renderPortalDetails = function(guid) {
|
||||
.html('') //to ensure it's clear
|
||||
.attr('class', TEAM_TO_CSS[teamStringToId(data.team)])
|
||||
.append(
|
||||
$('<h3>').attr({class:'title'}).text(data.title),
|
||||
$('<h3>').attr({class:'title'}).text(title),
|
||||
|
||||
$('<span>').attr({
|
||||
class: 'close',
|
||||
@ -141,7 +108,6 @@ window.renderPortalDetails = function(guid) {
|
||||
.attr({class:'imgpreview', title:imgTitle, style:"background-image: url('"+img+"')"})
|
||||
.append(
|
||||
$('<span>').attr({id:'level', title: levelDetails}).text(levelInt),
|
||||
$('<div>').attr({class:'portalDetails'}).html(portalDetailedDescription),
|
||||
$('<img>').attr({class:'hide', src:img})
|
||||
),
|
||||
|
||||
|
@ -23,59 +23,6 @@ window.getRangeText = function(d) {
|
||||
title];
|
||||
}
|
||||
|
||||
// generates description text from details for portal
|
||||
window.getPortalDescriptionFromDetails = function(details) {
|
||||
return details.title || '(untitled)';
|
||||
|
||||
// var descObj = details.descriptiveText.map;
|
||||
// // FIXME: also get real description?
|
||||
// var desc = descObj.TITLE;
|
||||
// if(descObj.ADDRESS)
|
||||
// desc += '\n' + descObj.ADDRESS;
|
||||
//// if(descObj.ATTRIBUTION)
|
||||
//// desc += '\nby '+descObj.ATTRIBUTION+' ('+descObj.ATTRIBUTION_LINK+')';
|
||||
// return desc;
|
||||
}
|
||||
|
||||
// Grabs more info, including the submitter name for the current main
|
||||
// portal image
|
||||
window.getPortalDescriptionFromDetailsExtended = function(details) {
|
||||
var descObj = details.title;
|
||||
var photoStreamObj = details.photoStreamInfo;
|
||||
|
||||
var submitterObj = new Object();
|
||||
submitterObj.type = "";
|
||||
submitterObj.name = "";
|
||||
submitterObj.team = "";
|
||||
submitterObj.link = "";
|
||||
submitterObj.voteCount = undefined;
|
||||
|
||||
if(photoStreamObj && photoStreamObj.hasOwnProperty("coverPhoto") && photoStreamObj.coverPhoto.hasOwnProperty("attributionMarkup")) {
|
||||
submitterObj.name = "Unknown";
|
||||
|
||||
var attribution = photoStreamObj.coverPhoto.attributionMarkup;
|
||||
submitterObj.type = attribution[0];
|
||||
if(attribution[1].hasOwnProperty("plain"))
|
||||
submitterObj.name = attribution[1].plain;
|
||||
if(attribution[1].hasOwnProperty("team"))
|
||||
submitterObj.team = attribution[1].team;
|
||||
if(attribution[1].hasOwnProperty("attributionLink"))
|
||||
submitterObj.link = attribution[1].attributionLink;
|
||||
if(photoStreamObj.coverPhoto.hasOwnProperty("voteCount"))
|
||||
submitterObj.voteCount = photoStreamObj.coverPhoto.voteCount;
|
||||
}
|
||||
|
||||
|
||||
var portalDetails = {
|
||||
title: descObj.TITLE,
|
||||
description: descObj.DESCRIPTION,
|
||||
address: descObj.ADDRESS,
|
||||
submitter: submitterObj
|
||||
};
|
||||
|
||||
return portalDetails;
|
||||
}
|
||||
|
||||
|
||||
// given portal details, returns html code to display mod details.
|
||||
window.getModDetails = function(d) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user