1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
"use strict";function section_navs(t){function n(){var t=window.location.hash;t&&$(t).length&&$('a[href="'+t+'"]').click()}function a(t){return t.hasClass("item-heading")||t.parents(".no-nav").length}function i(){var t="";return $(o).each(function(n){var i=$(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&&($(s).each(function(){var t=$(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="zib-widget"><div class="'+l+' scroll-y mini-scrollbar list-unstyled"></div></div>')}),v(t),setTimeout(function(){n()},20))},v=function(t){$(c).html('<ul class="bl relative nav">'+t+"</ul>"),e.on("click",c+" a",function(){var t=$($(this).attr("href"));return t.parents(".panel").each(function(){var t=$(this).find(".collapse");t.length&&t.collapse("show")}),$(".read-more-open").click(),scrollTopTo(t),!1}),e.scrollspy({target:c,offset:105}),f()},f=function(){var t=".n-H1,.n-H2";$(c+" .bl").each(function(){var n=$(this);n.innerHeight()>380&&n.find(t).each(function(){var n=$(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(){$(this).toggleClass("fa-rotate-90").parent().nextUntil(t).toggleClass("yc")})};$(o).length>2&&h()}section_navs("[data-nav]"); |