Files
wordpress-theme-aksrt/assets/js/runtime/section-navs.min.js
T
2026-08-25 20:15:55 +08:00

2 lines
1.7 KiB
JavaScript

"use strict";function section_navs(t){function n(){var t=window.location.hash;t&&jQuery(t).length&&jQuery('a[href="'+t+'"]').click()}function a(t){return t.hasClass("item-heading")||t.parents(".no-nav").length}function i(){var t="";return jQuery(o).each(function(n){var i=jQuery(this);if(!a(i)){var s=i.prop("tagName"),e=i.text(),l="n-"+s;l+=1==n?" active":"",r=n,i.attr("id","wznav_"+r),t+='<li class="'+l+'"><a class="text-ellipsis" href="#wznav_'+r+'">'+e+"</a></li>"}}),t}var s=".posts-nav-box",e=_win.bd,l="posts-nav-lists",c="."+l,o=t+" h1,"+t+" h2,"+t+" h3,"+t+" h4",r=0,h=function(){var t=i();t&&(jQuery(s).each(function(){var t=jQuery(this),n=t.attr("data-title")||"";n=n&&'<div class="box-body notop"><div class="title-theme">'+n+"</div></div>",t.append(n+'<div class="aksrt-panel"><div class="'+l+' scroll-y mini-scrollbar list-unstyled"></div></div>')}),v(t),setTimeout(function(){n()},20))},v=function(t){jQuery(c).html('<ul class="bl relative nav">'+t+"</ul>"),e.on("click",c+" a",function(){var t=jQuery(jQuery(this).attr("href"));return t.parents(".panel").each(function(){var t=jQuery(this).find(".collapse");t.length&&t.collapse("show")}),jQuery(".read-more-open").click(),scrollTopTo(t),!1}),e.scrollspy({target:c,offset:105}),f()},f=function(){var t=".n-H1,.n-H2";jQuery(c+" .bl").each(function(){var n=jQuery(this);n.innerHeight()>380&&n.find(t).each(function(){var n=jQuery(this),a=n.nextUntil(t);a.length&&(a.addClass("yc"),n.append('<i class="fa fas fa-angle-right nav-toggle-collapse"></i>'))})}),e.on("click",c+" .nav-toggle-collapse",function(){jQuery(this).toggleClass("fa-rotate-90").parent().nextUntil(t).toggleClass("yc")})};jQuery(o).length>2&&h()}section_navs("[data-nav]");