text: $(document).ready(function(){function e(e,a){var t=e.width(),n=a.width(),o=e.height(),s=a.height();if(o<s){e.css({width:"auto",height:"100%"}),t=e.width(),n=a.width();var r=(t-n)/2;e.css("margin-left","-"+r+"px")}else{var c=(s-o)/2;e.css("margin-top",c+"px")}e.fadeIn()}function a(){var e=$("#search_input"),a=$(".search_result");e.focus(function(){$(".icon-search").css("color","#3199DB"),a.show()}),e.keyup(t(this.autoComplete)),$(document).click(function(e){"search_input"!==e.target.id&&"search_result"!==e.target.className&&"search_item"!==e.target.className&&($(".icon-search").css("color","#CAD3DC"),a.hide())})}function t(e,a){var t;return a=a||120,function(){var n=this,o=arguments,s=function(){e.apply(n,o)};clearTimeout(t),t=setTimeout(s,a)}}function n(e){e+="\n\n著作权归作者所有。\n商业转载请联系作者获得授权,非商业转载请注明出处。\n原文: "+location.href,$(".post-content").on("copy",function(a){(window.clipboardData||a.originalEvent.clipboardData).setData("text/plain",e),a.preventDefault()})}var o=$(".g-nav");if($("#menu-toggle").on("click",function(e){o.slideToggle(200),$(document).on("click",function(){o.slideUp(200)}),e.stopPropagation()}),o.on("click",function(e){e.stopPropagation()}),$(window).width()>695){var s=$(".g-header"),r=s.outerHeight(),c=$(".g-logo"),i=o.find("a"),l=$(".g-banner").attr("data-theme"),u=$(document).scrollTop();$(document).scroll(function(){var e=$(this).scrollTop(),a="nav-"+l;e>r?(e>3*r&&s.addClass("headerUp"),s.css({"background-color":"rgba(255, 255, 255, .98)","box-shadow":"0 1px 12px rgba(0, 0, 0, .08)"}),c.css({background:"url("+window.BASEURL+"/assets/icons/logo_"+l+".svg) no-repeat center","background-size":"100% 100%"}),i.css("color","#666"),o.addClass(a)):(s.removeClass("headerUp"),s.css({"background-color":"transparent","box-shadow":"none"}),c.css({background:"url("+window.BASEURL+"/assets/icons/logo.svg) no-repeat center","background-size":"100% 100%"}),i.css("color","#fff"),o.removeClass(a)),u>e?s.addClass("headerDown"):s.removeClass("headerDown"),u=e})}$(".read-next-item section").each(function(){var e=$(this).height(),a=$(".read-next-item").height();$(this).css("margin-top",(a-e)/2+"px"),$(this).fadeIn()}),$(".read-next-item img").each(function(){e($(this),$(".read-next-item"))}),function(){for(var e=parseInt($("#total_pages").val()),a=parseInt($("#current_pages").val()),t=$("#base_url").val(),n="",o=a-3;o<a;o++)o>0&&1!==o?n+='<a href="'+t+"page"+o+'" class="page-link page-num">'+o+"</a>":1===o&&(n+='<a href="'+t+'" class="page-link page-num">'+o+"</a>");n+='<span class="page-link page-num active">'+a+"</span>";for(var s=a+1;s<=a+3;s++)s<=e&&(n+='<a href="'+t+"page"+s+'" class="page-link page-num">'+s+"</a>");$("#page-link-container").html(n)}(),a.prototype.autoComplete=function(){var e=this.value.toLowerCase();e.length?$(".icon-search").css("color","#3199DB"):$(".icon-search").css("color","#CAD3DC"),$.getJSON(window.BASEURL+"/search.json").done(function(a){var t="";for(var n in a){var o=a[n],s=o.title,r=o.tags,c=(o.url,s+r);""!==e&&c.toLowerCase().indexOf(e)>=0&&(t+='<a class="search_item" href="'+o.url+'">'+o.title+"</a>")}$(".search_result").html(t)})},new a,"true"===$("#nm-switch").val()&&function(){var e=$("body"),a=new Date,t=a.getHours();(t>=0&&t<=6||23===t)&&e.addClass("night-mode")}(),$(".post-content").on("mouseup",function(e){var a=window.getSelection();a.toString().length>=30&&n(a)})});