Skip to content

Commit

Permalink
improve search
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Nov 9, 2024
1 parent c32aaa3 commit 9de4d1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5077,7 +5077,7 @@ function onSearch(e) {
let results = [];
if (searchTerm)
results = findPlanes(searchTerm, "byIcao", "byCallsign", "byReg", "byType", true);
if (results.length > 0 && globeIndex) {
if (results.length > 0 && haveTraces) {
toggleIsolation("on");
if (results.length < 100) {
getTrace(null, null, {list: results});
Expand Down Expand Up @@ -6003,13 +6003,16 @@ function findPlanes(queries, byIcao, byCallsign, byReg, byType, showWarnings) {
|| (byReg && plane.registration != null && plane.registration.toLowerCase().match(query))
|| (byType && plane.icaoType != null && plane.icaoType.toLowerCase().match(query))
) {
results.push(plane);
/* leaving this code in place just in case, not sure what this limitation to planes on screen is for when searching
if (globeIndex) {
if (plane.inView)
results.push(plane);
} else {
if (plane.checkVisible())
results.push(plane);
}
*/
}
}
}
Expand All @@ -6028,7 +6031,7 @@ function findPlanes(queries, byIcao, byCallsign, byReg, byType, showWarnings) {
} else {
console.log("No match found for query: " + queries);
let foundByHex = 0;
if (globeIndex) {
if (haveTraces) {
for (let i in queries) {
const query = queries[i];
if (query.toLowerCase().match(/~?[a-f,0-9]{6}/)) {
Expand Down

0 comments on commit 9de4d1d

Please sign in to comment.