| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/laragon/www/ayongundang/public/assets/base/css/animate.css-main/docs/modules/ |
Upload File : |
/**
Docs index
*/
const indexItemTemplate = (item = '', id) => `
<li class="docs-indexItem"><a href="#${id}" title="${item}">${item}</a></li>
`
const indexList = (sections = [], container = '.sidebar', heading = 'h2') => {
const containerEl = document.querySelector(container)
const list = document.createElement('ul')
const children = sections.map(section => {
const title = section.querySelector(heading)
const id = section.getAttribute('id')
return title && indexItemTemplate(title.innerText, id)
})
list.classList.add('docs-index')
list.innerHTML = children.join('\n')
containerEl.insertAdjacentElement('beforeend', list)
return list
}
const buildDocsIndex = (docs = '#documentation', docSection = '[class*="docSection-"]', titles = 'h2') => {
const docsEl = document.querySelector(docs)
const sections = [...docsEl.querySelectorAll(docSection)]
const list = indexList(sections)
return list
}
export default buildDocsIndex