From b6ce9fd7332fb5b6859e786b7efb328e197335dc Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Fri, 3 Jun 2022 20:35:55 -0400 Subject: [PATCH] Documentation Updates --- .vscode/settings.json | 3 ++- gmap.html | 2 +- js/avwx.js | 6 ++++++ js/liveatc.js | 23 +++++++++++++++++++++++ js/schedules.js | 16 +++++++++++++++- 5 files changed, 47 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 11af9ff..081642b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { "python.pythonPath": "/usr/bin/python3", - "liveServer.settings.port": 5501 + "liveServer.settings.port": 5501, + "docwriter.progress.trackFunctions": false } \ No newline at end of file diff --git a/gmap.html b/gmap.html index a9a8884..27d1173 100644 --- a/gmap.html +++ b/gmap.html @@ -30,7 +30,7 @@ - + diff --git a/js/avwx.js b/js/avwx.js index e979b55..f62e999 100644 --- a/js/avwx.js +++ b/js/avwx.js @@ -1,5 +1,11 @@ var baseurl = "https://avwx.rest/api/" +/** + * "This function takes two arguments, x and y, and uses them to make an AJAX call to a weather API, + * then it takes the data returned from the API and displays it on the page." + * @param x - longitude + * @param y - latitude + */ function nearestStations(x, y) { FetchPending = $.ajax({ url: baseurl + 'metar/' + x + ',' + y + '?token=' + keys['AVWX'] + '&options=info&format=json', diff --git a/js/liveatc.js b/js/liveatc.js index d706ba3..b13cfd6 100644 --- a/js/liveatc.js +++ b/js/liveatc.js @@ -1,3 +1,8 @@ +/** + * It takes a URL and a title, and then it plays the audio stream at the URL. + * @param url - The URL of the PLS file + * @param title - The title of the stream + */ function playPLS(url, title) { window.setInterval(function () { if (document.getElementById("player").readyState === 3 || document.getElementById("player").readyState === 4) { @@ -65,6 +70,10 @@ function playPLS(url, title) { }) } +/** + * If the icon is a play button, play the audio and change the icon to a pause button. If the icon is a + * pause button, pause the audio and change the icon to a play button. + */ function playPause() { var text = document.getElementById("audioControl_icon").innerHTML @@ -76,6 +85,10 @@ function playPause() { document.getElementById("audioControl_icon").innerHTML = "play_arrow" } } +/** + * It creates a div for each state in the JSON file, and then adds a div with a bunch of line breaks to + * the end. + */ function listStations() { document.getElementById("atc_selector").innerHTML = "" @@ -100,6 +113,10 @@ function listStations() { }) } +/** + * It takes a state name as an argument, and then it creates a list of airports in that state. + * @param state - The state that the user has selected + */ function selectState(state) { document.getElementById("atc_selector").innerHTML = "" @@ -143,6 +160,12 @@ function selectState(state) { }) } +/** + * It takes the airport code and state code and then uses the airport code to find the feeds for that + * airport in the JSON file. + * @param airport - The airport code + * @param state - The state that the airport is in + */ function selectAirport(airport, state) { document.getElementById("atc_selector").innerHTML = "" diff --git a/js/schedules.js b/js/schedules.js index 96989fd..b37602e 100644 --- a/js/schedules.js +++ b/js/schedules.js @@ -1,5 +1,9 @@ var us_airports = {} +/** + * It creates a div for each state in the us_airports object, and when clicked, it calls the + * loadAirport function with the state as the argument. + */ function initializeSchedulesPage() { document.getElementById("itin_body").innerHTML = "" document.getElementById("itin_img").setAttribute("src", 'images/black.jpg') @@ -21,6 +25,10 @@ function initializeSchedulesPage() { } }) } +/** + * It loads the airports in a state. + * @param state - The state that the user has selected + */ function loadAirport(state) { document.getElementById("itin_img").setAttribute("src", 'images/black.jpg') @@ -51,7 +59,13 @@ function loadAirport(state) { } } } - +/* Retrieving the schedule for a given airport. */ +/** + * It takes in an airport code and state, and then it uses ajax to retrieve the airport's schedule from + * a server. + * @param airport - "KLAX" + * @param state - "California" + */ function retrieveSchedule(airport, state) { document.getElementById("itin_arr").style.display = "none" document.getElementById("itin_dep").style.display = "none"