photo / photo link display logic
This commit is contained in:
@@ -209,6 +209,7 @@ BingMapsAPIKey = null;
|
||||
|
||||
//flightawareLinks = false;
|
||||
//shareBaseUrl = 'https://globe.adsbexchange.com/';
|
||||
// planespottersLinks = false;
|
||||
|
||||
// show links to various registration websites (not all countries)
|
||||
// registrationLinks = true;
|
||||
|
||||
@@ -229,6 +229,7 @@ let filterTISB = false;
|
||||
|
||||
let flightawareLinks = false;
|
||||
let shareBaseUrl = false;
|
||||
let planespottersLinks = false;
|
||||
|
||||
// show links to various registration websites (not all countries)
|
||||
let registrationLinks = true;
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="photoLinkRow">
|
||||
<tr id="photoLinkRow" class="hidden">
|
||||
<td>
|
||||
<div class="infoHeading">
|
||||
<span class="link" id="selected_photo_link"></span>
|
||||
|
||||
@@ -1202,24 +1202,21 @@ function initPage() {
|
||||
},
|
||||
});
|
||||
|
||||
if (!showPictures) {
|
||||
planespottingAPI = false;
|
||||
planespottersAPI = false;
|
||||
}
|
||||
new Toggle({
|
||||
key: "planespottingAPI",
|
||||
display: "Pictures planespotting.be",
|
||||
container: "#settingsRight",
|
||||
init: planespottingAPI && showPictures,
|
||||
init: planespottingAPI,
|
||||
setState: function(state) {
|
||||
planespottingAPI = state;
|
||||
if (state) {
|
||||
toggles['planespottersAPI'] && toggles['planespottersAPI'].toggle(false);
|
||||
}
|
||||
showPictures = planespottersAPI || planespottingAPI;
|
||||
if (showPictures) {
|
||||
jQuery('#photo_container').removeClass('hidden');
|
||||
jQuery('#photoLinkRow').addClass('hidden');
|
||||
} else {
|
||||
jQuery('#photo_container').addClass('hidden');
|
||||
jQuery('#photoLinkRow').removeClass('hidden');
|
||||
}
|
||||
setPictureVisibility();
|
||||
refreshSelected();
|
||||
}
|
||||
});
|
||||
@@ -1227,20 +1224,13 @@ function initPage() {
|
||||
key: "planespottersAPI",
|
||||
display: "Pictures planespotters.net",
|
||||
container: "#settingsRight",
|
||||
init: planespottersAPI && showPictures,
|
||||
init: planespottersAPI,
|
||||
setState: function(state) {
|
||||
planespottersAPI = state;
|
||||
if (state) {
|
||||
toggles['planespottingAPI'] && toggles['planespottingAPI'].toggle(false);
|
||||
}
|
||||
showPictures = planespottersAPI || planespottingAPI;
|
||||
if (showPictures) {
|
||||
jQuery('#photo_container').removeClass('hidden');
|
||||
jQuery('#photoLinkRow').addClass('hidden');
|
||||
} else {
|
||||
jQuery('#photo_container').addClass('hidden');
|
||||
jQuery('#photoLinkRow').removeClass('hidden');
|
||||
}
|
||||
setPictureVisibility();
|
||||
refreshSelected();
|
||||
}
|
||||
});
|
||||
@@ -3980,10 +3970,11 @@ function adjustInfoBlock() {
|
||||
jQuery('#selected_photo').css("width", photoWidth + 'px');
|
||||
|
||||
if (showPictures) {
|
||||
if (planespottersAPI || planespottingAPI)
|
||||
if (planespottersAPI || planespottingAPI) {
|
||||
jQuery('#photo_container').css('height', photoWidth * 0.883 + 'px');
|
||||
else
|
||||
} else {
|
||||
jQuery('#photo_container').css('height', '40px');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4607,7 +4598,7 @@ function getPhotoLink(ac) {
|
||||
if (ac.registration == null || ac.registration == "")
|
||||
return "";
|
||||
return "<a class=\"link\" target=\"_blank\" href=\"https://flightaware.com/photos/aircraft/" + ac.registration.replace(/[^0-9a-z]/ig,'') + "\" rel=\"noreferrer\">FA Photos</a>";
|
||||
} else {
|
||||
} else if (showPictures) {
|
||||
return "<a class=\"link\" target=\"_blank\" href=\"https://www.planespotters.net/hex/" + ac.icao.toUpperCase() + "\" rel=\"noreferrer\">View on Planespotters</a>";
|
||||
}
|
||||
}
|
||||
@@ -7493,6 +7484,20 @@ function deleteTraces() {
|
||||
}
|
||||
}
|
||||
|
||||
function setPictureVisibility() {
|
||||
showPictures = planespottersAPI || planespottingAPI;
|
||||
if (showPictures) {
|
||||
jQuery('#photo_container').removeClass('hidden');
|
||||
} else {
|
||||
jQuery('#photo_container').addClass('hidden');
|
||||
}
|
||||
if (planespottersLinks && !showPictures) {
|
||||
jQuery('#photoLinkRow').removeClass('hidden');
|
||||
} else {
|
||||
jQuery('#photoLinkRow').addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// just an idea, unused
|
||||
let infoBits = {
|
||||
type: {
|
||||
|
||||
Reference in New Issue
Block a user