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