]> begriffs open source - cmsis/blob - main/View/html/printComponentTabs.js
Update documentation for branch main
[cmsis] / main / View / html / printComponentTabs.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 + '/html/index.html"><span>' + this.tabTxt + '</span></a></li>';
9   this.listItem = '<li id="' + this.id + '"> <a href="../../' + this.folderName + '/html/index.html"><span>' + this.tabTxt + '</span></a></li>';
10 };
11
12 // array of objects
13 var arr = [];
14
15 // fill array
16  arr.push( new tabElement( "GEN",     "General",     "Overview"));
17  arr.push( new tabElement( "CORE_A",  "Core_A",      "CMSIS-Core (A)"));
18  arr.push( new tabElement( "CORE_M",  "Core",        "CMSIS-Core (M)"));
19  arr.push( new tabElement( "DRV",     "Driver",      "CMSIS-Driver"));
20  arr.push( new tabElement( "RTOS2",   "RTOS2",       "CMSIS-RTOS2"));
21
22 // write tabs
23 // called from the header file.
24 function writeComponentTabs()  {
25   for ( var i=0; i < arr.length; i++ ) {
26     str = "/" + arr[i].folderName + "/"
27     if (strgURL.search(str) > 0) {                    // if this is the current folder
28       document.write(arr[i].currentListItem);                       // then print and highlight the tab
29     } else {
30       document.write(arr[i].listItem);                              // else, print the tab
31     }
32   }
33 };