more $ jQuery replacements

This commit is contained in:
Matthias Wirth
2021-05-28 07:32:37 +02:00
parent 4ffe860954
commit ffe38802b6
4 changed files with 40 additions and 40 deletions

View File

@@ -31,7 +31,7 @@ let _request_cache = {};
let regCache = null;
function dbLoad(icao) {
let defer = $.Deferred();
let defer = jQuery.Deferred();
if (icao.charAt(0) == '~') {
defer.resolve(null);
return defer;
@@ -78,7 +78,7 @@ function request_from_db(icao, level, defer) {
function getIcaoAircraftTypeData(aircraftData, defer) {
if (_aircraft_type_cache === null) {
$.getJSON(databaseFolder + "/icao_aircraft_types.js")
jQuery.getJSON(databaseFolder + "/icao_aircraft_types.js")
.done(function(typeLookupData) {
_aircraft_type_cache = typeLookupData;
})
@@ -115,7 +115,7 @@ function db_ajax(bkey) {
return _request_cache[bkey];
}
req = _request_cache[bkey] = $.Deferred();
req = _request_cache[bkey] = jQuery.Deferred();
req.bkey = bkey;
// put it in the queue
_request_queue.push(req);
@@ -134,7 +134,7 @@ function db_ajax_request_complete() {
_request_count++;
req = _request_queue.shift();
const req_url = databaseFolder + '/' + req.bkey + '.js';
ajaxreq = $.ajax({ url: req_url,
ajaxreq = jQuery.ajax({ url: req_url,
cache: true,
timeout: 30000,
dataType : 'json' });

View File

@@ -14,8 +14,8 @@ let chunkNames = [];
let PositionHistoryBuffer = [];
var receiverJson;
let deferHistory = [];
let historyLoaded = $.Deferred();
let configureReceiver = $.Deferred();
let historyLoaded = jQuery.Deferred();
let configureReceiver = jQuery.Deferred();
let historyTimeout = 60;
let globeIndex = 0;
let globeIndexGrid = 0;
@@ -26,7 +26,7 @@ let dbServer = false;
let l3harris = false;
let heatmap = false;
let heatLoaded = 0;
let heatmapDefer = $.Deferred();
let heatmapDefer = jQuery.Deferred();
let heatChunks = [];
let heatPoints = [];
let replay = false;
@@ -211,17 +211,17 @@ if (uuid) {
} else if (adsbexchange && window.location.pathname == '/') {
console.log("Using adsbexchange fast-path load!");
let data = JSON.parse('{"refresh":1600,"history":1,"dbServer":true,"binCraft":true,"globeIndexGrid":3,"globeIndexSpecialTiles":[{"south":60,"east":0,"north":90,"west":-126},{"south":60,"east":150,"north":90,"west":0},{"south":51,"east":-126,"north":90,"west":150},{"south":9,"east":-126,"north":51,"west":150},{"south":51,"east":-69,"north":60,"west":-126},{"south":45,"east":-114,"north":51,"west":-120},{"south":45,"east":-102,"north":51,"west":-114},{"south":45,"east":-90,"north":51,"west":-102},{"south":45,"east":-75,"north":51,"west":-90},{"south":45,"east":-69,"north":51,"west":-75},{"south":42,"east":18,"north":48,"west":12},{"south":42,"east":24,"north":48,"west":18},{"south":48,"east":24,"north":54,"west":18},{"south":54,"east":24,"north":60,"west":12},{"south":54,"east":12,"north":60,"west":3},{"south":54,"east":3,"north":60,"west":-9},{"south":42,"east":0,"north":48,"west":-9},{"south":42,"east":51,"north":51,"west":24},{"south":51,"east":51,"north":60,"west":24},{"south":30,"east":90,"north":60,"west":51},{"south":30,"east":120,"north":60,"west":90},{"south":30,"east":129,"north":39,"west":120},{"south":30,"east":138,"north":39,"west":129},{"south":30,"east":150,"north":39,"west":138},{"south":39,"east":150,"north":60,"west":120},{"south":9,"east":111,"north":21,"west":90},{"south":21,"east":111,"north":30,"west":90},{"south":9,"east":129,"north":24,"west":111},{"south":24,"east":120,"north":30,"west":111},{"south":24,"east":129,"north":30,"west":120},{"south":9,"east":150,"north":30,"west":129},{"south":9,"east":69,"north":30,"west":51},{"south":9,"east":90,"north":30,"west":69},{"south":-90,"east":51,"north":9,"west":-30},{"south":-90,"east":111,"north":9,"west":51},{"south":-90,"east":160,"north":-18,"west":111},{"south":-18,"east":160,"north":9,"west":111},{"south":-90,"east":-90,"north":-42,"west":160},{"south":-42,"east":-90,"north":9,"west":160},{"south":-9,"east":-42,"north":9,"west":-90},{"south":-90,"east":-63,"north":-9,"west":-90},{"south":-21,"east":-42,"north":-9,"west":-63},{"south":-90,"east":-42,"north":-21,"west":-63},{"south":-90,"east":-30,"north":9,"west":-42},{"south":9,"east":-117,"north":33,"west":-126},{"south":9,"east":-102,"north":30,"west":-117},{"south":9,"east":-90,"north":27,"west":-102},{"south":24,"east":-84,"north":30,"west":-90},{"south":9,"east":-69,"north":18,"west":-90},{"south":18,"east":-69,"north":24,"west":-90},{"south":36,"east":18,"north":42,"west":6},{"south":36,"east":30,"north":42,"west":18},{"south":9,"east":6,"north":39,"west":-9},{"south":9,"east":30,"north":36,"west":6},{"south":9,"east":51,"north":42,"west":30},{"south":24,"east":-69,"north":39,"west":-75},{"south":9,"east":-33,"north":30,"west":-69},{"south":30,"east":-33,"north":60,"west":-69},{"south":9,"east":-9,"north":30,"west":-33},{"south":30,"east":-9,"north":60,"west":-33}],"version":"adsbexchange backend"}');
get_receiver_defer = $.Deferred().resolve(data);
test_chunk_defer = $.Deferred().reject();
get_receiver_defer = jQuery.Deferred().resolve(data);
test_chunk_defer = jQuery.Deferred().reject();
} else {
// get configuration json files, will be used in initialize function
get_receiver_defer = $.ajax({
get_receiver_defer = jQuery.ajax({
url: 'data/receiver.json',
cache: false,
dataType: 'json',
timeout: 10000,
});
test_chunk_defer = $.ajax({
test_chunk_defer = jQuery.ajax({
url:'chunks/chunks.json',
cache: false,
dataType: 'json',
@@ -229,10 +229,10 @@ if (uuid) {
});
}
$.getJSON(databaseFolder + "/icao_aircraft_types.js").done(function(typeLookupData) {
jQuery.getJSON(databaseFolder + "/icao_aircraft_types.js").done(function(typeLookupData) {
_aircraft_type_cache = typeLookupData;
});
$.getJSON(databaseFolder + "/ranges.js").done(function(ranges) {
jQuery.getJSON(databaseFolder + "/ranges.js").done(function(ranges) {
if (!ranges || !ranges.military) {
console.error("couldn't load milRanges.");
return;
@@ -270,7 +270,7 @@ if (!heatmap) {
let URL = base + sDate + "/heatmap/" +
index.toString().padStart(2, '0') + ".bin.ttf";
let req = $.ajax({
let req = jQuery.ajax({
url: URL,
method: 'GET',
num: i,
@@ -376,14 +376,14 @@ function get_history() {
if (nHistoryItems > 0) {
nHistoryItems++;
let request = $.ajax({ url: 'data/aircraft.json',
let request = jQuery.ajax({ url: 'data/aircraft.json',
timeout: historyTimeout*800,
cache: false,
dataType: 'json' });
deferHistory.push(request);
if (enable_uat) {
nHistoryItems++;
request = $.ajax({ url: 'chunks/978.json',
request = jQuery.ajax({ url: 'chunks/978.json',
timeout: historyTimeout*800,
cache: false,
dataType: 'json' });
@@ -414,13 +414,13 @@ function get_history_item(i) {
let request;
if (HistoryChunks) {
request = $.ajax({ url: 'chunks/' + chunkNames[i],
request = jQuery.ajax({ url: 'chunks/' + chunkNames[i],
timeout: historyTimeout * 1000,
dataType: 'json'
});
} else {
request = $.ajax({ url: 'data/history_' + i + '.json',
request = jQuery.ajax({ url: 'data/history_' + i + '.json',
timeout: nHistoryItems * 80, // Allow 40 ms load time per history entry
cache: false,
dataType: 'json' });
@@ -461,7 +461,7 @@ function globeRateUpdate() {
setCookie('adsbx_sid', ((ts + 2*86400*1000) + '_' + Math.random().toString(36).substring(2, 15)), 2);
}
if (dynGlobeRate) {
$.ajax({url:'/globeRates.json', cache: false, dataType: 'json', }).done(function(data) {
jQuery.ajax({url:'/globeRates.json', cache: false, dataType: 'json', }).done(function(data) {
if (data.simload != null)
globeSimLoad = data.simload;
if (data.refresh != null)

View File

@@ -95,7 +95,7 @@ function createBaseLayers() {
renderMode: 'image',
});
$.ajax({
jQuery.ajax({
url: 'osm-liberty/style.json',
dataType: 'json',
layer: vtlayer,

View File

@@ -156,7 +156,7 @@ let showingReplayBar = false;
// TAR1090 application object
let TAR;
TAR = (function (global, $, TAR) {
TAR = (function (global, jQuery, TAR) {
return TAR;
}(window, jQuery, TAR || {}));
@@ -291,7 +291,7 @@ function fetchData(options) {
//console.time("Starting Fetch");
if (enable_uat) {
FetchPendingUAT = $.ajax({ url: 'chunks/978.json',
FetchPendingUAT = jQuery.ajax({ url: 'chunks/978.json',
dataType: 'json' });
FetchPendingUAT.done(function(data) {
@@ -351,7 +351,7 @@ function fetchData(options) {
//console.log(ac_url[i]);
let req;
if (binCraft) {
req = $.ajax({
req = jQuery.ajax({
url: `${ac_url[i]}`, method: 'GET',
xhr: function() {
let xhrOverride = new XMLHttpRequest();
@@ -361,7 +361,7 @@ function fetchData(options) {
urlIndex: i,
});
} else {
req = $.ajax({ url: `${ac_url[i]}`, dataType: 'json', urlIndex: i });
req = jQuery.ajax({ url: `${ac_url[i]}`, dataType: 'json', urlIndex: i });
}
FetchPending.push(req);
@@ -463,7 +463,7 @@ function initialize() {
return;
}
$.when(configureReceiver, heatmapDefer).done(function() {
jQuery.when(configureReceiver, heatmapDefer).done(function() {
if (receiverJson) {
if (receiverJson.lat != null) {
@@ -485,7 +485,7 @@ function initialize() {
// Wait for history item downloads and append them to the buffer
push_history();
$.when(historyLoaded).done(function() {
jQuery.when(historyLoaded).done(function() {
startPage();
});
});
@@ -1194,7 +1194,7 @@ function push_history() {
function push_history_item(i) {
$.when(deferHistory[i])
jQuery.when(deferHistory[i])
.done(function(json) {
if (HistoryChunks) {
@@ -1399,7 +1399,7 @@ function startPage() {
//
// Utils begin
//
(function (global, $, TAR) {
(function (global, jQuery, TAR) {
let utils = TAR.utils = TAR.utils || {};
// Make a LineString with 'points'-number points
@@ -2267,7 +2267,7 @@ function refreshPhoto(selected) {
jQuery('#copyrightInfo').html("<span></span>");
//console.log(ts/1000 + 'sending psAPI request');
selected.psAPIresponseTS = ts;
let req = $.ajax({
let req = jQuery.ajax({
url: 'https://api.planespotters.net/pub/photos/' + urlTail,
dataType: 'json',
plane: selected,
@@ -2723,7 +2723,7 @@ function refreshFeatures() {
//
// Planes table begin
//
(function (global, $, TAR) {
(function (global, jQuery, TAR) {
let planeMan = TAR.planeMan = TAR.planeMan || {};
function compareAlpha(xa,ya) {
@@ -3742,7 +3742,7 @@ function invertMap(evt){
//
// Altitude Chart begin
//
(function (global, $, TAR) {
(function (global, jQuery, TAR) {
let altitudeChart = TAR.altitudeChart = TAR.altitudeChart || {};
function createLegendGradientStops() {
@@ -3768,7 +3768,7 @@ function invertMap(evt){
function loadLegend() {
let baseLegend = (DisplayUnits === 'metric') ? 'images/alt_legend_meters.svg' : 'images/alt_legend_feet.svg';
$.get(baseLegend, function (data) {
jQuery.get(baseLegend, function (data) {
jQuery('#altitude_chart_button').css("background-image", createLegendUrl(data));
});
}
@@ -3891,7 +3891,7 @@ function onJump(e) {
jQuery("#jump_input").blur();
}
if (!_airport_coords_cache) {
$.getJSON(databaseFolder + "/airport-coords.js")
jQuery.getJSON(databaseFolder + "/airport-coords.js")
.done(function(data) {
_airport_coords_cache = data;
onJump();
@@ -4148,9 +4148,9 @@ function fetchPfData() {
return;
fetchingPf = true;
for (let i in pf_data) {
const req = $.ajax({ url: pf_data[i],
const req = jQuery.ajax({ url: pf_data[i],
dataType: 'json' });
$.when(req).done(function(data) {
jQuery.when(req).done(function(data) {
for (let i in PlanesOrdered) {
const plane = PlanesOrdered[i];
const ac = data.aircraft[plane.icao.toUpperCase()];
@@ -4636,7 +4636,7 @@ function findPlanes(query, byIcao, byCallsign, byReg, byType) {
return;
}
} else {
let req = $.ajax({ url: databaseFolder + "/regIcao.js",
let req = jQuery.ajax({ url: databaseFolder + "/regIcao.js",
cache: true,
timeout: 10000,
dataType : 'json',
@@ -5322,7 +5322,7 @@ function drawUpintheair() {
// kick off an ajax request that will add the rings when it's done
if (!globeIndex && !uuid) {
let request = $.ajax({ url: 'upintheair.json',
let request = jQuery.ajax({ url: 'upintheair.json',
cache: true,
dataType: 'json' });
request.done(function(data) {
@@ -5514,7 +5514,7 @@ function getTrace(newPlane, hex, options) {
let fake1 = false;
if (URL1 && !options.onlyFull) {
req1 = $.ajax({ url: `${URL1}`,
req1 = jQuery.ajax({ url: `${URL1}`,
dataType: 'json',
options: options,
});
@@ -5543,7 +5543,7 @@ function getTrace(newPlane, hex, options) {
if (options.onlyRecent)
return newPlane;
req2 = $.ajax({ url: `${URL2}`,
req2 = jQuery.ajax({ url: `${URL2}`,
dataType: 'json',
options: options,
});
@@ -5877,7 +5877,7 @@ function loadReplay(ts) {
let sDate = sDateString(time);
let index = 2 * time.getUTCHours() + Math.floor(time.getUTCMinutes() / 30);
let req = $.ajax({
let req = jQuery.ajax({
url: "globe_history/" + sDate + "/heatmap/" + index.toString().padStart(2, '0') + ".bin.ttf",
method: 'GET',
xhr: function() {