PageSourceSearch

https://www.khonkaen4.go.th/wp-content/plugins/post-carousel/block…/js/table-of-content.min.js?ver=4.0.5

js khonkaen4.go.th collected 2026-09-24 13:23:02 UTC 6,414 bytes, 1 lines download raw bytes

1document.addEventListener("DOMContentLoaded",function(){let e=document.querySelector(".sp-table-of-content-toc");if(!e)return;let t="true"===e.dataset.smoothScroll,s=parseFloat(e.dataset.offsetTop)||0,i=document.querySelectorAll(".sps-toc-link"),o=e.dataset.preset||"presetOne",l=e.dataset.hashUrl||!1,r=document.querySelectorAll("h1, h2, h3, h4, h5, h6");r.forEach(e=>{let t=e.querySelector(".sps-toc-heading-copy-link");t&&(t.style.opacity="0",t.style.transition="opacity 0.3s",e.addEventListener("mouseenter",()=>{l?t.style.setProperty("opacity","1","important"):t.style.pointerEvents="none"}),e.addEventListener("mouseleave",()=>{t.style.opacity="0"}))});let a=null,n={},c=e.querySelector(".sps-toc-container"),d=e.querySelector(".sps-toc-indicator");document.querySelectorAll(".sps-toc-item").forEach(e=>{let t=e.getAttribute("data-item-id");t&&(n[t]=e)});let p=()=>{if(!c||!d||null===a||c.classList.contains("sps-toc-hidden")){d&&d.classList.add("hidden");return}let e=n[a];if(!e){d&&d.classList.add("hidden");return}let t=e.querySelector(".sps-toc-link-wrapper");if(!t){d&&d.classList.add("hidden");return}d.classList.remove("hidden");let s=c.getBoundingClientRect(),i=t.getBoundingClientRect(),o=i.top-s.top;d.style.top=`${o}px`,d.style.height=`${i.height}px`},u=()=>{if(document.querySelectorAll(".sps-toc-link-wrapper").forEach(e=>{e.classList.remove("sps-toc-selected-background")}),["presetTwo","presetFive","presetThree","presetFour"].includes(o)&&a){let e=n[a];if(e){let t=e.querySelector(".sps-toc-link-wrapper");t&&t.classList.add("sps-toc-selected-background")}}};i.forEach(e=>{e.addEventListener("click",function(e){e.preventDefault();let i=this.getAttribute("href").substring(1),l=decodeURIComponent(i),r=document.getElementById(l);if(r||(r=document.getElementById(i)),a=r?r.id:l,u(),["presetThree","presetFour","presetFive"].includes(o)&&p(),r){let n=r.getBoundingClientRect().top+window.pageYOffset;window.scrollTo({top:n-s,behavior:t?"smooth":"auto"})}else console.warn("TOC target not found:",l)})});let h=document.querySelectorAll(".sps-toc-copy");h.forEach(e=>{e.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();let t=this.getAttribute("data-clipboard-text"),s=document.createElement("input");s.value=t,document.body.appendChild(s),s.select();try{let i=document.execCommand("copy");if(i){let o=this.getAttribute("title");this.setAttribute("title","Copied!"),this.classList.add("copied"),setTimeout(()=>{this.setAttribute("title",o),this.classList.remove("copied")},2e3)}}catch(l){console.error("Copy error:",l)}document.body.removeChild(s)})});let y=document.querySelector(".sps-toc-main-toggle");y&&y.addEventListener("click",function(t){t.preventDefault();let s=document.querySelector(".sps-toc-container"),i=s.classList.contains("sps-toc-hidden");s.classList.toggle("sps-toc-hidden"),!i&&d&&d.classList.add("hidden"),this.classList.toggle("expanded");let l=this.classList.contains("expanded");this.setAttribute("aria-expanded",l?"true":"false");let r=e.dataset.buttonType,a=e.dataset.collapseText,n=e.dataset.expandText,c=e.dataset.iconSource;if("icon"===r){let u=e.querySelector(".sps-toc-wrapper"),h=JSON.parse(u.dataset.icons),y;switch(c){case"one":y=h.one;break;case"two":y=h.two;break;case"three":y=h.three;break;case"four":default:y=l?h.four_expanded:h.four_collapsed;break;case"five":y=l?h.five_expanded:h.five_collapsed;break;case"six":y=h.six;break;case"seven":y=l?h.seven_expanded:h.seven_collapsed;break;case"eight":y=h.eight}this.innerHTML=y}else this.textContent=l?a:n;this.setAttribute("aria-label",l?a:n),i&&["presetThree","presetFour","presetFive"].includes(o)&&setTimeout(()=>{p()},350)});let f=document.querySelectorAll(".sps-toc-toggle");if(f.forEach(t=>{t.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();let s=this.closest("li.sps-toc-item"),i=s.querySelector(".sps-toc-sublist");if(i){i.classList.contains("sps-toc-sublist-collapsed"),i.classList.toggle("sps-toc-sublist-collapsed"),this.classList.toggle("expanded");let l=this.classList.contains("expanded"),r=e.dataset.childIconSource,a=e.querySelector(".sps-toc-wrapper"),n=JSON.parse(a.dataset.icons),c;switch(r){case"one":c=n.one;break;case"two":c=n.two;break;case"three":c=n.three;break;case"four":default:c=l?n.four_expanded:n.four_collapsed;break;case"five":c=l?n.five_expanded:n.five_collapsed;break;case"six":c=n.six;break;case"seven":c=l?n.seven_expanded:n.seven_collapsed;break;case"eight":c=n.eight}this.innerHTML=c,this.setAttribute("aria-expanded",l?"true":"false"),this.setAttribute("aria-label",l?"Collapse section":"Expand section"),["presetThree","presetFour","presetFive"].includes(o)&&setTimeout(()=>{p()},350)}})}),["presetThree","presetFour","presetFive"].includes(o)){if(!a&&i.length>0){let g=i[0],b=g.getAttribute("href").substring(1);a=b,p()}if(window.addEventListener("resize",()=>{requestAnimationFrame(p)}),c){let v=new ResizeObserver(()=>{requestAnimationFrame(p)});v.observe(c)}}["presetTwo","presetFive"].includes(o)&&u(),document.body.addEventListener("click",function(e){let t=e.target.closest(".sps-toc-heading-copy-link");if(!t)return;e.preventDefault(),e.stopPropagation();let s=t.dataset.url;!function e(t){let s=document.createElement("textarea");s.value=t,s.style.position="fixed",s.style.top=0,s.style.left=0,s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();try{document.execCommand("copy")}
1catch(i){console.error("Failed to copy: ",i),prompt("Copy this link:",t)}document.body.removeChild(s)}(s);let i=document.createElement("div");i.textContent="Link copied!",i.style.position="fixed",i.style.bottom="20px",i.style.right="20px",i.style.background="#333",i.style.color="#fff",i.style.padding="8px 12px",i.style.borderRadius="4px",i.style.zIndex="99999",i.style.fontSize="13px",document.body.appendChild(i),setTimeout(()=>{i.style.opacity="0",setTimeout(()=>i.remove(),300)},1500)});let x=document.querySelectorAll(".sp-table-of-content-toc");x.forEach(e=>{let t=e.classList.contains("sp-toc-position-floating");if(e.style.transition="opacity 0.3s ease-in-out",t){let s=document.createElement("div");s.style.height=e.offsetHeight+"px";let i=e.getBoundingClientRect(),o=i.top+window.scrollY+i.height;window.addEventListener("scroll",()=>{window.scrollY>o?(e.style.position="fixed",e.parentNode.insertBefore(s,e),e.style.opacity="1"):(e.style.position="static",e.style.opacity="1",s.remove())})}})});

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.