]> begriffs open source - cmsis-driver-validation/blob - docs/html/navtree.js
fixed release history
[cmsis-driver-validation] / docs / html / navtree.js
1 var NAVTREE =
2 [
3   [ "CMSIS-Driver Validation", "index.html", [
4     [ "Introduction", "index.html", null ],
5     [ "Test Setup", "test_setup.html", [
6       [ "Step 1: Create an MDK project with your target microcontroller device", "test_setup.html#step1", null ],
7       [ "Step 2: Add required software components", "test_setup.html#step2", null ],
8       [ "Step 3: Add main.c", "test_setup.html#step3", null ],
9       [ "Step 4: Configure DV_Config.h", "test_setup.html#step4", null ],
10       [ "Step 5: Configure Keil RTX5", "test_setup.html#step5", null ],
11       [ "Step 6: Configure Heap", "test_setup.html#step6", null ],
12       [ "Step 7: Configure the Device", "test_setup.html#step7", null ],
13       [ "Step 8: Make Hardware Connections for Loopback Tests", "test_setup.html#step8", null ],
14       [ "Step 9: Download and Run the Project", "test_setup.html#step9", null ]
15     ] ],
16     [ "Reading Test Results", "test_results.html", null ],
17     [ "Examples", "examples.html", "examples" ],
18     [ "Resource Requirements", "resource_requirements.html", [
19       [ "Heap Requirements", "resource_requirements.html#heap_req", null ],
20       [ "CMSIS-RTOS2 Requirements", "resource_requirements.html#rtos2_req", null ],
21       [ "CMSIS-RTOS Requirements", "resource_requirements.html#rtos_req", null ]
22     ] ],
23     [ "Reference", "modules.html", "modules" ],
24     [ "Data Structures", "annotated.html", "annotated" ],
25     [ "Data Structure Index", "classes.html", null ],
26     [ "Data Fields", "functions.html", [
27       [ "All", "functions.html", null ],
28       [ "Variables", "functions_vars.html", null ]
29     ] ]
30   ] ]
31 ];
32
33 var NAVTREEINDEX =
34 [
35 "annotated.html",
36 "struct_i_o___r_e_c_v_f_r_o_m.html#ad7a0b7fadc2f226af80409011d8bc885"
37 ];
38
39 var SYNCONMSG = 'click to disable panel synchronisation';
40 var SYNCOFFMSG = 'click to enable panel synchronisation';
41 var SYNCONMSG = 'click to disable panel synchronisation';
42 var SYNCOFFMSG = 'click to enable panel synchronisation';
43 var navTreeSubIndices = new Array();
44
45 function getData(varName)
46 {
47   var i = varName.lastIndexOf('/');
48   var n = i>=0 ? varName.substring(i+1) : varName;
49   return eval(n.replace(/\-/g,'_'));
50 }
51
52 function stripPath(uri)
53 {
54   return uri.substring(uri.lastIndexOf('/')+1);
55 }
56
57 function stripPath2(uri)
58 {
59   var i = uri.lastIndexOf('/');
60   var s = uri.substring(i+1);
61   var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
62   return m ? uri.substring(i-6) : s;
63 }
64
65 function localStorageSupported()
66 {
67   try {
68     return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
69   }
70   catch(e) {
71     return false;
72   }
73 }
74
75
76 function storeLink(link)
77 {
78   if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
79       window.localStorage.setItem('navpath',link);
80   }
81 }
82
83 function deleteLink()
84 {
85   if (localStorageSupported()) {
86     window.localStorage.setItem('navpath','');
87   } 
88 }
89
90 function cachedLink()
91 {
92   if (localStorageSupported()) {
93     return window.localStorage.getItem('navpath');
94   } else {
95     return '';
96   }
97 }
98
99 function getScript(scriptName,func,show)
100 {
101   var head = document.getElementsByTagName("head")[0]; 
102   var script = document.createElement('script');
103   script.id = scriptName;
104   script.type = 'text/javascript';
105   script.onload = func; 
106   script.src = scriptName+'.js'; 
107   if ($.browser.msie && $.browser.version<=8) { 
108     // script.onload does not work with older versions of IE
109     script.onreadystatechange = function() {
110       if (script.readyState=='complete' || script.readyState=='loaded') { 
111         func(); if (show) showRoot(); 
112       }
113     }
114   }
115   head.appendChild(script); 
116 }
117
118 function createIndent(o,domNode,node,level)
119 {
120   var level=-1;
121   var n = node;
122   while (n.parentNode) { level++; n=n.parentNode; }
123   if (node.childrenData) {
124     var imgNode = document.createElement("img");
125     imgNode.style.paddingLeft=(16*level).toString()+'px';
126     imgNode.width  = 16;
127     imgNode.height = 22;
128     imgNode.border = 0;
129     node.plus_img = imgNode;
130     node.expandToggle = document.createElement("a");
131     node.expandToggle.href = "javascript:void(0)";
132     node.expandToggle.onclick = function() {
133       if (node.expanded) {
134         $(node.getChildrenUL()).slideUp("fast");
135         node.plus_img.src = node.relpath+"ftv2pnode.png";
136         node.expanded = false;
137       } else {
138         expandNode(o, node, false, false);
139       }
140     }
141     node.expandToggle.appendChild(imgNode);
142     domNode.appendChild(node.expandToggle);
143     imgNode.src = node.relpath+"ftv2pnode.png";
144   } else {
145     var span = document.createElement("span");
146     span.style.display = 'inline-block';
147     span.style.width   = 16*(level+1)+'px';
148     span.style.height  = '22px';
149     span.innerHTML = '&#160;';
150     domNode.appendChild(span);
151   } 
152 }
153
154 var animationInProgress = false;
155
156 function gotoAnchor(anchor,aname,updateLocation)
157 {
158   var pos, docContent = $('#doc-content');
159   if (anchor.parent().attr('class')=='memItemLeft' ||
160       anchor.parent().attr('class')=='fieldtype' ||
161       anchor.parent().is(':header')) 
162   {
163     pos = anchor.parent().position().top;
164   } else if (anchor.position()) {
165     pos = anchor.position().top;
166   }
167   if (pos) {
168     var dist = Math.abs(Math.min(
169                pos-docContent.offset().top,
170                docContent[0].scrollHeight-
171                docContent.height()-docContent.scrollTop()));
172     animationInProgress=true;
173     docContent.animate({
174       scrollTop: pos + docContent.scrollTop() - docContent.offset().top
175     },Math.max(50,Math.min(500,dist)),function(){
176       if (updateLocation) window.location.href=aname;
177       animationInProgress=false;
178     });
179   }
180 }
181
182 function newNode(o, po, text, link, childrenData, lastNode)
183 {
184   var node = new Object();
185   node.children = Array();
186   node.childrenData = childrenData;
187   node.depth = po.depth + 1;
188   node.relpath = po.relpath;
189   node.isLast = lastNode;
190
191   node.li = document.createElement("li");
192   po.getChildrenUL().appendChild(node.li);
193   node.parentNode = po;
194
195   node.itemDiv = document.createElement("div");
196   node.itemDiv.className = "item";
197
198   node.labelSpan = document.createElement("span");
199   node.labelSpan.className = "label";
200
201   createIndent(o,node.itemDiv,node,0);
202   node.itemDiv.appendChild(node.labelSpan);
203   node.li.appendChild(node.itemDiv);
204
205   var a = document.createElement("a");
206   node.labelSpan.appendChild(a);
207   node.label = document.createTextNode(text);
208   node.expanded = false;
209   a.appendChild(node.label);
210   if (link) {
211     var url;
212     if (link.substring(0,1)=='^') {
213       url = link.substring(1);
214       link = url;
215     } else {
216       url = node.relpath+link;
217     }
218     a.className = stripPath(link.replace('#',':'));
219     if (link.indexOf('#')!=-1) {
220       var aname = '#'+link.split('#')[1];
221       var srcPage = stripPath($(location).attr('pathname'));
222       var targetPage = stripPath(link.split('#')[0]);
223       a.href = srcPage!=targetPage ? url : "javascript:void(0)"; 
224       a.onclick = function(){
225         storeLink(link);
226         if (!$(a).parent().parent().hasClass('selected'))
227         {
228           $('.item').removeClass('selected');
229           $('.item').removeAttr('id');
230           $(a).parent().parent().addClass('selected');
231           $(a).parent().parent().attr('id','selected');
232         }
233         var anchor = $(aname);
234         gotoAnchor(anchor,aname,true);
235       };
236     } else {
237       a.href = url;
238       a.onclick = function() { storeLink(link); }
239     }
240   } else {
241     if (childrenData != null) 
242     {
243       a.className = "nolink";
244       a.href = "javascript:void(0)";
245       a.onclick = node.expandToggle.onclick;
246     }
247   }
248
249   node.childrenUL = null;
250   node.getChildrenUL = function() {
251     if (!node.childrenUL) {
252       node.childrenUL = document.createElement("ul");
253       node.childrenUL.className = "children_ul";
254       node.childrenUL.style.display = "none";
255       node.li.appendChild(node.childrenUL);
256     }
257     return node.childrenUL;
258   };
259
260   return node;
261 }
262
263 function showRoot()
264 {
265   var headerHeight = $("#top").height();
266   var footerHeight = $("#nav-path").height();
267   var windowHeight = $(window).height() - headerHeight - footerHeight;
268   (function (){ // retry until we can scroll to the selected item
269     try {
270       var navtree=$('#nav-tree');
271       navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
272     } catch (err) {
273       setTimeout(arguments.callee, 0);
274     }
275   })();
276 }
277
278 function expandNode(o, node, imm, showRoot)
279 {
280   if (node.childrenData && !node.expanded) {
281     if (typeof(node.childrenData)==='string') {
282       var varName    = node.childrenData;
283       getScript(node.relpath+varName,function(){
284         node.childrenData = getData(varName);
285         expandNode(o, node, imm, showRoot);
286       }, showRoot);
287     } else {
288       if (!node.childrenVisited) {
289         getNode(o, node);
290       } if (imm || ($.browser.msie && $.browser.version>8)) { 
291         // somehow slideDown jumps to the start of tree for IE9 :-(
292         $(node.getChildrenUL()).show();
293       } else {
294         $(node.getChildrenUL()).slideDown("fast");
295       }
296       if (node.isLast) {
297         node.plus_img.src = node.relpath+"ftv2mlastnode.png";
298       } else {
299         node.plus_img.src = node.relpath+"ftv2mnode.png";
300       }
301       node.expanded = true;
302     }
303   }
304 }
305
306 function glowEffect(n,duration)
307 {
308   n.addClass('glow').delay(duration).queue(function(next){
309     $(this).removeClass('glow');next();
310   });
311 }
312
313 function highlightAnchor()
314 {
315   var aname = $(location).attr('hash');
316   var anchor = $(aname);
317   if (anchor.parent().attr('class')=='memItemLeft'){
318     var rows = $('.memberdecls tr[class$="'+
319                window.location.hash.substring(1)+'"]');
320     glowEffect(rows.children(),300); // member without details
321   } else if (anchor.parents().slice(2).prop('tagName')=='TR') {
322     glowEffect(anchor.parents('div.memitem'),1000); // enum value
323   } else if (anchor.parent().attr('class')=='fieldtype'){
324     glowEffect(anchor.parent().parent(),1000); // struct field
325   } else if (anchor.parent().is(":header")) {
326     glowEffect(anchor.parent(),1000); // section header
327   } else {
328     glowEffect(anchor.next(),1000); // normal member
329   }
330   gotoAnchor(anchor,aname,false);
331 }
332
333 function selectAndHighlight(hash,n)
334 {
335   var a;
336   if (hash) {
337     var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);
338     a=$('.item a[class$="'+link+'"]');
339   }
340   if (a && a.length) {
341     a.parent().parent().addClass('selected');
342     a.parent().parent().attr('id','selected');
343     highlightAnchor();
344   } else if (n) {
345     $(n.itemDiv).addClass('selected');
346     $(n.itemDiv).attr('id','selected');
347   }
348   if ($('#nav-tree-contents .item:first').hasClass('selected')) {
349     $('#nav-sync').css('top','30px');
350   } else {
351     $('#nav-sync').css('top','5px');
352   }
353   showRoot();
354 }
355
356 function showNode(o, node, index, hash)
357 {
358   if (node && node.childrenData) {
359     if (typeof(node.childrenData)==='string') {
360       var varName    = node.childrenData;
361       getScript(node.relpath+varName,function(){
362         node.childrenData = getData(varName);
363         showNode(o,node,index,hash);
364       },true);
365     } else {
366       if (!node.childrenVisited) {
367         getNode(o, node);
368       }
369       $(node.getChildrenUL()).css({'display':'block'});
370       if (node.isLast) {
371         node.plus_img.src = node.relpath+"ftv2mlastnode.png";
372       } else {
373         node.plus_img.src = node.relpath+"ftv2mnode.png";
374       }
375       node.expanded = true;
376       var n = node.children[o.breadcrumbs[index]];
377       if (index+1<o.breadcrumbs.length) {
378         showNode(o,n,index+1,hash);
379       } else {
380         if (typeof(n.childrenData)==='string') {
381           var varName = n.childrenData;
382           getScript(n.relpath+varName,function(){
383             n.childrenData = getData(varName);
384             node.expanded=false;
385             showNode(o,node,index,hash); // retry with child node expanded
386           },true);
387         } else {
388           var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
389           if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
390             expandNode(o, n, true, true);
391           }
392           selectAndHighlight(hash,n);
393         }
394       }
395     }
396   } else {
397     selectAndHighlight(hash);
398   }
399 }
400
401 function removeToInsertLater(element) {
402   var parentNode = element.parentNode;
403   var nextSibling = element.nextSibling;
404   parentNode.removeChild(element);
405   return function() {
406     if (nextSibling) {
407       parentNode.insertBefore(element, nextSibling);
408     } else {
409       parentNode.appendChild(element);
410     }
411   };
412 }
413
414 function getNode(o, po)
415 {
416   var insertFunction = removeToInsertLater(po.li);
417   po.childrenVisited = true;
418   var l = po.childrenData.length-1;
419   for (var i in po.childrenData) {
420     var nodeData = po.childrenData[i];
421     po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
422       i==l);
423   }
424   insertFunction();
425 }
426
427 function gotoNode(o,subIndex,root,hash,relpath)
428 {
429   var nti = navTreeSubIndices[subIndex][root+hash];
430   o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
431   if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
432     navTo(o,NAVTREE[0][1],"",relpath);
433     $('.item').removeClass('selected');
434     $('.item').removeAttr('id');
435   }
436   if (o.breadcrumbs) {
437     o.breadcrumbs.unshift(0); // add 0 for root node
438     showNode(o, o.node, 0, hash);
439   }
440 }
441
442 function navTo(o,root,hash,relpath)
443 {
444   var link = cachedLink();
445   if (link) {
446     var parts = link.split('#');
447     root = parts[0];
448     if (parts.length>1) hash = '#'+parts[1];
449     else hash='';
450   }
451   if (hash.match(/^#l\d+$/)) {
452     var anchor=$('a[name='+hash.substring(1)+']');
453     glowEffect(anchor.parent(),1000); // line number
454     hash=''; // strip line number anchors
455     //root=root.replace(/_source\./,'.'); // source link to doc link
456   }
457   var url=root+hash;
458   var i=-1;
459   while (NAVTREEINDEX[i+1]<=url) i++;
460   if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
461   if (navTreeSubIndices[i]) {
462     gotoNode(o,i,root,hash,relpath)
463   } else {
464     getScript(relpath+'navtreeindex'+i,function(){
465       navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
466       if (navTreeSubIndices[i]) {
467         gotoNode(o,i,root,hash,relpath);
468       }
469     },true);
470   }
471 }
472
473 function showSyncOff(n,relpath)
474 {
475     n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
476 }
477
478 function showSyncOn(n,relpath)
479 {
480     n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
481 }
482
483 function toggleSyncButton(relpath)
484 {
485   var navSync = $('#nav-sync');
486   if (navSync.hasClass('sync')) {
487     navSync.removeClass('sync');
488     showSyncOff(navSync,relpath);
489     storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash'));
490   } else {
491     navSync.addClass('sync');
492     showSyncOn(navSync,relpath);
493     deleteLink();
494   }
495 }
496
497 function initNavTree(toroot,relpath)
498 {
499   var o = new Object();
500   o.toroot = toroot;
501   o.node = new Object();
502   o.node.li = document.getElementById("nav-tree-contents");
503   o.node.childrenData = NAVTREE;
504   o.node.children = new Array();
505   o.node.childrenUL = document.createElement("ul");
506   o.node.getChildrenUL = function() { return o.node.childrenUL; };
507   o.node.li.appendChild(o.node.childrenUL);
508   o.node.depth = 0;
509   o.node.relpath = relpath;
510   o.node.expanded = false;
511   o.node.isLast = true;
512   o.node.plus_img = document.createElement("img");
513   o.node.plus_img.src = relpath+"ftv2pnode.png";
514   o.node.plus_img.width = 16;
515   o.node.plus_img.height = 22;
516
517   if (localStorageSupported()) {
518     var navSync = $('#nav-sync');
519     if (cachedLink()) {
520       showSyncOff(navSync,relpath);
521       navSync.removeClass('sync');
522     } else {
523       showSyncOn(navSync,relpath);
524     }
525     navSync.click(function(){ toggleSyncButton(relpath); });
526   }
527
528   $(window).load(function(){
529     navTo(o,toroot,window.location.hash,relpath);
530     showRoot();
531   });
532
533   $(window).bind('hashchange', function(){
534      if (window.location.hash && window.location.hash.length>1){
535        var a;
536        if ($(location).attr('hash')){
537          var clslink=stripPath($(location).attr('pathname'))+':'+
538                                $(location).attr('hash').substring(1);
539          a=$('.item a[class$="'+clslink+'"]');
540        }
541        if (a==null || !$(a).parent().parent().hasClass('selected')){
542          $('.item').removeClass('selected');
543          $('.item').removeAttr('id');
544        }
545        var link=stripPath2($(location).attr('pathname'));
546        navTo(o,link,$(location).attr('hash'),relpath);
547      } else if (!animationInProgress) {
548        $('#doc-content').scrollTop(0);
549        $('.item').removeClass('selected');
550        $('.item').removeAttr('id');
551        navTo(o,toroot,window.location.hash,relpath);
552      }
553   })
554 }
555