diff options
Diffstat (limited to 'content/assets/javascripts/docs.js')
-rw-r--r-- | content/assets/javascripts/docs.js | 98 |
1 files changed, 1 insertions, 97 deletions
diff --git a/content/assets/javascripts/docs.js b/content/assets/javascripts/docs.js index 018c0bb2..e19a305f 100644 --- a/content/assets/javascripts/docs.js +++ b/content/assets/javascripts/docs.js @@ -1,5 +1,5 @@ --- -version: 1 +version: 2 --- var NAV_INLINE_BREAKPOINT = 1100; @@ -36,7 +36,6 @@ function toggleNavigation() { // move document nav to sidebar (function() { var timeofday = document.getElementById('timeofday'); - var tocList = document.querySelector('.js-article-content > ul#markdown-toc'); var main = document.querySelector('.js-main-wrapper'); // Set timeofday var depending on the time // @@ -58,93 +57,6 @@ function toggleNavigation() { } } - // if the document has a top level nav - if (tocList) { - // append to the sidebar - var sidebar = document.getElementById('doc-nav'); - - if (sidebar) { - // if there are items - if (tocList.children.length >= 1) { - var menu = tocList; - $(tocList).addClass('nav nav-pills flex-column'); - $(tocList).find('ul').addClass('nav nav-pills flex-column'); - $(tocList).find('a').addClass('nav-link'); - - // grab the h1's li anchor text - var title = document.createElement('h4'); - title.innerHTML = 'On this page:'; - - // add the text as a title - menu.insertBefore(title, menu.children[0]); - - var hasHelpSection = document.getElementById('help-and-feedback'); - - // Adds help section anchor to the ToC sidebar - if(hasHelpSection) { - var listItem = document.createElement('li'); - var anchor = document.createElement('a'); - var separator = document.createElement('hr'); - - anchor.className = 'nav-link'; - anchor.innerHTML = 'Help and feedback'; - anchor.setAttribute('href', '#help-and-feedback'); - listItem.appendChild(anchor); - - menu.insertBefore(separator, menu.children[menu.children.length]); - menu.insertBefore(listItem, menu.children[menu.children.length]); - } - - sidebar.appendChild(menu); - - var sidebarContent = sidebar.querySelector('ul'); - var sidebarContentHeight = 0; - - // remove whitespace between elements to prevent list spacing issues - sidebarContent.innerHTML = sidebarContent.innerHTML.replace( - new RegExp('>[s\r\n]+<', 'g'), - '><' - ); - - // When we scroll down to the bottom, we don't want the footer covering - // the TOC list (sticky behavior) - document.addEventListener( - 'scroll', - function() { - // Wait a cycle for the dimensions to kick in - if (!sidebarContentHeight) { - sidebarContentHeight = - sidebarContent.getBoundingClientRect().height + 55; - } - - var isTouchingBottom = false; - if (window.innerWidth >= NAV_INLINE_BREAKPOINT) { - isTouchingBottom = - window.scrollY + sidebarContentHeight >= main.offsetHeight; - } - - if (isTouchingBottom) { - sidebarContent.style.top = - main.offsetHeight - - (window.scrollY + sidebarContentHeight) + - 'px'; - } else { - sidebarContent.style.top = ''; - } - }, - { passive: true } - ); - } - } - - // main content has-toc - if (main && main.classList) { - main.classList.add('has-toc'); - } else { - main.className += ' has-toc'; - } - } - document.addEventListener('DOMContentLoaded', function() { var globalNav = document.getElementById('global-nav'); var media = window.matchMedia('(max-width: 1099px)'); @@ -169,14 +81,6 @@ function toggleNavigation() { } }); - if (media.matches) { - var el = document.getElementById('markdown-toc'); - el.classList.add('collapse'); - el.classList.add('out'); - el.style.height = '34px'; - el.previousElementSibling.classList.add('collapsed'); - } - // Adds the ability to auto-scroll to the active item in the TOC $(window).on('activate.bs.scrollspy', function() { const isMobile = window.matchMedia('(max-width: 1099px)').matches; |