Add filtering by aircraft type
This commit is contained in:
parent
c1eeda612e
commit
f4f2f3ddad
|
|
@ -223,6 +223,12 @@
|
||||||
<button type="submit">Filter</button>
|
<button type="submit">Filter</button>
|
||||||
<button id="altitude_filter_reset_button">Reset</button>
|
<button id="altitude_filter_reset_button">Reset</button>
|
||||||
</form>
|
</form>
|
||||||
|
<form id="aircraft_type_filter_form">
|
||||||
|
<label><span class="infoBlockTitleText">Filter by Aircraft Type:</span></label>
|
||||||
|
<input id="aircraft_type_filter" name="aircraftTypeFilter" type="text" class="aircraftTypeFilterInput" maxlength="5">
|
||||||
|
<button type="submit">Filter by Aircraft Type</button>
|
||||||
|
<button id="aircraft_type_filter_reset_button">Reset</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button id="column_select">Select Columns</button>
|
<button id="column_select">Select Columns</button>
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,13 @@ function PlaneObject(icao) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaneObject.prototype.isFiltered = function() {
|
PlaneObject.prototype.isFiltered = function() {
|
||||||
|
// aircraft type filter
|
||||||
|
if (this.filter.aircraftTypeCode && this.icaotype !== null) {
|
||||||
|
if (typeof this.icaotype === 'string' && this.icaotype !== this.filter.aircraftTypeCode) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.filter.minAltitude !== undefined && this.filter.maxAltitude !== undefined) {
|
if (this.filter.minAltitude !== undefined && this.filter.maxAltitude !== undefined) {
|
||||||
if (this.altitude === null || this.altitude === undefined) {
|
if (this.altitude === null || this.altitude === undefined) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,10 @@ function initialize() {
|
||||||
|
|
||||||
$("#altitude_filter_reset_button").click(onResetAltitudeFilter);
|
$("#altitude_filter_reset_button").click(onResetAltitudeFilter);
|
||||||
|
|
||||||
|
$("#aircraft_type_filter_form").submit(onFilterByAircraftType);
|
||||||
|
$("#aircraft_type_filter_reset_button").click(onResetAircraftTypeFilter);
|
||||||
|
|
||||||
|
|
||||||
$('#settingsCog').on('click', function() {
|
$('#settingsCog').on('click', function() {
|
||||||
$('#settings_infoblock').toggle();
|
$('#settings_infoblock').toggle();
|
||||||
});
|
});
|
||||||
|
|
@ -1977,6 +1981,18 @@ function onFilterByAltitude(e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFilterByAircraftType(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
updatePlaneFilter();
|
||||||
|
refreshTableInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onResetAircraftTypeFilter(e) {
|
||||||
|
$("#aircraft_type_filter").val("");
|
||||||
|
updatePlaneFilter();
|
||||||
|
refreshTableInfo();
|
||||||
|
}
|
||||||
|
|
||||||
function filterGroundVehicles(switchFilter) {
|
function filterGroundVehicles(switchFilter) {
|
||||||
if (typeof localStorage['groundVehicleFilter'] === 'undefined') {
|
if (typeof localStorage['groundVehicleFilter'] === 'undefined') {
|
||||||
localStorage.setItem('groundVehicleFilter' , 'not_filtered');
|
localStorage.setItem('groundVehicleFilter' , 'not_filtered');
|
||||||
|
|
@ -2065,6 +2081,13 @@ function updatePlaneFilter() {
|
||||||
PlaneFilter.minAltitude = minAltitude;
|
PlaneFilter.minAltitude = minAltitude;
|
||||||
PlaneFilter.maxAltitude = maxAltitude;
|
PlaneFilter.maxAltitude = maxAltitude;
|
||||||
PlaneFilter.altitudeUnits = DisplayUnits;
|
PlaneFilter.altitudeUnits = DisplayUnits;
|
||||||
|
|
||||||
|
var aircraftTypeCode = $("#aircraft_type_filter").val().trim()
|
||||||
|
if (aircraftTypeCode === "") {
|
||||||
|
aircraftTypeCode = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaneFilter.aircraftTypeCode = aircraftTypeCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFlightAwareIdentLink(ident, linkText) {
|
function getFlightAwareIdentLink(ident, linkText) {
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ div#loader { z-index: 99; position: absolute; left: 0; top: 0; bottom: 0; right:
|
||||||
background-color: #3c6ea3;
|
background-color: #3c6ea3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.altitudeFilterInput {
|
.altitudeFilterInput, .aircraftTypeFilterInput {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue