2020-07-29 23:47:24 -04:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
let version = DOCUMENTATION_OPTIONS.VERSION;
|
|
|
|
let language = DOCUMENTATION_OPTIONS.LANGUAGE;
|
|
|
|
let idf_target = DOCUMENTATION_OPTIONS.IDF_TARGET;
|
|
|
|
let pagename = DOCUMENTATION_OPTIONS.PAGENAME + ".html";
|
|
|
|
|
|
|
|
let defaults = DOCUMENTATION_VERSIONS.DEFAULTS;
|
|
|
|
let versions = DOCUMENTATION_VERSIONS.VERSIONS;
|
|
|
|
|
|
|
|
/* Apply the defaults to each version, where needed */
|
|
|
|
for (let i = 0; i < versions.length; i++) {
|
|
|
|
let v = versions[i];
|
|
|
|
for (let d in defaults) {
|
|
|
|
if (!(d in v)) {
|
|
|
|
v[d] = defaults[d];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the (relative) base URL for this project, finding a sibling URL will be built as follows:
|
|
|
|
<project_base_url>/<language>/<version>/<idf_target>
|
|
|
|
|
|
|
|
(Where 'idf_target' path element are optional depending on if the project has multiple target support)
|
|
|
|
*/
|
2021-09-02 22:29:19 -04:00
|
|
|
let project_base_url = DOCUMENTATION_OPTIONS.URL_ROOT + "../../..";
|
2020-07-29 23:47:24 -04:00
|
|
|
if (DOCUMENTATION_OPTIONS.IDF_TARGETS) {
|
|
|
|
project_base_url += "/..";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a version from the list, return the URL to link to it */
|
|
|
|
function getVersionUrl(v) {
|
|
|
|
let result = project_base_url + "/" + language + "/" + v.name;
|
|
|
|
if (v.has_targets) {
|
|
|
|
result += "/" + (idf_target || "esp32");
|
|
|
|
}
|
|
|
|
|
|
|
|
return result + "/";
|
|
|
|
};
|
|
|
|
|
2023-07-20 04:06:36 -04:00
|
|
|
function getReleaseNotesUrl(v){
|
|
|
|
if (v.name.indexOf("release") !== 0) {
|
|
|
|
let releaseNotesUrl = "https://github.com/espressif/esp-idf/releases/tag/" + v.name;
|
|
|
|
return releaseNotesUrl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-02 22:29:19 -04:00
|
|
|
old_ver_table = "";
|
|
|
|
old_ver_table_row = "<tr>"
|
|
|
|
let row_items = 0;
|
2023-07-20 04:06:36 -04:00
|
|
|
const ITEMS_PER_ROW = 3;
|
2020-07-29 23:47:24 -04:00
|
|
|
|
|
|
|
for (let i = 0; i < versions.length; i++) {
|
|
|
|
let v = versions[i];
|
|
|
|
let url = getVersionUrl(v);
|
2023-07-20 04:06:36 -04:00
|
|
|
let releaseNotesUrl = getReleaseNotesUrl(v);
|
2020-07-29 23:47:24 -04:00
|
|
|
|
|
|
|
if (v.old) {
|
2023-07-20 04:06:36 -04:00
|
|
|
if (releaseNotesUrl){
|
|
|
|
old_ver_table_row += "<td><a href=\"" + url + "\">" + v.name + " - <a href=\"" + releaseNotesUrl + "\">Release Notes</a></td>";
|
|
|
|
} else {
|
|
|
|
old_ver_table_row += "<td><a href=\"" + url + "\">" + v.name + "</td>";
|
|
|
|
}
|
|
|
|
|
2021-09-02 22:29:19 -04:00
|
|
|
row_items++;
|
2023-07-20 04:06:36 -04:00
|
|
|
|
2021-09-02 22:29:19 -04:00
|
|
|
if (row_items === ITEMS_PER_ROW) {
|
2023-07-20 04:06:36 -04:00
|
|
|
old_ver_table_row += "</tr>";
|
|
|
|
old_ver_table += old_ver_table_row;
|
2021-09-02 22:29:19 -04:00
|
|
|
|
|
|
|
/* Prepare a new row */
|
|
|
|
old_ver_table_row = "<tr>"
|
|
|
|
row_items = 0
|
|
|
|
}
|
2020-07-29 23:47:24 -04:00
|
|
|
}
|
|
|
|
}
|
2023-07-20 04:06:36 -04:00
|
|
|
old_ver_table_row += "</tr>";
|
|
|
|
old_ver_table += old_ver_table_row;
|
2020-07-29 23:47:24 -04:00
|
|
|
|
2021-09-02 22:29:19 -04:00
|
|
|
$( "#version_table" ).append(old_ver_table);
|
2020-07-29 23:47:24 -04:00
|
|
|
});
|