navtree.js 16 KB

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