1$(document).ready(function() { 2 3 let version = DOCUMENTATION_OPTIONS.VERSION; 4 let language = DOCUMENTATION_OPTIONS.LANGUAGE; 5 let idf_target = DOCUMENTATION_OPTIONS.IDF_TARGET; 6 let pagename = DOCUMENTATION_OPTIONS.PAGENAME + ".html"; 7 8 let defaults = DOCUMENTATION_VERSIONS.DEFAULTS; 9 let versions = DOCUMENTATION_VERSIONS.VERSIONS; 10 11 /* Apply the defaults to each version, where needed */ 12 for (let i = 0; i < versions.length; i++) { 13 let v = versions[i]; 14 for (let d in defaults) { 15 if (!(d in v)) { 16 v[d] = defaults[d]; 17 } 18 } 19 } 20 21 /* Find the (relative) base URL for this project, finding a sibling URL will be built as follows: 22 <project_base_url>/<language>/<version>/<idf_target> 23 24 (Where 'idf_target' path element are optional depending on if the project has multiple target support) 25 */ 26 let project_base_url = DOCUMENTATION_OPTIONS.URL_ROOT + "../.."; 27 if (DOCUMENTATION_OPTIONS.IDF_TARGETS) { 28 project_base_url += "/.."; 29 } 30 31 /* Given a version from the list, return the URL to link to it */ 32 function getVersionUrl(v) { 33 let result = project_base_url + "/" + language + "/" + v.name; 34 if (v.has_targets) { 35 result += "/" + (idf_target || "esp32"); 36 } 37 38 return result + "/"; 39 }; 40 41 old_ver_list = ""; 42 43 for (let i = 0; i < versions.length; i++) { 44 let v = versions[i]; 45 let url = getVersionUrl(v); 46 47 if (v.old) { 48 old_ver_list += "<li><a href=\"" + url + "\">" + v.name + "</li>"; 49 } 50 51 } 52 53 $( "#version_list" ).append(old_ver_list); 54}); 55