diff --git a/public_html/index.html b/public_html/index.html index 1e54d3a..66d584b 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -223,6 +223,12 @@ +
+ + + + +
diff --git a/public_html/planeObject.js b/public_html/planeObject.js index c55677c..dd7b6d2 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -109,6 +109,13 @@ function PlaneObject(icao) { } 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.altitude === null || this.altitude === undefined) { return true; diff --git a/public_html/script.js b/public_html/script.js index 99ed274..8c5010e 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -323,6 +323,10 @@ function initialize() { $("#altitude_filter_reset_button").click(onResetAltitudeFilter); + $("#aircraft_type_filter_form").submit(onFilterByAircraftType); + $("#aircraft_type_filter_reset_button").click(onResetAircraftTypeFilter); + + $('#settingsCog').on('click', function() { $('#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) { if (typeof localStorage['groundVehicleFilter'] === 'undefined') { localStorage.setItem('groundVehicleFilter' , 'not_filtered'); @@ -2065,6 +2081,13 @@ function updatePlaneFilter() { PlaneFilter.minAltitude = minAltitude; PlaneFilter.maxAltitude = maxAltitude; PlaneFilter.altitudeUnits = DisplayUnits; + + var aircraftTypeCode = $("#aircraft_type_filter").val().trim() + if (aircraftTypeCode === "") { + aircraftTypeCode = undefined + } + + PlaneFilter.aircraftTypeCode = aircraftTypeCode; } function getFlightAwareIdentLink(ident, linkText) { diff --git a/public_html/style.css b/public_html/style.css index 9b2c66f..53aee08 100644 --- a/public_html/style.css +++ b/public_html/style.css @@ -329,7 +329,7 @@ div#loader { z-index: 99; position: absolute; left: 0; top: 0; bottom: 0; right: background-color: #3c6ea3; } -.altitudeFilterInput { +.altitudeFilterInput, .aircraftTypeFilterInput { width: 50px; }