text: (function(e,t){function n(){var i=t.getElementsByClassName("lazy-load");if(0===i.length)e.removeEventListener("load",n),e.removeEventListener("scroll",n),e.removeEventListener("resize",n);else for(var r=i.length-1;r>-1;r--){var s=i[r];a(s,300)&&(s.src=s.getAttribute("data-src"),s.removeAttribute("data-src"),s.classList.remove("lazy-load"))}}function a(n,a){return n.offsetTop-((t.scrollingElement||t.documentElement).scrollTop+(e.innerHeight||t.documentElement.clientHeight))<a}var i=function(e){return t.getElementById(e)},r=function(e){e=e||document;var t=e.defaultView||e.parentWindow,n=e.compatMode,a=e.documentElement,i=t.innerHeight||0,r=t.innerWidth||0,s=t.pageXOffset||0,o=t.pageYOffset||0,l=a.scrollWidth,c=a.scrollHeight;return"CSS1Compat"!==n&&(a=e.body,l=a.scrollWidth,c=a.scrollHeight),n&&(r=a.clientWidth,i=a.clientHeight),l=Math.max(l,r),c=Math.max(c,i),s=Math.max(s,e.documentElement.scrollLeft,e.body.scrollLeft),o=Math.max(o,e.documentElement.scrollTop,e.body.scrollTop),{width:r,height:i,scrollWidth:l,scrollHeight:c,scrollX:s,scrollY:o}},s=function(e){var t=e.ownerDocument,n=r(t),a=n.scrollX,i=n.scrollY,s=e.getBoundingClientRect(),o=[s.left,s.top];return(i||a)&&(o[0]+=a,o[1]+=i),o},o=function(e){var t=s(e),n=t[0],a=t[1],i=e.offsetWidth,r=e.offsetHeight;return{width:i,height:r,left:n,top:a,bottom:a+r,right:n+i}},l=function(){var e=i("comments");if(e){var t=function(){var t=e.getAttribute("data-type");"disqus"===t?c():"hypercomments"===t?d():"changyan"===t?u():"gitalk"===t&&m()};if(location.hash.indexOf("#comments")>-1)t();else var n=setInterval(function(){var a=r(),i=a.scrollY+a.height,s=o(e).top;Math.abs(s-i)<1e3&&(t(),clearInterval(n))},300)}},c=function(){var n=i("disqus_thread");if(n){e.disqus_config=function(){this.page.url=n.getAttribute("data-url"),this.page.identifier=n.getAttribute("data-identifier")};var a=t.createElement("script");a.src="//"+n.getAttribute("data-name")+".disqus.com/embed.js",a.setAttribute("data-timestamp",+new Date),(t.head||t.body).appendChild(a)}},d=function(){var t=i("hypercomments_widget"),n=t.getAttribute("data-name");e._hcwp=e._hcwp||[],e._hcwp.push({widget:"Stream",widget_id:n}),function(){if(!("HC_LOAD_INIT"in e)){var t=(navigator.language||navigator.systemLanguage||navigator.userLanguage||"en").substr(0,2).toLowerCase(),a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"===document.location.protocol?"https":"http")+"://w.hypercomments.com/widget/hc/"+n+"/"+t+"/widget.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(a,i.nextSibling)}}()},u=function(){var n=i("SOHUCS");if(n){var a=n.getAttribute("data-name"),r=n.getAttribute("sid"),s=e.innerWidth||t.documentElement.clientWidth,o=t.createElement("script");s<960?(o.id="changyan_mobile_js",o.src="//changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id="+a+"&conf="+r):(o.src="//changyan.sohu.com/upload/changyan.js",o.onload=function(){e.changyan.api.config({appid:a,conf:r})}),(t.head||t.body).appendChild(o)}},m=function(){var e=i("gitalk-container");if(e){var n=e.getAttribute("data-name"),a=e.getAttribute("data-identifier");n&&(n=JSON.parse(n)),n.id=a;var r=t.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("type","text/css"),r.setAttribute("href","//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css"),(t.head||t.body).appendChild(r);var s=t.createElement("script");s.src="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js",s.onload=function(){var e=new Gitalk(n);e.render("gitalk-container")},(t.head||t.body).appendChild(s)}};e.addEventListener("load",function(){l()});var h={isMob:function(){for(var e=navigator.userAgent.toLowerCase(),t=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"],n=!1,a=0;a<t.length;a++)e.indexOf(t[a].toLowerCase())>-1&&(n=!0);return n}()};h.isMob?t.documentElement.className+=" mob":t.documentElement.className+=" pc";var g={$sidebar:t.querySelector("#sidebar"),$main:t.querySelector("#main"),$sidebar_mask:t.querySelector("#sidebar-mask"),$body:t.body,$btn_side:t.querySelector("#header .btn-bar"),$article:t.querySelectorAll(".mob #page-index article")};g.bindEvent=function(){var t=this,n="side",a="click",i="click";h.isMob&&(a="touchstart",i="touchend"),this.$btn_side.addEventListener(i,function(){t.$body.className.indexOf(n)>-1?(t.$body.className=t.$body.className.replace(n,""),t.$sidebar_mask.style.display="none"):(t.$body.className+=" "+n,t.$sidebar_mask.style.display="block")},!1),this.$sidebar_mask.addEventListener(a,function(e){t.$body.className=t.$body.className.replace(n,""),t.$sidebar_mask.style.display="none",e.preventDefault()},!1),e.addEventListener("resize",function(){t.$body.className=t.$body.className.replace(n,""),t.$sidebar_mask.style.display="none"},!1)},g.bindEvent(),e.addEventListener("load",n),e.addEventListener("scroll",n),e.addEventListener("resize",n);var f={$code:t.querySelectorAll("pre code"),hasClass:function(e,t){return e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))},addClass:function(e,t){f.hasClass(e,t)||(e.className+=" "+t)},removeClass:function(e,t){f.hasClass(e,t)&&(e.className=e.className.replace(new RegExp("(\\s|^)"+t+"(\\s|$)")," "))}};f.stringHash=function(e){var t="";return e.index>1&&(t+=e.index+"-"),t+="L"+e.start,e.end&&e.end>e.start&&(t+="-L"+e.end),t},f.parseHash=function(){var e=location.hash.substr(1).match(/((\d+)-)?L(\d+)(-L(\d+))?/);return e?{index:parseInt(e[2],10)||1,start:parseInt(e[3],10)||1,end:parseInt(e[5],10)||parseInt(e[3],10)||1}:null},f.mark=function(e){var t=f.parseHash();if(t&&f.$code&&f.$code[t.index-1]){for(var n=f.$code[t.index-1].querySelectorAll("li"),a=t.start-1;a<t.end;a++)n[a]&&f.addClass(n[a],"mark");e&&n&&n[0]&&setTimeout(function(){window.scrollTo(0,o(n[0]).top-50)})}},f.removeMark=function(){[].slice.call(t.querySelectorAll("pre code li.mark")).forEach(function(e){f.removeClass(e,"mark")})},f.init=function(){[].slice.call(f.$code).forEach(function(e,t){var n=e.innerHTML.split(/\n/).slice(0,-1),a=n.map(function(e,t){return'<li><span class="line-num" data-line="'+(t+1)+'"></span>'+e+"</li>"}).join("");a="<ul>"+a+"</ul>",n.length>3&&e.className.match(/lang-(\w+)/)&&"undefined"!==RegExp.$1&&(a+='<b class="name">'+RegExp.$1+"</b>"),e.innerHTML=a,f.addClass(e,"firekylin-code"),e.addEventListener("click",function(e){if(e.target&&f.hasClass(e.target,"line-num"))if(e.shiftKey){var n=f.parseHash();n.newIndex=t+1,n.current=e.target.getAttribute("data-line"),n.index!==n.newIndex-0?(n.index=n.newIndex,n.start=n.current,n.end=0):n.current>n.start?n.end=n.current:(n.end=n.start,n.start=n.current),location.hash=f.stringHash(n)}else location.hash=f.stringHash({index:t+1,start:e.target.getAttribute("data-line")})})})},f.init(),e.addEventListener("load",function(){f.mark(!0)}),e.addEventListener("hashchange",function(){f.removeMark(),f.mark()})})(window,document);