1 line
2.2 KiB
JavaScript
1 line
2.2 KiB
JavaScript
var navbar_menu_visible=0;$(document).on("click",".navbar-toggler",function(){$toggle=$(this),1==navbar_menu_visible?($("html").removeClass("nav-open"),navbar_menu_visible=0,$("#bodyClick").remove(),setTimeout(function(){$toggle.removeClass("toggled")},550)):(setTimeout(function(){$toggle.addClass("toggled")},580),div='<div id="bodyClick"></div>',$(div).appendTo("body").click(function(){$("html").removeClass("nav-open"),navbar_menu_visible=0,$("#bodyClick").remove(),setTimeout(function(){$toggle.removeClass("toggled")},550)}),$("html").addClass("nav-open"),navbar_menu_visible=1)}),function(e){e.fn.toc=function(n){var o=e.extend({noBackToTopLinks:!1,title:"",minimumHeaders:3,headers:"h1, h2, h3, h4",listType:"ol",showEffect:"show",showSpeed:"slow"},n),t=e(o.headers).filter(function(){var n=e(this).prev().attr("name");return!this.id&&n&&(this.id=e(this).attr("id",n.replace(/\./g,"-"))),this.id}),a=e(this);if(t.length&&!(t.length<o.minimumHeaders)&&a.length){0===o.showSpeed&&(o.showEffect="none");var l,s={show:function(){a.hide().html(h).show(o.showSpeed)},slideDown:function(){a.hide().html(h).slideDown(o.showSpeed)},fadeIn:function(){a.hide().html(h).fadeIn(o.showSpeed)},none:function(){a.html(h)}},r=function(e){return parseInt(e.nodeName.replace("H",""),10)},d=t.map(function(e,n){return r(n)}).get().sort()[0],c=r(t[0]),h=o.title+" <"+o.listType+">";t.each(function(n,t){var a=t.firstChild;if(e(a).on("click",function(){o.noBackToTopLinks||(window.location.hash=t.id)}),l=r(t),o.noBackToTopLinks||l!==d||e(t).addClass("top-level-header").after('<i class="icon-arrow-up back-to-top"> </i>'),l===c)h+="<li><a href='#"+t.id+"'>"+t.innerHTML+"</a>";else if(l<=c){for(i=l;i<c;i++)h+="</li></"+o.listType+">";h+="<li><a href='#"+t.id+"'>"+t.innerHTML+"</a>"}else if(l>c){for(i=l;i>c;i--)h+="<"+o.listType+"><li>";h+="<a href='#"+t.id+"'>"+t.innerHTML+"</a>"}c=l}),h+="</"+o.listType+">",o.noBackToTopLinks||e(document).on("click",".back-to-top",function(){e(window).scrollTop(0),window.location.hash=""}),s[o.showEffect]()}}}(jQuery),$(function(){$("a:external").addClass("external"),$(".external").attr("target","_blank")}),$.expr[":"].external=function(e){return!e.href.match(/^mailto\:/)&&e.hostname!=location.hostname};
|