diff options
Diffstat (limited to 'templates/html/navtree.js')
-rw-r--r-- | templates/html/navtree.js | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/templates/html/navtree.js b/templates/html/navtree.js index 7ce2935..edc31ef 100644 --- a/templates/html/navtree.js +++ b/templates/html/navtree.js @@ -2,12 +2,11 @@ @licstart The following is the entire license notice for the JavaScript code in this file. - Copyright (C) 1997-2017 by Dimitri van Heesch + Copyright (C) 1997-2019 by Dimitri van Heesch This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -70,7 +69,6 @@ function localStorageSupported() } } - function storeLink(link) { if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { @@ -102,14 +100,6 @@ function getScript(scriptName,func,show) script.type = 'text/javascript'; script.onload = func; script.src = scriptName+'.js'; - if ($.browser.msie && $.browser.version<=8) { - // script.onload does not work with older versions of IE - script.onreadystatechange = function() { - if (script.readyState=='complete' || script.readyState=='loaded') { - func(); if (show) showRoot(); - } - } - } head.appendChild(script); } @@ -153,6 +143,7 @@ function gotoAnchor(anchor,aname,updateLocation) var pos, docContent = $('#doc-content'); var ancParent = $(anchor.parent()); if (ancParent.hasClass('memItemLeft') || + ancParent.hasClass('memtitle') || ancParent.hasClass('fieldname') || ancParent.hasClass('fieldtype') || ancParent.is(':header')) @@ -265,7 +256,7 @@ function showRoot() (function (){ // retry until we can scroll to the selected item try { var navtree=$('#nav-tree'); - navtree.scrollTo('#selected',0,{offset:-windowHeight/2}); + navtree.scrollTo('#selected',100,{offset:-windowHeight/2}); } catch (err) { setTimeout(arguments.callee, 0); } @@ -284,12 +275,8 @@ function expandNode(o, node, imm, showRoot) } else { if (!node.childrenVisited) { getNode(o, node); - } if (imm || ($.browser.msie && $.browser.version>8)) { - // somehow slideDown jumps to the start of tree for IE9 :-( - $(node.getChildrenUL()).show(); - } else { - $(node.getChildrenUL()).slideDown("fast"); } + $(node.getChildrenUL()).slideDown("fast"); node.plus_img.innerHTML = arrowDown; node.expanded = true; } @@ -319,7 +306,6 @@ function highlightAnchor() } else { glowEffect(anchor.next(),1000); // normal member } - gotoAnchor(anchor,aname,false); } function selectAndHighlight(hash,n) @@ -481,6 +467,18 @@ function toggleSyncButton(relpath) } } +var loadTriggered = false; +var readyTriggered = false; +var loadObject,loadToRoot,loadUrl,loadRelPath; + +$(window).on('load',function(){ + if (readyTriggered) { // ready first + navTo(loadObject,loadToRoot,loadUrl,loadRelPath); + showRoot(); + } + loadTriggered=true; +}); + function initNavTree(toroot,relpath) { var o = new Object(); @@ -511,10 +509,16 @@ function initNavTree(toroot,relpath) navSync.click(function(){ toggleSyncButton(relpath); }); } - $(window).load(function(){ + if (loadTriggered) { // load before ready navTo(o,toroot,hashUrl(),relpath); showRoot(); - }); + } else { // ready before load + loadObject = o; + loadToRoot = toroot; + loadUrl = hashUrl(); + loadRelPath = relpath; + readyTriggered=true; + } $(window).bind('hashchange', function(){ if (window.location.hash && window.location.hash.length>1){ |