OpenCores
URL https://opencores.org/ocsvn/avs_aes/avs_aes/trunk

Subversion Repositories avs_aes

[/] [avs_aes/] [trunk/] [doc/] [sw/] [html/] [navtree.js] - Blame information for rev 21

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.