PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
ablocks / assets / build / blocks / table-of-content / view.js

view.js in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.14.0, at assets/build/blocks/table-of-content/view.js

2 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 document.addEventListener("DOMContentLoaded",function(){const t=document.querySelectorAll(".ablocks-toc-item-link");if(t.forEach(e=>{e.dataset.ablocksTocInit||(e.dataset.ablocksTocInit="1",e.addEventListener("click",function(e){e.preventDefault();const o=this.getAttribute("href").substring(1),c=document.getElementById(o);c&&(c.scrollIntoView({behavior:"smooth",block:"start"}),t.forEach(t=>t.classList.remove("active")),this.classList.add("active"))}))}),t.length){const e=Array.from(t).map(t=>{const e=t.getAttribute("href")?.substring(1);return document.getElementById(e)}).filter(Boolean),o=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){const o=e.target.id;t.forEach(t=>{t.classList.toggle("active",t.getAttribute("href")===`#${o}`)})}})},{rootMargin:"0px 0px -70% 0px",threshold:.1});e.forEach(t=>o.observe(t))}document.querySelectorAll(".ablocks-toc__header-toggle-icon").forEach(t=>{t.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation()
2 ;const o=t.closest(".ablocks-block").querySelector(".ablocks-toc-body");o&&(o.classList.contains("ablocks-toc__collapse")?(o.classList.remove("ablocks-toc__collapse"),t.querySelector(".ablocks-toc__show").style.display="flex",t.querySelector(".ablocks-toc__hide").style.display="none"):(o.classList.add("ablocks-toc__collapse"),t.querySelector(".ablocks-toc__show").style.display="none",t.querySelector(".ablocks-toc__hide").style.display="flex"))})})});