-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbundle.js
More file actions
8 lines (8 loc) · 18.2 KB
/
bundle.js
File metadata and controls
8 lines (8 loc) · 18.2 KB
1
2
3
4
5
6
7
8
!function(){if($(".reading-progress-bar").length){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",$.noop,t),window.removeEventListener("test",$.noop)}catch(e){}$(document).ready(function(){var n=$(".reading-progress-bar");window.addEventListener("scroll",function(){var e=$(window),t=$(".post-block"),e=e.scrollTop()+e.height()/2-t.position().top,t=Math.round(e/t.height()*100);n.css("width",(t=100<(t=t<0?0:t)?100:t)+"%")},!!e&&{passive:!0})})}}();;
NexT.utils=NexT.$u={wrapImageWithFancyBox:function(){$(".content img").not("[hidden]").not(".group-picture img, .post-gallery img").each(function(){var e,t=$(this),i=t.attr("title"),n=t.parent("a");n.length<1&&(e=t.attr("data-original")?this.getAttribute("data-original"):this.getAttribute("src"),n=t.wrap('<a data-fancybox="group" href="'+e+'"></a>').parent("a")),n.addClass("fancybox fancybox.image"),n.attr("rel","group"),i&&(n.append('<p class="image-caption">'+i+"</p>"),n.attr("title",i))}),$(".fancybox").fancybox({helpers:{overlay:{locked:!1}}})},lazyLoadPostsImages:function(){$("#posts").find("img").lazyload({effect:"fadeIn",threshold:0})},registerTabsTag:function(){var t=".tabs ul.nav-tabs ";$(function(){$(window).bind("hashchange",function(){var e=location.hash;""!==e&&($(t+'li:has(a[href="'+e+'"])').addClass("active").siblings().removeClass("active"),$(e).addClass("active").siblings().removeClass("active"))}).trigger("hashchange")}),$(t+".tab").on("click",function(e){e.preventDefault(),$(this).hasClass("active")||($(this).addClass("active").siblings().removeClass("active"),e=$(this).find("a").attr("href"),$(e).addClass("active").siblings().removeClass("active"),""!==location.hash&&history.pushState("",document.title,window.location.pathname+window.location.search))})},registerESCKeyEvent:function(){$(document).on("keyup",function(e){27===e.which&&$(".search-popup").is(":visible")&&($(".search-popup").hide(),$(".search-popup-overlay").remove(),$("body").css("overflow",""))})},registerBackToTop:function(){var i=$(".back-to-top");$(window).on("scroll",function(){i.toggleClass("back-to-top-on",50<window.pageYOffset);var e=$(window).scrollTop(),t=NexT.utils.getContentVisibilityHeight(),t=Math.round(100*(e/t)),t=100<t?100:t;$("#scrollpercent>span").html(t)}),i.on("click",function(){$("body").velocity("scroll")})},embeddedVideoTransformer:function(){var e=$("iframe"),a=new RegExp(["www.youtube.com","player.vimeo.com","player.youku.com","music.163.com","www.tudou.com"].join("|"));function r(e){return{width:e.width(),height:e.height()}}function c(e,t){return t/e*100}e.each(function(){var e,t,i,n=this,o=$(this),s=r(o);0<this.src.search(a)&&(e=c(s.width,s.height),o.width("100%").height("100%").css({position:"absolute",top:"0",left:"0"}),(t=document.createElement("div")).className="fluid-vids",t.style.position="relative",t.style.marginBottom="20px",t.style.width="100%",t.style.paddingTop=e+"%",""===t.style.paddingTop&&(t.style.paddingTop="50%"),n.parentNode.insertBefore(t,n),t.appendChild(n),0<this.src.search("music.163.com")&&((i=r(o)).width>s.width||i.height<s.height)&&(t.style.paddingTop=c(i.width,s.height)+"%"))})},hasMobileUA:function(){var e=window.navigator.userAgent;return/iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g.test(e)},isTablet:function(){return window.screen.width<992&&767<window.screen.width&&this.hasMobileUA()},isMobile:function(){return window.screen.width<767&&this.hasMobileUA()},isDesktop:function(){return!this.isTablet()&&!this.isMobile()},escapeSelector:function(e){return e.replace(/[!"$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g,"\\$&")},displaySidebar:function(){!this.isDesktop()||this.isPisces()||this.isGemini()||$(".sidebar-toggle").trigger("click")},isMist:function(){return"Mist"===CONFIG.scheme},isPisces:function(){return"Pisces"===CONFIG.scheme},isGemini:function(){return"Gemini"===CONFIG.scheme},getScrollbarWidth:function(){var e=$("<div />").addClass("scrollbar-measure").prependTo("body"),t=e[0],t=t.offsetWidth-t.clientWidth;return e.remove(),t},getContentVisibilityHeight:function(){var e=$("#content").height(),t=$(window).height();return t<e?e-t:$(document).height()-t},getSidebarb2tHeight:function(){return CONFIG.sidebar.b2t?$(".back-to-top").height():0},getSidebarSchemePadding:function(){var e="block"==$(".sidebar-nav").css("display")?$(".sidebar-nav").outerHeight(!0):0,t=$(".sidebar-inner"),t=t.innerWidth()-t.width();return this.isPisces()||this.isGemini()?2*t+e+2*CONFIG.sidebar.offset+this.getSidebarb2tHeight():2*t+e/2}},$(document).ready(function(){function i(e){e=e||"auto",$(".site-overview, .post-toc").css("max-height",e)}!function(){var e;$(window).on("resize",function(){e&&clearTimeout(e),e=setTimeout(function(){i(document.body.clientHeight-NexT.utils.getSidebarSchemePadding())},0)});var t=NexT.utils.getScrollbarWidth();$(".site-overview-wrap").height()>document.body.clientHeight-NexT.utils.getSidebarSchemePadding()&&$(".site-overview").css("width","calc(100% + "+t+"px)");$(".post-toc-wrap").height()>document.body.clientHeight-NexT.utils.getSidebarSchemePadding()&&$(".post-toc").css("width","calc(100% + "+t+"px)");i(document.body.clientHeight-NexT.utils.getSidebarSchemePadding())}()});;
$(document).ready(function(){NexT.motion={};var t={lines:[],push:function(i){this.lines.push(i)},init:function(){this.lines.forEach(function(i){i.init()})},arrow:function(){this.lines.forEach(function(i){i.arrow()})},close:function(){this.lines.forEach(function(i){i.close()})}};function i(i){this.el=$(i.el),this.status=$.extend({},{init:{width:"100%",opacity:1,left:0,rotateZ:0,top:0}},i.status)}i.prototype.init=function(){this.transform("init")},i.prototype.arrow=function(){this.transform("arrow")},i.prototype.close=function(){this.transform("close")},i.prototype.transform=function(i){this.el.velocity("stop").velocity(this.status[i])};var e=new i({el:".sidebar-toggle-line-first",status:{arrow:{width:"50%",rotateZ:"-45deg",top:"2px"},close:{width:"100%",rotateZ:"-45deg",top:"5px"}}}),o=new i({el:".sidebar-toggle-line-middle",status:{arrow:{width:"90%"},close:{opacity:0}}}),n=new i({el:".sidebar-toggle-line-last",status:{arrow:{width:"50%",rotateZ:"45deg",top:"-2px"},close:{width:"100%",rotateZ:"45deg",top:"-5px"}}});t.push(e),t.push(o),t.push(n);var s,r,a="320px";({toggleEl:$(".sidebar-toggle"),dimmerEl:$("#sidebar-dimmer"),sidebarEl:$(".sidebar"),isSidebarVisible:!1,init:function(){this.toggleEl.on("click",this.clickHandler.bind(this)),this.dimmerEl.on("click",this.clickHandler.bind(this)),this.toggleEl.on("mouseenter",this.mouseEnterHandler.bind(this)),this.toggleEl.on("mouseleave",this.mouseLeaveHandler.bind(this)),this.sidebarEl.on("touchstart",this.touchstartHandler.bind(this)),this.sidebarEl.on("touchend",this.touchendHandler.bind(this)),this.sidebarEl.on("touchmove",function(i){i.preventDefault()}),$(document).on("sidebar.isShowing",function(){NexT.utils.isDesktop()&&$("body").velocity("stop").velocity({paddingRight:a},200)}).on("sidebar.isHiding",function(){})},clickHandler:function(){this.isSidebarVisible?this.hideSidebar():this.showSidebar(),this.isSidebarVisible=!this.isSidebarVisible},mouseEnterHandler:function(){this.isSidebarVisible||t.arrow()},mouseLeaveHandler:function(){this.isSidebarVisible||t.init()},touchstartHandler:function(i){s=i.originalEvent.touches[0].clientX,r=i.originalEvent.touches[0].clientY},touchendHandler:function(i){var t=i.originalEvent.changedTouches[0].clientX,i=i.originalEvent.changedTouches[0].clientY;30<t-s&&Math.abs(i-r)<20&&this.clickHandler()},showSidebar:function(){var i=this;t.close(),this.sidebarEl.velocity("stop").velocity({width:a},{display:"block",duration:200,begin:function(){$(".sidebar .motion-element").velocity("transition.slideRightIn",{stagger:50,drag:!0,complete:function(){i.sidebarEl.trigger("sidebar.motion.complete")}})},complete:function(){i.sidebarEl.addClass("sidebar-active"),i.sidebarEl.trigger("sidebar.didShow")}}),this.sidebarEl.trigger("sidebar.isShowing")},hideSidebar:function(){NexT.utils.isDesktop()&&$("body").velocity("stop").velocity({paddingRight:0}),this.sidebarEl.find(".motion-element").velocity("stop").css("display","none"),this.sidebarEl.velocity("stop").velocity({width:0},{display:"none"}),t.init(),this.sidebarEl.removeClass("sidebar-active"),this.sidebarEl.trigger("sidebar.isHiding"),$(".post-toc-wrap")&&("block"===$(".site-overview-wrap").css("display")?$(".post-toc-wrap").removeClass("motion-element"):$(".post-toc-wrap").addClass("motion-element"))}}).init(),NexT.motion.integrator={queue:[],cursor:-1,add:function(i){return this.queue.push(i),this},next:function(){this.cursor++;var i=this.queue[this.cursor];$.isFunction(i)&&i(NexT.motion.integrator)},bootstrap:function(){this.next()}},NexT.motion.middleWares={logo:function(i){var t=[],e=$(".brand"),o=$(".site-title"),n=$(".site-subtitle"),s=$(".logo-line-before i"),r=$(".logo-line-after i");function a(i,t){return{e:$(i),p:{translateX:t},o:{duration:500,sequenceQueue:!1}}}function l(i){return(i=Array.isArray(i)?i:[i]).every(function(i){return 0<i.length})}0<e.length&&t.push({e:e,p:{opacity:1},o:{duration:200}}),NexT.utils.isMist()&&l([s,r])&&t.push(a(s,"100%"),a(r,"-100%")),l(o)&&t.push({e:o,p:{opacity:1,top:0},o:{duration:200}}),l(n)&&t.push({e:n,p:{opacity:1,top:0},o:{duration:200}}),CONFIG.motion.async&&i.next(),0<t.length?(t[t.length-1].o.complete=function(){i.next()},$.Velocity.RunSequence(t)):i.next()},menu:function(i){CONFIG.motion.async&&i.next(),$(".menu-item").velocity("transition.slideDownIn",{display:null,duration:200,complete:function(){i.next()}})},postList:function(t){var e=$(".post-block, .pagination, .comments"),o=CONFIG.motion.transition.post_block,n=$(".post-header"),s=CONFIG.motion.transition.post_header,r=$(".post-body"),a=CONFIG.motion.transition.post_body,l=$(".collection-title, .archive-year"),c=CONFIG.motion.transition.coll_header,d=$(".sidebar-inner"),u=CONFIG.motion.transition.sidebar;0<e.length?function(){var i=window.postMotionOptions||{stagger:100,drag:!0};i.complete=function(){CONFIG.motion.transition.sidebar&&(NexT.utils.isPisces()||NexT.utils.isGemini())&&d.css({transform:"initial"}),t.next()},CONFIG.motion.transition.post_block&&e.velocity("transition."+o,i);CONFIG.motion.transition.post_header&&n.velocity("transition."+s,i);CONFIG.motion.transition.post_body&&r.velocity("transition."+a,i);CONFIG.motion.transition.coll_header&&l.velocity("transition."+c,i);CONFIG.motion.transition.sidebar&&(NexT.utils.isPisces()||NexT.utils.isGemini())&&d.velocity("transition."+u,i)}():t.next(),CONFIG.motion.async&&t.next()},sidebar:function(i){"always"===CONFIG.sidebar.display&&NexT.utils.displaySidebar(),i.next()}}});;
!function(s){"use strict";function a(t,i){this.options=s.extend({},a.DEFAULTS,i),this.$target=s(this.options.target).on("scroll.bs.affix.data-api",s.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",s.proxy(this.checkPositionWithEventLoop,this)),this.$element=s(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()}function e(e){return this.each(function(){var t=s(this),i=t.data("bs.affix");i||t.data("bs.affix",i=new a(this,"object"==typeof e&&e)),"string"==typeof e&&i[e]()})}a.VERSION="3.3.5",a.RESET="affix affix-top affix-bottom",a.DEFAULTS={offset:0,target:window},a.prototype.getState=function(t,i,e,o){var f=this.$target.scrollTop(),n=this.$element.offset(),s=this.$target.height();if(null!=e&&"top"==this.affixed)return f<e&&"top";if("bottom"==this.affixed)return null!=e?!(f+this.unpin<=n.top)&&"bottom":!(f+s<=t-o)&&"bottom";var a=null==this.affixed,n=a?f:n.top;return null!=e&&f<=e?"top":null!=o&&t-o<=n+(a?s:i)&&"bottom"},a.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(a.RESET).addClass("affix");var t=this.$target.scrollTop(),i=this.$element.offset();return this.pinnedOffset=i.top-t},a.prototype.checkPositionWithEventLoop=function(){setTimeout(s.proxy(this.checkPosition,this),1)},a.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),i=this.options.offset,e=i.top,o=i.bottom,f=Math.max(s(document).height(),s(document.body).height());"object"!=typeof i&&(o=e=i),"function"==typeof e&&(e=i.top(this.$element)),"function"==typeof o&&(o=i.bottom(this.$element));var n=this.getState(f,t,e,o);if(this.affixed!=n){null!=this.unpin&&this.$element.css("top","");i="affix"+(n?"-"+n:""),e=s.Event(i+".bs.affix");if(this.$element.trigger(e),e.isDefaultPrevented())return;this.affixed=n,this.unpin="bottom"==n?this.getPinnedOffset():null,this.$element.removeClass(a.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==n&&this.$element.offset({top:f-t-o})}};var t=s.fn.affix;s.fn.affix=e,s.fn.affix.Constructor=a,s.fn.affix.noConflict=function(){return s.fn.affix=t,this},s(window).on("load",function(){s('[data-spy="affix"]').each(function(){var t=s(this),i=t.data();i.offset=i.offset||{},null!=i.offsetBottom&&(i.offset.bottom=i.offsetBottom),null!=i.offsetTop&&(i.offset.top=i.offsetTop),e.call(t,i)})})}(jQuery);;
$(document).ready(function(){var a=$(".sidebar-inner");function i(){var e,i,t=$(".header-inner").height()+CONFIG.sidebar.offset,i=(e=$(".footer-inner"),i=e.outerHeight(!0)-e.outerHeight(),e.outerHeight(!0)+i);t+($("#sidebar").height()+NexT.utils.getSidebarb2tHeight())<$("#content").height()&&a.affix({offset:{top:t-CONFIG.sidebar.offset,bottom:i}}),t=t,$("#sidebar").css({"margin-top":t}).css({"margin-left":"initial"})}i(),window.matchMedia("(min-width: 991px)").addListener(function(e){e.matches&&($(window).off(".affix"),a.removeData("bs.affix").removeClass("affix affix-top affix-bottom"),i())})});;
!function(n){"use strict";function i(t,s){this.$body=n(document.body),this.$scrollElement=n(t).is(document.body)?n(window):n(t),this.options=n.extend({},i.DEFAULTS,s),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",n.proxy(this.process,this)),this.refresh(),this.process()}function s(e){return this.each(function(){var t=n(this),s=t.data("bs.scrollspy");s||t.data("bs.scrollspy",s=new i(this,"object"==typeof e&&e)),"string"==typeof e&&s[e]()})}i.VERSION="3.3.2",i.DEFAULTS={offset:10},i.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},i.prototype.refresh=function(){var t=this,e="offset",i=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),n.isWindow(this.$scrollElement[0])||(e="position",i=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=n(this),s=t.data("target")||t.attr("href"),t=/^#./.test(s)&&n(NexT.utils.escapeSelector(s));return t&&t.length&&t.is(":visible")?[[t[e]().top+i,s]]:null}).sort(function(t,s){return t[0]-s[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},i.prototype.process=function(){var t,s=this.$scrollElement.scrollTop()+this.options.offset,e=this.getScrollHeight(),i=this.options.offset+e-this.$scrollElement.height(),o=this.offsets,r=this.targets,l=this.activeTarget;if(this.scrollHeight!=e&&this.refresh(),i<=s)return l!=(t=r[r.length-1])&&this.activate(t);if(l&&s<o[0])return n(this.selector).trigger("clear.bs.scrollspy"),this.activeTarget=null,this.clear();for(t=o.length;t--;)l!=r[t]&&s>=o[t]&&(!o[t+1]||s<=o[t+1])&&this.activate(r[t])},i.prototype.activate=function(t){this.activeTarget=t,this.clear();t=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',t=n(t).parents("li").addClass("active");(t=t.parent(".dropdown-menu").length?t.closest("li.dropdown").addClass("active"):t).trigger("activate.bs.scrollspy")},i.prototype.clear=function(){n(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=n.fn.scrollspy;n.fn.scrollspy=s,n.fn.scrollspy.Constructor=i,n.fn.scrollspy.noConflict=function(){return n.fn.scrollspy=t,this},n(window).on("load.bs.scrollspy.data-api",function(){n('[data-spy="scroll"]').each(function(){var t=n(this);s.call(t,t.data())})})}(jQuery);;
$(document).ready(function(){function e(){$(o+" "+t).removeClass(t.substring(1))}var o,s,t;o=".post-toc",s=$(o),t=".active-current",s.on("activate.bs.scrollspy",function(){var t=$(o+" .active").last();e(),t.addClass("active-current"),s.scrollTop(t.offset().top-s.offset().top+s.scrollTop()-s.height()/2)}).on("clear.bs.scrollspy",e),$("body").scrollspy({target:o})}),$(document).ready(function(){var e=$("html"),i=200,l=$.isFunction(e.velocity);$(".sidebar-nav li").on("click",function(){var t,e,o=$(this),s="sidebar-nav-active",a="sidebar-panel-active";o.hasClass(s)||(t=$("."+a),e=$("."+o.data("target")),l?t.velocity("transition.slideUpOut",i,function(){e.velocity("stop").velocity("transition.slideDownIn",i).addClass(a)}):t.animate({opacity:0},i,function(){t.hide(),e.stop().css({opacity:0,display:"block"}).animate({opacity:1},i,function(){t.removeClass(a),e.addClass(a)})}),o.siblings().removeClass(s),o.addClass(s))}),$(".post-toc a").on("click",function(t){t.preventDefault();t=NexT.utils.escapeSelector(this.getAttribute("href")),t=$(t).offset().top;l?e.velocity("stop").velocity("scroll",{offset:t+"px",mobileHA:!1}):$("html, body").stop().animate({scrollTop:t},500)});var t,o=$(".post-toc-content"),s=CONFIG.page.sidebar;"boolean"!=typeof s&&(t="post"===CONFIG.sidebar.display||"always"===CONFIG.sidebar.display,o=0<o.length&&0<o.html().trim().length,s=t&&o),s&&(CONFIG.motion.enable?NexT.motion.middleWares.sidebar=function(){NexT.utils.displaySidebar()}:NexT.utils.displaySidebar())});;
$(document).ready(function(){$(document).trigger("bootstrap:before"),CONFIG.fastclick&&NexT.utils.isMobile()&&window.FastClick.attach(document.body),CONFIG.lazyload&&NexT.utils.lazyLoadPostsImages(),NexT.utils.registerESCKeyEvent(),NexT.utils.registerBackToTop(),$(".site-nav-toggle button").on("click",function(){var e=$(".site-nav"),t="site-nav-on",o=e.hasClass(t),a=o?"slideUp":"slideDown",i=o?"removeClass":"addClass";e.stop()[a]("fast",function(){e[i](t)})}),CONFIG.fancybox&&NexT.utils.wrapImageWithFancyBox(),CONFIG.tabs&&NexT.utils.registerTabsTag(),NexT.utils.embeddedVideoTransformer(),NexT.motion.integrator.add(NexT.motion.middleWares.logo).add(NexT.motion.middleWares.menu).add(NexT.motion.middleWares.postList).add(NexT.motion.middleWares.sidebar),$(document).trigger("motion:before"),CONFIG.motion.enable&&NexT.motion.integrator.bootstrap(),$(document).trigger("bootstrap:after")});