X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=v1.0.x%2Fnavtree.js;fp=v1.0.x%2Fnavtree.js;h=9df45a7d82c35a28fe8a3ebdddba4d6ef362bfd5;hb=81669568e8efb556df803a2bb02afd93764f4868;hp=550f10f304ee35aa65696e52d2102f318e75f01e;hpb=1d9bb866738b09085bc6f387e83690c16d26c762;p=m6w6%2Fext-propro diff --git a/v1.0.x/navtree.js b/v1.0.x/navtree.js index 550f10f..9df45a7 100644 --- a/v1.0.x/navtree.js +++ b/v1.0.x/navtree.js @@ -1,34 +1,3 @@ -var NAVTREE = -[ - [ "Property proxy API", "index.html", [ - [ "Data Structures", null, [ - [ "Data Structures", "annotated.html", "annotated" ], - [ "Data Structure Index", "classes.html", null ], - [ "Data Fields", "functions.html", [ - [ "All", "functions.html", null ], - [ "Variables", "functions_vars.html", null ] - ] ] - ] ], - [ "Files", null, [ - [ "File List", "files.html", "files" ], - [ "Globals", "globals.html", [ - [ "All", "globals.html", null ], - [ "Functions", "globals_func.html", null ], - [ "Typedefs", "globals_type.html", null ] - ] ] - ] ] - ] ] -]; - -var NAVTREEINDEX = -[ -"annotated.html" -]; - -var SYNCONMSG = 'click to disable panel synchronisation'; -var SYNCOFFMSG = 'click to enable panel synchronisation'; -var SYNCONMSG = 'click to disable panel synchronisation'; -var SYNCOFFMSG = 'click to enable panel synchronisation'; var navTreeSubIndices = new Array(); function getData(varName) @@ -51,6 +20,21 @@ function stripPath2(uri) return m ? uri.substring(i-6) : s; } +function hashValue() +{ + return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,''); +} + +function hashUrl() +{ + return '#'+hashValue(); +} + +function pathName() +{ + return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, ''); +} + function localStorageSupported() { try { @@ -73,7 +57,7 @@ function deleteLink() { if (localStorageSupported()) { window.localStorage.setItem('navpath',''); - } + } } function cachedLink() @@ -121,7 +105,7 @@ function createIndent(o,domNode,node,level) node.expandToggle.onclick = function() { if (node.expanded) { $(node.getChildrenUL()).slideUp("fast"); - node.plus_img.src = node.relpath+"ftv2pnode.png"; + node.plus_img.src = node.relpath+"arrowright.png"; node.expanded = false; } else { expandNode(o, node, false, false); @@ -129,13 +113,13 @@ function createIndent(o,domNode,node,level) } node.expandToggle.appendChild(imgNode); domNode.appendChild(node.expandToggle); - imgNode.src = node.relpath+"ftv2pnode.png"; + imgNode.src = node.relpath+"arrowright.png"; } else { var span = document.createElement("span"); span.style.display = 'inline-block'; span.style.width = 16*(level+1)+'px'; span.style.height = '22px'; - span.innerHTML = ' '; + span.innerHTML = ' '; domNode.appendChild(span); } } @@ -145,11 +129,13 @@ var animationInProgress = false; function gotoAnchor(anchor,aname,updateLocation) { var pos, docContent = $('#doc-content'); - if (anchor.parent().attr('class')=='memItemLeft' || - anchor.parent().attr('class')=='fieldtype' || - anchor.parent().is(':header')) + var ancParent = $(anchor.parent()); + if (ancParent.hasClass('memItemLeft') || + ancParent.hasClass('fieldname') || + ancParent.hasClass('fieldtype') || + ancParent.is(':header')) { - pos = anchor.parent().position().top; + pos = ancParent.position().top; } else if (anchor.position()) { pos = anchor.position().top; } @@ -207,7 +193,7 @@ function newNode(o, po, text, link, childrenData, lastNode) a.className = stripPath(link.replace('#',':')); if (link.indexOf('#')!=-1) { var aname = '#'+link.split('#')[1]; - var srcPage = stripPath($(location).attr('pathname')); + var srcPage = stripPath(pathName()); var targetPage = stripPath(link.split('#')[0]); a.href = srcPage!=targetPage ? url : "javascript:void(0)"; a.onclick = function(){ @@ -283,9 +269,9 @@ function expandNode(o, node, imm, showRoot) $(node.getChildrenUL()).slideDown("fast"); } if (node.isLast) { - node.plus_img.src = node.relpath+"ftv2mlastnode.png"; + node.plus_img.src = node.relpath+"arrowdown.png"; } else { - node.plus_img.src = node.relpath+"ftv2mnode.png"; + node.plus_img.src = node.relpath+"arrowdown.png"; } node.expanded = true; } @@ -301,14 +287,13 @@ function glowEffect(n,duration) function highlightAnchor() { - var aname = $(location).attr('hash'); + var aname = hashUrl(); var anchor = $(aname); if (anchor.parent().attr('class')=='memItemLeft'){ - var rows = $('.memberdecls tr[class$="'+ - window.location.hash.substring(1)+'"]'); + var rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); glowEffect(rows.children(),300); // member without details - } else if (anchor.parents().slice(2).prop('tagName')=='TR') { - glowEffect(anchor.parents('div.memitem'),1000); // enum value + } else if (anchor.parent().attr('class')=='fieldname'){ + glowEffect(anchor.parent().parent(),1000); // enum value } else if (anchor.parent().attr('class')=='fieldtype'){ glowEffect(anchor.parent().parent(),1000); // struct field } else if (anchor.parent().is(":header")) { @@ -323,7 +308,7 @@ function selectAndHighlight(hash,n) { var a; if (hash) { - var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1); + var link=stripPath(pathName())+':'+hash.substring(1); a=$('.item a[class$="'+link+'"]'); } if (a && a.length) { @@ -356,11 +341,7 @@ function showNode(o, node, index, hash) getNode(o, node); } $(node.getChildrenUL()).css({'display':'block'}); - if (node.isLast) { - node.plus_img.src = node.relpath+"ftv2mlastnode.png"; - } else { - node.plus_img.src = node.relpath+"ftv2mnode.png"; - } + node.plus_img.src = node.relpath+"arrowdown.png"; node.expanded = true; var n = node.children[o.breadcrumbs[index]]; if (index+11) hash = '#'+parts[1]; + if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,''); else hash=''; } if (hash.match(/^#l\d+$/)) { var anchor=$('a[name='+hash.substring(1)+']'); glowEffect(anchor.parent(),1000); // line number hash=''; // strip line number anchors - //root=root.replace(/_source\./,'.'); // source link to doc link } var url=root+hash; var i=-1; @@ -475,7 +455,7 @@ function toggleSyncButton(relpath) if (navSync.hasClass('sync')) { navSync.removeClass('sync'); showSyncOff(navSync,relpath); - storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash')); + storeLink(stripPath2(pathName())+hashUrl()); } else { navSync.addClass('sync'); showSyncOn(navSync,relpath); @@ -499,7 +479,7 @@ function initNavTree(toroot,relpath) o.node.expanded = false; o.node.isLast = true; o.node.plus_img = document.createElement("img"); - o.node.plus_img.src = relpath+"ftv2pnode.png"; + o.node.plus_img.src = relpath+"arrowright.png"; o.node.plus_img.width = 16; o.node.plus_img.height = 22; @@ -515,7 +495,7 @@ function initNavTree(toroot,relpath) } $(window).load(function(){ - navTo(o,toroot,window.location.hash,relpath); + navTo(o,toroot,hashUrl(),relpath); showRoot(); }); @@ -523,21 +503,20 @@ function initNavTree(toroot,relpath) if (window.location.hash && window.location.hash.length>1){ var a; if ($(location).attr('hash')){ - var clslink=stripPath($(location).attr('pathname'))+':'+ - $(location).attr('hash').substring(1); - a=$('.item a[class$="'+clslink+'"]'); + var clslink=stripPath(pathName())+':'+hashValue(); + a=$('.item a[class$="'+clslink.replace(/