diff --git a/html/config.js b/html/config.js index ef00a09..7e284bd 100644 --- a/html/config.js +++ b/html/config.js @@ -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; diff --git a/html/defaults.js b/html/defaults.js index 30fd650..bad19d0 100644 --- a/html/defaults.js +++ b/html/defaults.js @@ -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; diff --git a/html/index.html b/html/index.html index af08a5e..e207a99 100644 --- a/html/index.html +++ b/html/index.html @@ -209,7 +209,7 @@ - +
diff --git a/html/script.js b/html/script.js index d32a6a7..9cc47d1 100644 --- a/html/script.js +++ b/html/script.js @@ -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 "FA Photos"; - } else { + } else if (showPictures) { return "View on Planespotters"; } } @@ -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: {