]> begriffs open source - cmsis/blob - v6.0.0/Zone/tabs.js
Update documentation for branch main
[cmsis] / v6.0.0 / Zone / tabs.js
1 var strgURL =   location.pathname;                      // path of current component
2
3 // constructor for the array of objects
4 function tabElement(id, folderName, tabTxt )  {
5   this.id = id;                                       // elementID as needed in html;
6   this.folderName = folderName;                       // folder name of the component
7   this.tabTxt = tabTxt;                               // Text displayed as menu on the web
8   this.currentListItem = '<li id="' + this.id + '" class="current"> <a href="../' + this.folderName + '/index.html"><span>' + this.tabTxt + '</span></a></li>';
9   this.listItem = '<li id="' + this.id + '"> <a href="../' + this.folderName + '/index.html"><span>' + this.tabTxt + '</span></a></li>';
10 };
11
12 // constructor for the array of objects
13 function tabSubElement(id, folderName, tabTxt )  {
14   this.id = id;                                       // elementID as needed in html;
15   this.folderName = folderName;                       // folder name of the component
16   this.tabTxt = tabTxt;                               // Text displayed as menu on the web
17   this.currentListItem = '<li id="' + this.id + '" class="current"> <a href="../../' + this.folderName + '/index.html"><span>' + this.tabTxt + '</span></a></li>';
18   this.listItem = '<li id="' + this.id + '"> <a href="../' + this.folderName + '/index.html"><span>' + this.tabTxt + '</span></a></li>';
19 };
20
21 // array of main tabs
22 var arr = [];
23
24 // fill array
25  arr.push( new tabElement( "GEN",     "General",     "Overview"));
26  arr.push( new tabElement( "CORE",    "Core",        "Core"));
27  arr.push( new tabElement( "DRV",     "Driver",      "Driver"));
28  arr.push( new tabElement( "RTOS2",   "RTOS2",       "RTOS2"));
29  arr.push( new tabElement( "DSP",     "DSP",         "DSP"));
30  arr.push( new tabElement( "NN",      "NN",          "NN"));
31  arr.push( new tabElement( "View",    "View",        "View"));
32  arr.push( new tabElement( "Compiler","Compiler",    "Compiler"));
33  arr.push( new tabElement( "Toolbox", "Toolbox",     "Toolbox"));
34  arr.push( new tabElement( "Stream",  "Stream",      "Stream"));
35  arr.push( new tabElement( "DAP",     "DAP",         "DAP"));
36  arr.push( new tabElement( "Zone",    "Zone",        "Zone"));
37  
38 // array of sub tabs fore Core
39 var arr_sub = [];
40  arr_sub.push( new tabSubElement( "CORE_M",  "Core",     "Cortex-M"));
41  arr_sub.push( new tabSubElement( "CORE_A",  "Core_A",   "Cortex-A"));
42
43 // write main tabs
44 // called from the header file
45 function writeComponentTabs()  {
46   for ( var i=0; i < arr.length; i++ ) {
47     str = "/" + arr[i].folderName + "/"
48     if (strgURL.search(str) > 0) {                    // if this is the current folder
49       document.write(arr[i].currentListItem);         // then print and highlight the tab
50     } else {
51       // specially for Core_A need to highlight the Core tab too
52       if ((arr[i].id=="CORE") && (strgURL.search("/Core_A/")>0)){
53         document.write(arr[i].currentListItem);         // then print and highlight the tab
54       } else {
55          document.write(arr[i].listItem);                // else, print the tab
56       }
57     }
58   }
59 };
60
61 // write sub-tabs (can't use layout XML as will show all other sub-tabs as well (API, usage, et.))
62 // called from the header file
63 function writeSubComponentTabs()  {
64   if((strgURL.search("/Core/")>0)||(strgURL.search("/Core_A/")>0)){
65     document.write('<div id="navrow1" class="tabs">');
66     document.write('<ul class="tablist">');
67     for ( var i=0; i < arr_sub.length; i++ ) {
68       str = "/" + arr_sub[i].folderName + "/"
69       if (strgURL.search(str) > 0) {                    // if this is the current folder
70           document.write(arr_sub[i].currentListItem);         // then print and highlight the tab
71        } else {
72         document.write(arr_sub[i].listItem);                              // else, print the tab
73       }
74     }
75     document.write('</ul>');
76     document.write('</div>');
77   }
78 };