Add link to FlightAware aircraft photos

This commit is contained in:
Carlos Salaverria 2016-08-23 10:41:58 -05:00
parent 70e86384f0
commit a2ca647062
2 changed files with 12 additions and 0 deletions

View file

@ -192,6 +192,7 @@
<td id="data_source" onclick="sortByDataSource();" style="text-align: right">Data Source</td>
<td id="airframes_mode_s_link" style="text-align: center">Airframes.org Link</td>
<td id="flightaware_mode_s_link" style="text-align: center">FlightAware Link</td>
<td id="flightaware_photo_link" style="text-align: center">Photos</td>td>
</tr>
</thead>
<tbody>
@ -215,6 +216,7 @@
<td style="text-align: right">DATA_SOURCE</td>
<td style="text-align: center">AIRFRAMES_MODE_S_LINK</td>
<td style="text-align: center">FLIGHTAWARE_MODE_S_LINK</td>
<td style="text-align: center">FLIGHTAWARE_PHOTO_LINK</td>
</tr>
</tbody>
</table>

View file

@ -835,6 +835,7 @@ function refreshTableInfo() {
tableplane.tr.cells[16].textContent = format_data_source(tableplane.getDataSource());
tableplane.tr.cells[17].innerHTML = getAirframesModeSLink(tableplane.icao);
tableplane.tr.cells[18].innerHTML = getFlightAwareModeSLink(tableplane.icao);
tableplane.tr.cells[19].innerHTML = getFlightAwarePhotoLink(tableplane.registration);
tableplane.tr.className = classes;
$("#header_altitude_unit").text(get_unit_label("altitude", DisplayUnits));
@ -1128,6 +1129,7 @@ function setColumnVisibility() {
showColumn(infoTable, "#data_source", !mapIsVisible);
showColumn(infoTable, "#airframes_mode_s_link", !mapIsVisible);
showColumn(infoTable, "#flightaware_mode_s_link", !mapIsVisible);
showColumn(infoTable, "#flightaware_photo_link", !mapIsVisible);
}
function initializeUnitsSelector() {
@ -1183,6 +1185,14 @@ function getFlightAwareModeSLink(code) {
return "";
}
function getFlightAwarePhotoLink(registration) {
if (registration !== null && registration !== "") {
return "<a target=\"_blank\" href=\"https://flightaware.com/photos/aircraft/" + registration.trim() + "\">See Photos</a>";
}
return "";
}
function getAirframesModeSLink(code) {
if (code !== null && code.length > 0 && code[0] !== '~') {
return "<a href=\"http://www.airframes.org/\" onclick=\"$('#airframes_post_icao').attr('value','" + code + "'); document.getElementById('horrible_hack').submit.call(document.getElementById('airframes_post')); return false;\">Airframes.org: " + code.toUpperCase() + "</a>";