"use strict";
const onFRTOCDiv = () => {
const TOCdiv = document.createElement("div");
TOCdiv.classList.add('fr-toc');
TOCdiv.innerHTML = '
.
';
document.querySelector('.entry-content').prepend(TOCdiv);
document.querySelector('.fr-toc-mobile').addEventListener("click", function (ev) {
document.querySelector('.fr-toc').classList.toggle('mobileactive');
} );
};
const onFRTOCInteraction = () => {
const TocScript = document.createElement("script");
TocScript.src = tocvars.path+'/assets/toc/tocbot.min.js';
document.body.appendChild(TocScript);
setTimeout(() =>{
tocbot.init({
tocSelector: '.fr-toc-list-wrap',
contentSelector: '.entry-content',
headingSelector: 'h2, h3',
hasInnerContainers: true,
isCollapsedClass: 'fr-toc-collapsed',
collapsibleClass: 'fr-toc-collapsible',
});
}, 500);
};
document.addEventListener('DOMContentLoaded', (event) => {onFRTOCDiv();});
window.addEventListener("scroll", onFRTOCInteraction, { once: true });