libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
navtree.js
Ir a la documentación de este archivo.
1 var NAVTREE =
2 [
3  [ "libmoldeo (Moldeo 1.0 Core)", "index.html", [
4  [ "MoldeoFunctions", "_moldeo_functions.html", null ],
5  [ "Lista de pruebas", "test.html", null ],
6  [ "Módulos", "modules.html", "modules" ],
7  [ "Namespaces", null, [
8  [ "Lista de 'namespaces'", "namespaces.html", "namespaces" ],
9  [ "Miembros del Namespace ", "namespacemembers.html", [
10  [ "Todo", "namespacemembers.html", null ],
11  [ "'typedefs'", "namespacemembers_type.html", null ],
12  [ "Enumeraciones", "namespacemembers_enum.html", null ],
13  [ "Valores de enumeraciones", "namespacemembers_eval.html", null ]
14  ] ]
15  ] ],
16  [ "Clases", null, [
17  [ "Lista de clases", "annotated.html", "annotated" ],
18  [ "Índice de clases", "classes.html", null ],
19  [ "Jerarquía de la clase", "hierarchy.html", "hierarchy" ],
20  [ "Miembros de las clases", "functions.html", [
21  [ "Todo", "functions.html", "functions_dup" ],
22  [ "Funciones", "functions_func.html", "functions_func" ],
23  [ "Variables", "functions_vars.html", "functions_vars" ],
24  [ "'typedefs'", "functions_type.html", null ],
25  [ "Enumeraciones", "functions_enum.html", null ],
26  [ "Valores de enumeraciones", "functions_eval.html", null ],
27  [ "Funciones relacionadas", "functions_rela.html", null ]
28  ] ]
29  ] ],
30  [ "Archivos", null, [
31  [ "Lista de archivos", "files.html", "files" ],
32  [ "Miembros de los ficheros", "globals.html", [
33  [ "Todo", "globals.html", "globals_dup" ],
34  [ "Funciones", "globals_func.html", "globals_func" ],
35  [ "Variables", "globals_vars.html", "globals_vars" ],
36  [ "'typedefs'", "globals_type.html", null ],
37  [ "Enumeraciones", "globals_enum.html", null ],
38  [ "Valores de enumeraciones", "globals_eval.html", "globals_eval" ],
39  [ "'defines'", "globals_defs.html", "globals_defs" ]
40  ] ]
41  ] ]
42  ] ]
43 ];
44 
45 var NAVTREEINDEX =
46 [
47 "_moldeo_functions.html",
48 "class_o_g_l_f_t_1_1_face.html#a82474cfad525291b05f33af8b828ce4da56e437a6ed98d67a9f203861a36103a9",
49 "classes__2_8js_source.html",
50 "classmo__data__session_8js_source.html",
51 "classmo__net__connection__manager_8js.html",
52 "classmo__timer__absolute_8js.html#a420dc31e5ef7e37ddbe760608c0b65dd",
53 "classmo_color_matrix.html#a1e5fe0bd04863b867172025ba8355cf8",
54 "classmo_console.html#a85306c215be78a85318caf6892d3faf5",
55 "classmo_d_vector.html#add93cd74da704ed3ad6cc4715014b675",
56 "classmo_directory.html#a05eb898c293c8600d666f3e0658abdb2",
57 "classmo_event.html#ab379bbf91ce1a219f365c26dc8bf253b",
58 "classmo_g_l_matrixf.html#a6686014d541d80acf2b4a1dd8ec67563",
59 "classmo_l_o_d.html#a3872c6bc56e0dfb0984ce82fe1669727",
60 "classmo_math_function_index.html#add9a64d97e53cafa94b8bce31e4d5866",
61 "classmo_moldeo_object.html#ade861ca517d1128a5a1abdd6462b0905",
62 "classmo_param_definition.html#aa2865ca6e61c890a53d92cd00aa454f9",
63 "classmo_quaternion.html#a3e172ecd6647474a8ff047081507befe",
64 "classmo_scene_node.html#ad407f8ea1403c713a0ee8113b81175a6",
65 "classmo_sound3_d.html#af6d212301b463d33c650af217d3e566b",
66 "classmo_texture.html#a70c579958eed08153b5c2fc559dc36de",
67 "classmo_texture_manager.html#a1d94bfd6bb26d364b9228aa48291aae3",
68 "classmo_tracker_system_data.html#a6c3dc46029e608cf09165a71693838b4",
69 "classmo_vector4.html#a31dbf14ef08c043ff413f66e3ef91bec",
70 "defines__11_8js.html#ad01a7523f103d6242ef9b0451861231e",
71 "est_2mo_text_8h.html#aa65c5deed0e2a106304b850389d8a8e1",
72 "functions__6_8js.html#a5dbc6b688a8928cf205f09d959158ca0",
73 "globals_vars_p.html",
74 "mo3ds_8h.html#a61ff91c6ac2171b70eaf9192045a4dc1",
75 "mo__param__8cpp_8js.html#a1d0bb663d7a310cc68b8c42340c6a7aa",
76 "mo_array_8h_source.html",
77 "mo_filter_manager_8h.html#a7873221f7151a379d181f960663ddfa8",
78 "mo_luna_classes_8cpp.html#adf56be672f7cbd7f454ab05872a507cf",
79 "mo_math_polynomial_8h.html#ab3e0fc3d5da01039ca4763e451c28b97",
80 "mo_port_8h.html#af5978fab9fa6dd4ced1c3a8ab1251f7b",
81 "mo_text_8h.html#aabe47ba16af2a3b8ea84dffa96fc867b",
82 "mo_types_8h.html#aed7020bc1becef6aa9d3d5623e66dfc2",
83 "navtree_8js.html#a646cb31d83b39aafec92e0e1d123563a",
84 "structmo__luna__1__1__function__type_8js.html",
85 "variables__13_8js_source.html"
86 ];
87 
88 var SYNCONMSG = 'click en deshabilitar sincronización';
89 var SYNCOFFMSG = 'click en habilitar sincronización';
90 var navTreeSubIndices = new Array();
91 
92 function getData(varName)
93 {
94  var i = varName.lastIndexOf('/');
95  var n = i>=0 ? varName.substring(i+1) : varName;
96  return eval(n.replace(/\-/g,'_'));
97 }
98 
99 function stripPath(uri)
100 {
101  return uri.substring(uri.lastIndexOf('/')+1);
102 }
103 
104 function stripPath2(uri)
105 {
106  var i = uri.lastIndexOf('/');
107  var s = uri.substring(i+1);
108  var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
109  return m ? uri.substring(i-6) : s;
110 }
111 
112 function hashValue()
113 {
114  return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,'');
115 }
116 
117 function hashUrl()
118 {
119  return '#'+hashValue();
120 }
121 
122 function pathName()
123 {
124  return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, '');
125 }
126 
127 function localStorageSupported()
128 {
129  try {
130  return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
131  }
132  catch(e) {
133  return false;
134  }
135 }
136 
137 
138 function storeLink(link)
139 {
140  if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
141  window.localStorage.setItem('navpath',link);
142  }
143 }
144 
145 function deleteLink()
146 {
147  if (localStorageSupported()) {
148  window.localStorage.setItem('navpath','');
149  }
150 }
151 
152 function cachedLink()
153 {
154  if (localStorageSupported()) {
155  return window.localStorage.getItem('navpath');
156  } else {
157  return '';
158  }
159 }
160 
161 function getScript(scriptName,func,show)
162 {
163  var head = document.getElementsByTagName("head")[0];
164  var script = document.createElement('script');
165  script.id = scriptName;
166  script.type = 'text/javascript';
167  script.onload = func;
168  script.src = scriptName+'.js';
169  if ($.browser.msie && $.browser.version<=8) {
170  // script.onload does not work with older versions of IE
171  script.onreadystatechange = function() {
172  if (script.readyState=='complete' || script.readyState=='loaded') {
173  func(); if (show) showRoot();
174  }
175  }
176  }
177  head.appendChild(script);
178 }
179 
180 function createIndent(o,domNode,node,level)
181 {
182  var level=-1;
183  var n = node;
184  while (n.parentNode) { level++; n=n.parentNode; }
185  if (node.childrenData) {
186  var imgNode = document.createElement("img");
187  imgNode.style.paddingLeft=(16*level).toString()+'px';
188  imgNode.width = 16;
189  imgNode.height = 22;
190  imgNode.border = 0;
191  node.plus_img = imgNode;
192  node.expandToggle = document.createElement("a");
193  node.expandToggle.href = "javascript:void(0)";
194  node.expandToggle.onclick = function() {
195  if (node.expanded) {
196  $(node.getChildrenUL()).slideUp("fast");
197  node.plus_img.src = node.relpath+"ftv2pnode.png";
198  node.expanded = false;
199  } else {
200  expandNode(o, node, false, false);
201  }
202  }
203  node.expandToggle.appendChild(imgNode);
204  domNode.appendChild(node.expandToggle);
205  imgNode.src = node.relpath+"ftv2pnode.png";
206  } else {
207  var span = document.createElement("span");
208  span.style.display = 'inline-block';
209  span.style.width = 16*(level+1)+'px';
210  span.style.height = '22px';
211  span.innerHTML = '&#160;';
212  domNode.appendChild(span);
213  }
214 }
215 
216 var animationInProgress = false;
217 
218 function gotoAnchor(anchor,aname,updateLocation)
219 {
220  var pos, docContent = $('#doc-content');
221  var ancParent = $(anchor.parent());
222  if (ancParent.hasClass('memItemLeft') ||
223  ancParent.hasClass('fieldname') ||
224  ancParent.hasClass('fieldtype') ||
225  ancParent.is(':header'))
226  {
227  pos = ancParent.position().top;
228  } else if (anchor.position()) {
229  pos = anchor.position().top;
230  }
231  if (pos) {
232  var dist = Math.abs(Math.min(
233  pos-docContent.offset().top,
234  docContent[0].scrollHeight-
235  docContent.height()-docContent.scrollTop()));
236  animationInProgress=true;
237  docContent.animate({
238  scrollTop: pos + docContent.scrollTop() - docContent.offset().top
239  },Math.max(50,Math.min(500,dist)),function(){
240  if (updateLocation) window.location.href=aname;
241  animationInProgress=false;
242  });
243  }
244 }
245 
246 function newNode(o, po, text, link, childrenData, lastNode)
247 {
248  var node = new Object();
249  node.children = Array();
250  node.childrenData = childrenData;
251  node.depth = po.depth + 1;
252  node.relpath = po.relpath;
253  node.isLast = lastNode;
254 
255  node.li = document.createElement("li");
256  po.getChildrenUL().appendChild(node.li);
257  node.parentNode = po;
258 
259  node.itemDiv = document.createElement("div");
260  node.itemDiv.className = "item";
261 
262  node.labelSpan = document.createElement("span");
263  node.labelSpan.className = "label";
264 
265  createIndent(o,node.itemDiv,node,0);
266  node.itemDiv.appendChild(node.labelSpan);
267  node.li.appendChild(node.itemDiv);
268 
269  var a = document.createElement("a");
270  node.labelSpan.appendChild(a);
271  node.label = document.createTextNode(text);
272  node.expanded = false;
273  a.appendChild(node.label);
274  if (link) {
275  var url;
276  if (link.substring(0,1)=='^') {
277  url = link.substring(1);
278  link = url;
279  } else {
280  url = node.relpath+link;
281  }
282  a.className = stripPath(link.replace('#',':'));
283  if (link.indexOf('#')!=-1) {
284  var aname = '#'+link.split('#')[1];
285  var srcPage = stripPath(pathName());
286  var targetPage = stripPath(link.split('#')[0]);
287  a.href = srcPage!=targetPage ? url : "javascript:void(0)";
288  a.onclick = function(){
289  storeLink(link);
290  if (!$(a).parent().parent().hasClass('selected'))
291  {
292  $('.item').removeClass('selected');
293  $('.item').removeAttr('id');
294  $(a).parent().parent().addClass('selected');
295  $(a).parent().parent().attr('id','selected');
296  }
297  var anchor = $(aname);
298  gotoAnchor(anchor,aname,true);
299  };
300  } else {
301  a.href = url;
302  a.onclick = function() { storeLink(link); }
303  }
304  } else {
305  if (childrenData != null)
306  {
307  a.className = "nolink";
308  a.href = "javascript:void(0)";
309  a.onclick = node.expandToggle.onclick;
310  }
311  }
312 
313  node.childrenUL = null;
314  node.getChildrenUL = function() {
315  if (!node.childrenUL) {
316  node.childrenUL = document.createElement("ul");
317  node.childrenUL.className = "children_ul";
318  node.childrenUL.style.display = "none";
319  node.li.appendChild(node.childrenUL);
320  }
321  return node.childrenUL;
322  };
323 
324  return node;
325 }
326 
327 function showRoot()
328 {
329  var headerHeight = $("#top").height();
330  var footerHeight = $("#nav-path").height();
331  var windowHeight = $(window).height() - headerHeight - footerHeight;
332  (function (){ // retry until we can scroll to the selected item
333  try {
334  var navtree=$('#nav-tree');
335  navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
336  } catch (err) {
337  setTimeout(arguments.callee, 0);
338  }
339  })();
340 }
341 
342 function expandNode(o, node, imm, showRoot)
343 {
344  if (node.childrenData && !node.expanded) {
345  if (typeof(node.childrenData)==='string') {
346  var varName = node.childrenData;
347  getScript(node.relpath+varName,function(){
348  node.childrenData = getData(varName);
349  expandNode(o, node, imm, showRoot);
350  }, showRoot);
351  } else {
352  if (!node.childrenVisited) {
353  getNode(o, node);
354  } if (imm || ($.browser.msie && $.browser.version>8)) {
355  // somehow slideDown jumps to the start of tree for IE9 :-(
356  $(node.getChildrenUL()).show();
357  } else {
358  $(node.getChildrenUL()).slideDown("fast");
359  }
360  if (node.isLast) {
361  node.plus_img.src = node.relpath+"ftv2mlastnode.png";
362  } else {
363  node.plus_img.src = node.relpath+"ftv2mnode.png";
364  }
365  node.expanded = true;
366  }
367  }
368 }
369 
370 function glowEffect(n,duration)
371 {
372  n.addClass('glow').delay(duration).queue(function(next){
373  $(this).removeClass('glow');next();
374  });
375 }
376 
377 function highlightAnchor()
378 {
379  var aname = hashUrl();
380  var anchor = $(aname);
381  if (anchor.parent().attr('class')=='memItemLeft'){
382  var rows = $('.memberdecls tr[class$="'+hashValue()+'"]');
383  glowEffect(rows.children(),300); // member without details
384  } else if (anchor.parent().attr('class')=='fieldname'){
385  glowEffect(anchor.parent().parent(),1000); // enum value
386  } else if (anchor.parent().attr('class')=='fieldtype'){
387  glowEffect(anchor.parent().parent(),1000); // struct field
388  } else if (anchor.parent().is(":header")) {
389  glowEffect(anchor.parent(),1000); // section header
390  } else {
391  glowEffect(anchor.next(),1000); // normal member
392  }
393  gotoAnchor(anchor,aname,false);
394 }
395 
396 function selectAndHighlight(hash,n)
397 {
398  var a;
399  if (hash) {
400  var link=stripPath(pathName())+':'+hash.substring(1);
401  a=$('.item a[class$="'+link+'"]');
402  }
403  if (a && a.length) {
404  a.parent().parent().addClass('selected');
405  a.parent().parent().attr('id','selected');
406  highlightAnchor();
407  } else if (n) {
408  $(n.itemDiv).addClass('selected');
409  $(n.itemDiv).attr('id','selected');
410  }
411  if ($('#nav-tree-contents .item:first').hasClass('selected')) {
412  $('#nav-sync').css('top','30px');
413  } else {
414  $('#nav-sync').css('top','5px');
415  }
416  showRoot();
417 }
418 
419 function showNode(o, node, index, hash)
420 {
421  if (node && node.childrenData) {
422  if (typeof(node.childrenData)==='string') {
423  var varName = node.childrenData;
424  getScript(node.relpath+varName,function(){
425  node.childrenData = getData(varName);
426  showNode(o,node,index,hash);
427  },true);
428  } else {
429  if (!node.childrenVisited) {
430  getNode(o, node);
431  }
432  $(node.getChildrenUL()).css({'display':'block'});
433  if (node.isLast) {
434  node.plus_img.src = node.relpath+"ftv2mlastnode.png";
435  } else {
436  node.plus_img.src = node.relpath+"ftv2mnode.png";
437  }
438  node.expanded = true;
439  var n = node.children[o.breadcrumbs[index]];
440  if (index+1<o.breadcrumbs.length) {
441  showNode(o,n,index+1,hash);
442  } else {
443  if (typeof(n.childrenData)==='string') {
444  var varName = n.childrenData;
445  getScript(n.relpath+varName,function(){
446  n.childrenData = getData(varName);
447  node.expanded=false;
448  showNode(o,node,index,hash); // retry with child node expanded
449  },true);
450  } else {
451  var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
452  if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
453  expandNode(o, n, true, true);
454  }
455  selectAndHighlight(hash,n);
456  }
457  }
458  }
459  } else {
460  selectAndHighlight(hash);
461  }
462 }
463 
464 function removeToInsertLater(element) {
465  var parentNode = element.parentNode;
466  var nextSibling = element.nextSibling;
467  parentNode.removeChild(element);
468  return function() {
469  if (nextSibling) {
470  parentNode.insertBefore(element, nextSibling);
471  } else {
472  parentNode.appendChild(element);
473  }
474  };
475 }
476 
477 function getNode(o, po)
478 {
479  var insertFunction = removeToInsertLater(po.li);
480  po.childrenVisited = true;
481  var l = po.childrenData.length-1;
482  for (var i in po.childrenData) {
483  var nodeData = po.childrenData[i];
484  po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
485  i==l);
486  }
487  insertFunction();
488 }
489 
490 function gotoNode(o,subIndex,root,hash,relpath)
491 {
492  var nti = navTreeSubIndices[subIndex][root+hash];
493  o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
494  if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
495  navTo(o,NAVTREE[0][1],"",relpath);
496  $('.item').removeClass('selected');
497  $('.item').removeAttr('id');
498  }
499  if (o.breadcrumbs) {
500  o.breadcrumbs.unshift(0); // add 0 for root node
501  showNode(o, o.node, 0, hash);
502  }
503 }
504 
505 function navTo(o,root,hash,relpath)
506 {
507  var link = cachedLink();
508  if (link) {
509  var parts = link.split('#');
510  root = parts[0];
511  if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,'');
512  else hash='';
513  }
514  if (hash.match(/^#l\d+$/)) {
515  var anchor=$('a[name='+hash.substring(1)+']');
516  glowEffect(anchor.parent(),1000); // line number
517  hash=''; // strip line number anchors
518  }
519  var url=root+hash;
520  var i=-1;
521  while (NAVTREEINDEX[i+1]<=url) i++;
522  if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
523  if (navTreeSubIndices[i]) {
524  gotoNode(o,i,root,hash,relpath)
525  } else {
526  getScript(relpath+'navtreeindex'+i,function(){
527  navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
528  if (navTreeSubIndices[i]) {
529  gotoNode(o,i,root,hash,relpath);
530  }
531  },true);
532  }
533 }
534 
535 function showSyncOff(n,relpath)
536 {
537  n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
538 }
539 
540 function showSyncOn(n,relpath)
541 {
542  n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
543 }
544 
545 function toggleSyncButton(relpath)
546 {
547  var navSync = $('#nav-sync');
548  if (navSync.hasClass('sync')) {
549  navSync.removeClass('sync');
550  showSyncOff(navSync,relpath);
551  storeLink(stripPath2(pathName())+hashUrl());
552  } else {
553  navSync.addClass('sync');
554  showSyncOn(navSync,relpath);
555  deleteLink();
556  }
557 }
558 
559 function initNavTree(toroot,relpath)
560 {
561  var o = new Object();
562  o.toroot = toroot;
563  o.node = new Object();
564  o.node.li = document.getElementById("nav-tree-contents");
565  o.node.childrenData = NAVTREE;
566  o.node.children = new Array();
567  o.node.childrenUL = document.createElement("ul");
568  o.node.getChildrenUL = function() { return o.node.childrenUL; };
569  o.node.li.appendChild(o.node.childrenUL);
570  o.node.depth = 0;
571  o.node.relpath = relpath;
572  o.node.expanded = false;
573  o.node.isLast = true;
574  o.node.plus_img = document.createElement("img");
575  o.node.plus_img.src = relpath+"ftv2pnode.png";
576  o.node.plus_img.width = 16;
577  o.node.plus_img.height = 22;
578 
579  if (localStorageSupported()) {
580  var navSync = $('#nav-sync');
581  if (cachedLink()) {
582  showSyncOff(navSync,relpath);
583  navSync.removeClass('sync');
584  } else {
585  showSyncOn(navSync,relpath);
586  }
587  navSync.click(function(){ toggleSyncButton(relpath); });
588  }
589 
590  $(window).load(function(){
591  navTo(o,toroot,hashUrl(),relpath);
592  showRoot();
593  });
594 
595  $(window).bind('hashchange', function(){
596  if (window.location.hash && window.location.hash.length>1){
597  var a;
598  if ($(location).attr('hash')){
599  var clslink=stripPath(pathName())+':'+hashValue();
600  a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]');
601  }
602  if (a==null || !$(a).parent().parent().hasClass('selected')){
603  $('.item').removeClass('selected');
604  $('.item').removeAttr('id');
605  }
606  var link=stripPath2(pathName());
607  navTo(o,link,hashUrl(),relpath);
608  } else if (!animationInProgress) {
609  $('#doc-content').scrollTop(0);
610  $('.item').removeClass('selected');
611  $('.item').removeAttr('id');
612  navTo(o,toroot,hashUrl(),relpath);
613  }
614  })
615 }
616