PageSourceSearch

https://www.singletracks.com/wp-content/plugins/heroic-table-of-contents/dist/script.min.js?ver=1772545716

js singletracks.com collected 2026-09-24 09:22:22 UTC 4,675 bytes, 1 lines download raw bytes

1!function(){"use strict";var t,e=function(){document.querySelectorAll(".wp-block-ht-block-toc").forEach((function(t){t.setAttribute("data-htoc-auto-collapse","true")}))},o=function(t){var e,o=t.currentTarget.parentNode.parentNode;return!!o&&(e="htoc",o.className.split(" ").indexOf(e)>-1&&(n(o)?c(o):i(o),!0))},i=function(t){t.setAttribute("data-htoc-state","expanded")},c=function(t){t.setAttribute("data-htoc-state","closed")},n=function(t){return"expanded"===t.getAttribute("data-htoc-state")},r=function(t){for(var e=0,i=t.length;e<i;e++)t[e].addEventListener("click",o)},s=function(){var t=document.querySelectorAll('.wp-block-ht-block-toc[data-htoc-scrollspy="true"]');if(t.length){var e=document.querySelector(".wp-block-post-content");if(e){var o=e.querySelectorAll("h1, h2, h3, h4, h5, h6");o.length&&t.forEach((function(t){var e=t.querySelector(".ht_toc_list");if(e&&!(e.children.length>0)){var i=t.getAttribute("data-htoc-mapping-headers"),c=i?JSON.parse(i):[!1,!0,!0,!0,!0,!0],n=l(o,c);if(n.length>0){var r=t.querySelector(".ht_toc_placeholder");r&&(r.style.display="none"),u(e,n)}}}))}}},l=function(t,e){var o=[],i=[];return Array.from(t).forEach((function(t,c){var n=parseInt(t.tagName.substring(1)),r=t.textContent.trim();if(r&&(!e||e[n-1])){var s=t.id||a(r,c);t.id||(t.id=s);for(var l=0,u=i.length-1;u>=0;u--)if(i[u]<=n){l=i[u]<n?u+1:u;break}(i=i.slice(0,l))[l]=n,o.push({text:r,anchor:s,level:l,tagLevel:n})}})),o},a=function(t,e){var o=t.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");o||(o="heading-"+e);for(var i=o,c=1;document.getElementById(o);)o=i+"-"+c,c++;return o},u=function(t,e){if(e&&0!==e.length){var o="",i=0,c=0;for(e.forEach((function(t,e){for(var n=t.level;i>n;)o+="</li></ul>",i--;for(e>0&&n<=c&&(o+="</li>");i<n;)o+='<ul class="ht_toc_list_sub">',i++;o+='<li class="ht_toc_item">',o+='<a href="#'+t.anchor+'" class="ht_toc_link">',o+=t.text,o+="</a>",c=n})),o+="</li>";i>1;)o+="</ul></li>",i--;1===i&&(o+="</ul>"),t.innerHTML=o}};function h(){const t=document.querySelectorAll(".wp-block-ht-block-toc");t.length&&t.forEach((function(t){if("false"===t.getAttribute("data-htoc-scrollspy"))return;const e=t.querySelector(".ht_toc_list");e&&new f({tocBlock:t,tocList:e,sectionSelector:"h1, h2, h3, h4, h5, h6",activeClass:"active",viewOffset:-100})}))}function f(t){this.options=Object.assign({tocBlock:null,tocList:null,sectionSelector:"h1, h2, h3, h4, h5, h6",activeClass:"active",viewOffset:-100},t),this.tocBlock=this.options.tocBlock,this.tocList=this.options.tocList;var e=this.tocBlock.getAttribute("data-htoc-mapping-headers"),o=e?JSON.parse(e):[!1,!0,!0,!0,!0,!0];if("true"===this.tocBlock.getAttribute("data-htoc-scrollspy")){const t=document.querySelector(".wp-block-post-content");var i=t?t.querySelectorAll(this.options.sectionSelector):[]}else i=document.querySelectorAll(this.options.sectionSelector);this.sections=Array.from(i).filter((function(t){var e=parseInt(t.tagName.substring(1));return o[e-1]})),this.isScrolling=!1,this.tocList&&this.sections.length&&this.init()}t=function(){e();var t=document.getElementsByClassName("htoc__toggle");r(t),s(),h(),setTimeout((function(){s(),h()}),100)},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(t,1):document.addEventListener("DOMContentLoaded",t),f.prototype.init=function(){this.bindScrollEvent(),this.setInitialActive()},f.prototype.bindScrollEvent=function(){var t=this,e=!1;function o(){t.updateActiveSection(),e=!1}window.addEventListener("scroll",(function(){e||(requestAnimationFrame(o),e=!0)}))},f.prototype.setInitialActive=function(){var t=window.location.hash;if(t&&document.querySelector(t)){var e=this.tocList.querySelector('a[href="'+t+'"]');e&&this.setActiveLink(e)}},f.prototype.updateActiveSection=function(){var t=this.getCurrentSection();if(t){var e=t.getAttribute("id");if(e){var o=this.tocList.querySelector('a[href="#'+e+'"]');o&&(this.removeAllActiveStates(),this.setActiveLink(o))}}},f.prototype.getCurrentSection=function(){for(var t=this.options.viewOffset,e=window.pageYOffset||document.documentElement.scrollTop,o=this.sections.length-1;o>=0;o--){var i=this.sections[o];if(e>=i.getBoundingClientRect().top+e+t)return i}return this.sections[0]},f.prototype.setActiveLink=function(t){if(t){var e=t.closest("li");if(e){e.classList.add(this.options.activeClass);for(var o=e.parentElement.closest("li");o;)o.classList.add(this.options.activeClass),o=o.parentElement.closest("li")}}},f.prototype.removeAllActiveStates=function(){for(var t=this.tocList.querySelectorAll("li."+this.options.activeClass),e=0;e<t.length;e++)t[e].classList.remove(this.options.activeClass)}}();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.