/* global _prepareAccordion */ //see utils.js (function ($) { // Customize the page TOC document.addEventListener('DOMContentLoaded', () => { // Loop on all tree of content of the page. There may be from 0 to 2 depending on the page. document.querySelectorAll('.o_page_toc').forEach(pageToc => { const headingRefs = pageToc.querySelectorAll('a'); // The references to all headings. // If the page TOC has less than 2 headings, in addition to the title, hide it entirely. if (headingRefs.length <= 2) { _hidePageToc(pageToc); return; } // Allow to automatically collapse and expand TOC entries _prepareAccordion(pageToc); // Highlight TOC entries whose section is focused and expand their TOC entry list. _flagActiveTocEntriesAndLists(pageToc, headingRefs); // Allow to hide the TOC entry referring the title (

heading) _flagFirstHeadingRef(headingRefs); // Show hidden menu when the css classes have been properly specified pageToc.removeAttribute('hidden'); }); }); /** * Entirely hide the local tree of contents. * * @param {HTMLElement} pageToc - The tree of content of the page. */ const _hidePageToc = pageToc => pageToc.style.display = 'none'; /** * Add the relevant classes on the TOC entries (and lists) whose section is focused. * * TOC entries whose section is focused (
  • elements) receive the `o_active_toc_entry` class * and their related TOC entry list (