Use regex match for filter comparisons
This commit is contained in:
parent
9b85a30c91
commit
1916fc6648
|
|
@ -111,15 +111,15 @@ function PlaneObject(icao) {
|
||||||
PlaneObject.prototype.isFiltered = function() {
|
PlaneObject.prototype.isFiltered = function() {
|
||||||
// aircraft type filter
|
// aircraft type filter
|
||||||
if (this.filter.aircraftTypeCode) {
|
if (this.filter.aircraftTypeCode) {
|
||||||
if (this.icaotype === null || (typeof this.icaotype === 'string' && this.icaotype.toUpperCase() !== this.filter.aircraftTypeCode.toUpperCase())) {
|
if (this.icaotype === null || (typeof this.icaotype === 'string' && !this.icaotype.toUpperCase().trim().match(this.filter.aircraftTypeCode))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// aircraft ident filter
|
// aircraft ident filter
|
||||||
if (this.filter.aircraftIdent) {
|
if (this.filter.aircraftIdent) {
|
||||||
if (this.flight === null || (typeof this.flight === 'string' && this.flight.toUpperCase().trim() !== this.filter.aircraftIdent.toUpperCase())) {
|
if (this.flight === null || (typeof this.flight === 'string' && !this.flight.toUpperCase().trim().match(this.filter.aircraftIdent))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2125,12 +2125,12 @@ function updatePlaneFilter() {
|
||||||
PlaneFilter.maxAltitude = maxAltitude;
|
PlaneFilter.maxAltitude = maxAltitude;
|
||||||
PlaneFilter.altitudeUnits = DisplayUnits;
|
PlaneFilter.altitudeUnits = DisplayUnits;
|
||||||
|
|
||||||
var aircraftTypeCode = $("#aircraft_type_filter").val().trim()
|
var aircraftTypeCode = $("#aircraft_type_filter").val().trim().toUpperCase()
|
||||||
if (aircraftTypeCode === "") {
|
if (aircraftTypeCode === "") {
|
||||||
aircraftTypeCode = undefined
|
aircraftTypeCode = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
var aircraftIdent = $("#aircraft_ident_filter").val().trim()
|
var aircraftIdent = $("#aircraft_ident_filter").val().trim().toUpperCase()
|
||||||
if (aircraftIdent === "") {
|
if (aircraftIdent === "") {
|
||||||
aircraftIdent = undefined
|
aircraftIdent = undefined
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue