diff options
Diffstat (limited to 'support/jsdoc/jsdoc-custom.js')
-rw-r--r-- | support/jsdoc/jsdoc-custom.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/support/jsdoc/jsdoc-custom.js b/support/jsdoc/jsdoc-custom.js index 0bce1fa..fc22991 100644 --- a/support/jsdoc/jsdoc-custom.js +++ b/support/jsdoc/jsdoc-custom.js @@ -96,10 +96,22 @@ $(function initSearchBar() { location.href = host + suggestion; // handle searching from one of the source files or the home page } else if (currentPage !== 'docs.html') { - location.href = host + 'docs.html#.' + suggestion; + location.href = host + 'docs.html#' + suggestion; } else { - var $el = document.getElementById('.' + suggestion); - $('#main').animate({ scrollTop: $el.offsetTop - 60 }, 500); + var $el = document.getElementById(suggestion); + $('#main-container').animate({ scrollTop: $el.offsetTop - 60 }, 500); } }); + + function fixOldHash() { + var hash = window.location.hash; + if (hash) { + var hashMatches = hash.match(/^#\.(\w+)$/); + if (hashMatches) { + window.location.hash = '#'+hashMatches[1]; + } + } + } + + fixOldHash(); }); |