Commit 67c4a64a authored by Van's avatar Van

#20 2

parent 8b6a1451
var Skin={init:function(){Util.initPjax()},_positionToc:function(t){1===t.length&&($(window).width()>876?$(".post__toc").css("left",$(".article .item__content").offset().left+$(".article .item__content").outerWidth()-80):$(".post__toc a").click((function(){$(".post__toc").hide()})))},initArticle:function(){page.share();var t=$(".vditor-reset [id^=b3_solo_h]"),o=$(".article__toc"),i=$(".article__progress");Skin._positionToc(o),o.find("a").click((function(t){var o=$(this).attr("href");return window.location.hash=o,$(window).scrollTop($(o).offset().top-60),t.preventDefault(),t.stopPropagation(),!1})),$(window).unbind("scroll").scroll((function(n){if(0===i.length)return!1;if(i.attr("value",parseInt($(window).scrollTop())).attr("max",parseInt($("body").outerHeight()-$(window).height())),$(window).scrollTop()>236?$(".article__top").css("top",0):$(".article__top").css("top",-61),0===$(".article__toc li").length)return!1;$(window).width()>876&&($(window).scrollTop()>975&&$(window).scrollTop()<$(".article").outerHeight()+100?$(".post__toc").show():$(".post__toc").hide());var e=[];t.each((function(t){e.push({id:this.id,offsetTop:$(this).offset().top})}));for(var r=$(window).scrollTop(),s=0,c=e.length;s<c;s++)if(r<e[s].offsetTop-61){o.find("li").removeClass("current");var l=s>0?s-1:0;o.find('a[href="#'+e[l].id+'"]').parent().addClass("current");break}r>=e[e.length-1].offsetTop-61&&(o.find("li").removeClass("current"),o.find("li:last").addClass("current"))})),$(window).scroll(),$(window).resize((function(){Skin._positionToc(o)}))}};Skin.init();
\ No newline at end of file
var Skin={init:function(){Label.staticSite||Util.initPjax()},_positionToc:function(t){1===t.length&&($(window).width()>876?$(".post__toc").css("left",$(".article .item__content").offset().left+$(".article .item__content").outerWidth()-80):$(".post__toc a").click((function(){$(".post__toc").hide()})))},initArticle:function(){page.share();var t=$(".vditor-reset [id^=b3_solo_h]"),o=$(".article__toc"),i=$(".article__progress");Skin._positionToc(o),o.find("a").click((function(t){var o=$(this).attr("href");return window.location.hash=o,$(window).scrollTop($(o).offset().top-60),t.preventDefault(),t.stopPropagation(),!1})),$(window).unbind("scroll").scroll((function(n){if(0===i.length)return!1;if(i.attr("value",parseInt($(window).scrollTop())).attr("max",parseInt($("body").outerHeight()-$(window).height())),$(window).scrollTop()>236?$(".article__top").css("top",0):$(".article__top").css("top",-61),0===$(".article__toc li").length)return!1;$(window).width()>876&&($(window).scrollTop()>975&&$(window).scrollTop()<$(".article").outerHeight()+100?$(".post__toc").show():$(".post__toc").hide());var e=[];t.each((function(t){e.push({id:this.id,offsetTop:$(this).offset().top})}));for(var r=$(window).scrollTop(),s=0,c=e.length;s<c;s++)if(r<e[s].offsetTop-61){o.find("li").removeClass("current");var l=s>0?s-1:0;o.find('a[href="#'+e[l].id+'"]').parent().addClass("current");break}r>=e[e.length-1].offsetTop-61&&(o.find("li").removeClass("current"),o.find("li:last").addClass("current"))})),$(window).scroll(),$(window).resize((function(){Skin._positionToc(o)}))}};Skin.init();
\ No newline at end of file
var Skin={initToc:function(){$(".article__toc li").length>0&&$(window).width()>768?($(".article__toc").css({right:"50px","border-right":"1px solid #fff",opacity:1}),$("#pjax.wrapper").css({"max-width":"968px","padding-right":"270px"})):$("#pjax.wrapper").removeAttr("style")},init:function(){Skin.initToc(),Util.initPjax((function(){$(".header a").each((function(){this.href===location.href?this.className="current vditor-tooltipped vditor-tooltipped__w":this.className="vditor-tooltipped vditor-tooltipped__w"})),Skin.initToc()})),$(".header a").each((function(){this.href===location.href&&(this.className="current vditor-tooltipped vditor-tooltipped__w")})).click((function(){$(".header a").removeClass("current"),this.className="current vditor-tooltipped vditor-tooltipped__w"}))}};Skin.init();
\ No newline at end of file
var Skin={initToc:function(){$(".article__toc li").length>0&&$(window).width()>768?($(".article__toc").css({right:"50px","border-right":"1px solid #fff",opacity:1}),$("#pjax.wrapper").css({"max-width":"968px","padding-right":"270px"})):$("#pjax.wrapper").removeAttr("style")},init:function(){Skin.initToc(),$(".header a").each((function(){this.href===location.href&&(this.className="current vditor-tooltipped vditor-tooltipped__w")})).click((function(){$(".header a").removeClass("current"),this.className="current vditor-tooltipped vditor-tooltipped__w"})),Label.staticSite||Util.initPjax((function(){$(".header a").each((function(){this.href===location.href?this.className="current vditor-tooltipped vditor-tooltipped__w":this.className="vditor-tooltipped vditor-tooltipped__w"})),Skin.initToc()}))}};Skin.init();
\ No newline at end of file
var Skin={init:function(){var t=$(".article__toc");$(window).scroll((function(){1===t.length&&($(".article__bottom").offset().top<$(window).scrollTop()?t.hide():t.show()),0!==$("#headerNav").length&&($(window).scrollTop()>64?($("#headerNav").addClass("header__nav--fixed"),$(".main").css("margin-top","100px")):($("#headerNav").removeClass("header__nav--fixed"),$(".main").css("margin-top","50px")))})),$(window).scroll(),Util.initPjax((function(){Util.parseMarkdown(),Util.isArticlePage(location.href)&&($("#articleSideShare .article__code").qrcode||$.ajax({method:"GET",url:Label.staticServePath+"/js/lib/jquery.qrcode.min.js",dataType:"script",cache:!0})),Skin.initToc()})),Skin.initToc()},initTags:function(){for(var t=$("#tags"),e=t.find(".tag"),i=parseInt(e.first().data("count")),o=Math.ceil(i/5),a=0;a<e.length;a++)for(var n=parseInt($(e[a]).data("count")),s=0;s<5;s++)if(n>s*o&&n<=(s+1)*o){e[a].className="tag tag__level"+s;break}t.html(e.get().sort((function(t,e){var i=$(t).text().toLowerCase(),o=$(e).text().toLowerCase();return i.localeCompare(o)})))},initArticle:function(){if(0!==$("#articleShare").length){Skin._share("#articleShare"),Skin._share("#articleSideShare"),Skin._share("#articleBottomShare");var t=$(".post__side");$(window).height()>=$(".post").height()&&t.css("opacity",1),t.css("left",($(".post").offset().left-20)/2-27+"px");var e=($(window).height()-249)/2+125,i=$(window).scrollTop();$(window).scroll((function(){if(0!==$("#articleShare").length){var o=$(window).scrollTop(),a=$(".article__bottom").offset().top;o>65?(t.css("opacity",1),i-o>0?($(".header").addClass("header--fixed").css({top:"0"}),$(".main").css("padding-top","64px"),$(window).height()<=$(".post").height()&&o<a-$(window).height()&&$(".article__toolbar").css({bottom:0,opacity:1})):i-o<0&&($(".header").css({top:"-64px"}).removeClass("header--fixed"),$(".main").css("padding-top","0"),$(".article__toolbar").css({bottom:"-44px",opacity:0}))):($(window).height()<=$(".post").height()&&t.css("opacity",0),$(".header").removeClass("header--fixed").css("top","-64px"),$(".main").css("padding-top","0")),o>a-$(window).height()?a<$(window).height()?t.css({position:"absolute",top:a-125+"px"}):t.css({position:"absolute",top:a-e+"px"}):t.css({position:"fixed",top:"50%"}),i=o}})),$(window).scroll()}},_share:function(t){var e=$(t),i=e.find(".article__code"),o=i.data("url"),a=i.data("avatar"),n=encodeURIComponent(i.data("title")+" - "+i.data("blogtitle")),s=encodeURIComponent(o),r={};r.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+n+"&url="+s+"&pic="+a,r.weibo="http://v.t.sina.com.cn/share/share.php?title="+n+"&url="+s+"&pic="+a,r.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+s+"&sharesource=qzone&title="+n+"&pics="+a,r.twitter="https://twitter.com/intent/tweet?status="+n+" "+s,e.find("span").click((function(){var t=$(this).data("type");if(t)return"wechat"===t?(0===i.find("canvas").length?i.qrcode({width:128,height:128,text:o}):i.slideToggle(),!1):void window.open(r[t],"_blank","top=100,left=200,width=648,height=618")}))},initToc:function(){0!==$(".article__toc").length&&$(window).width()>1e3?$(".article__toc").animate({left:$(".post").outerWidth()+$(".post").offset().left+"px"},600):$(".article__toc").hide()}};Skin.init();
\ No newline at end of file
var Skin={init:function(){var t=$(".article__toc");$(window).scroll((function(){1===t.length&&($(".article__bottom").offset().top<$(window).scrollTop()?t.hide():t.show()),0!==$("#headerNav").length&&($(window).scrollTop()>64?($("#headerNav").addClass("header__nav--fixed"),$(".main").css("margin-top","100px")):($("#headerNav").removeClass("header__nav--fixed"),$(".main").css("margin-top","50px")))})),$(window).scroll(),Skin.initToc(),Label.staticSite||Util.initPjax((function(){Util.parseMarkdown(),Util.isArticlePage(location.href)&&($("#articleSideShare .article__code").qrcode||$.ajax({method:"GET",url:Label.staticServePath+"/js/lib/jquery.qrcode.min.js",dataType:"script",cache:!0})),Skin.initToc()}))},initTags:function(){for(var t=$("#tags"),e=t.find(".tag"),i=parseInt(e.first().data("count")),a=Math.ceil(i/5),o=0;o<e.length;o++)for(var n=parseInt($(e[o]).data("count")),s=0;s<5;s++)if(n>s*a&&n<=(s+1)*a){e[o].className="tag tag__level"+s;break}t.html(e.get().sort((function(t,e){var i=$(t).text().toLowerCase(),a=$(e).text().toLowerCase();return i.localeCompare(a)})))},initArticle:function(){if(0!==$("#articleShare").length){Skin._share("#articleShare"),Skin._share("#articleSideShare"),Skin._share("#articleBottomShare");var t=$(".post__side");$(window).height()>=$(".post").height()&&t.css("opacity",1),t.css("left",($(".post").offset().left-20)/2-27+"px");var e=($(window).height()-249)/2+125,i=$(window).scrollTop();$(window).scroll((function(){if(0!==$("#articleShare").length){var a=$(window).scrollTop(),o=$(".article__bottom").offset().top;a>65?(t.css("opacity",1),i-a>0?($(".header").addClass("header--fixed").css({top:"0"}),$(".main").css("padding-top","64px"),$(window).height()<=$(".post").height()&&a<o-$(window).height()&&$(".article__toolbar").css({bottom:0,opacity:1})):i-a<0&&($(".header").css({top:"-64px"}).removeClass("header--fixed"),$(".main").css("padding-top","0"),$(".article__toolbar").css({bottom:"-44px",opacity:0}))):($(window).height()<=$(".post").height()&&t.css("opacity",0),$(".header").removeClass("header--fixed").css("top","-64px"),$(".main").css("padding-top","0")),a>o-$(window).height()?o<$(window).height()?t.css({position:"absolute",top:o-125+"px"}):t.css({position:"absolute",top:o-e+"px"}):t.css({position:"fixed",top:"50%"}),i=a}})),$(window).scroll()}},_share:function(t){var e=$(t),i=e.find(".article__code"),a=i.data("url"),o=i.data("avatar"),n=encodeURIComponent(i.data("title")+" - "+i.data("blogtitle")),s=encodeURIComponent(a),r={};r.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+n+"&url="+s+"&pic="+o,r.weibo="http://v.t.sina.com.cn/share/share.php?title="+n+"&url="+s+"&pic="+o,r.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+s+"&sharesource=qzone&title="+n+"&pics="+o,r.twitter="https://twitter.com/intent/tweet?status="+n+" "+s,e.find("span").click((function(){var t=$(this).data("type");if(t)return"wechat"===t?(0===i.find("canvas").length?i.qrcode({width:128,height:128,text:a}):i.slideToggle(),!1):void window.open(r[t],"_blank","top=100,left=200,width=648,height=618")}))},initToc:function(){0!==$(".article__toc").length&&$(window).width()>1e3?$(".article__toc").animate({left:$(".post").outerWidth()+$(".post").offset().left+"px"},600):$(".article__toc").hide()}};Skin.init();
\ No newline at end of file
var goTop=function(e){e=e||.1;var a=$(window).scrollTop(),t=1+e;if(window.scrollTo(0,Math.floor(a/t)),a>0){var n="goTop("+e+")";window.setTimeout(n,16)}},collapseArchive=function(e,a){var t=!0;"collapse-ico"===e.className?(e.className="expand-ico",t=!1):e.className="collapse-ico",$("#archiveSide li").each((function(){$(this).data("year")===a&&(t?$(this).show():$(this).hide())}))},getArticle=function(e,a){var t=$("#abstract"+a),n=$("#content"+a);return""===n.html()?$.ajax({url:"/get-article-content?id="+a,type:"GET",dataType:"html",beforeSend:function(){t.css("background","url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent")},success:function(a,i){e.className="collapse-ico",n.html(a),t.hide().css("background","none"),n.fadeIn("slow"),Util.parseLanguage(),Util.parseMarkdown()}}):"expand-ico"===e.className?(t.hide(),n.fadeIn(),e.className="collapse-ico"):(n.hide(),t.fadeIn(),e.className="expand-ico"),!1},goTranslate=function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)};$(document).ready((function(){$(window).scroll((function(){var e=$(window).scrollTop();if(e>182){var a=$(window).height(),t=e+a-21;$("body").height()-58<=e+a&&(t=$(".footer").offset().top-21),$("#goTop").fadeIn("slow").css("top",t)}else $("#goTop").hide()}));var e=(new Date).getFullYear(),a=e;$("#archiveSide li").each((function(t){var n=$(this);n.data("year")!==e&&$(this).hide(),a!==n.data("year")&&(a=n.data("year"),n.before("<li class='archive-year'><div onclick='collapseArchive(this, "+a+")' class='expand-ico'>"+a+"&nbsp;\u5e74</div></li>"))})),$(".recent-comments .expand-ico").click((function(){"expand-ico"===this.className?($(this).parent().next().css({height:"auto","white-space":"normal"}),this.className="collapse-ico"):($(this).parent().next().animate({height:"18px"},(function(){$(this).css("white-space","nowrap")})),this.className="expand-ico")})),$(".nav ul li").each((function(){$(this).find("a").attr("href")===Label.servePath+location.pathname?$(this).addClass("current"):/\/[0-9]+$/.test(location.pathname)&&($(".nav ul li")[0].className="current")})),Util.setTopBar(),Util.buildTags("tagsSide"),$(".recent-comments .recent-comments-main").each((function(){$(this).find(".recent-comments-content>a").height()<30?$(this).find(".expand-ico").remove():$(this).find(".expand-ico").parent().next().css({"white-space":"nowrap"})}))}));
\ No newline at end of file
var goTop=function(a){a=a||.1;var e=$(window).scrollTop(),t=1+a;if(window.scrollTo(0,Math.floor(e/t)),e>0){var o="goTop("+a+")";window.setTimeout(o,16)}},collapseArchive=function(a,e){var t=!0;"collapse-ico"===a.className?(a.className="expand-ico",t=!1):a.className="collapse-ico",$("#archiveSide li").each((function(){$(this).data("year")===e&&(t?$(this).show():$(this).hide())}))},getArticle=function(a,e){var t=$("#abstract"+e),o=$("#content"+e);return""===o.html()?$.ajax({url:"/get-article-content?id="+e,type:"GET",dataType:"html",beforeSend:function(){t.css("background","url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent")},success:function(e,i){a.className="collapse-ico",o.html(e),t.hide().css("background","none"),o.fadeIn("slow"),Util.parseLanguage(),Util.parseMarkdown()}}):"expand-ico"===a.className?(t.hide(),o.fadeIn(),a.className="collapse-ico"):(o.hide(),t.fadeIn(),a.className="expand-ico"),!1},goTranslate=function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)};$(document).ready((function(){$(window).scroll((function(){var a=$(window).scrollTop();if(a>182){var e=$(window).height(),t=a+e-21;$("body").height()-58<=a+e&&(t=$(".footer").offset().top-21),$("#goTop").fadeIn("slow").css("top",t)}else $("#goTop").hide()}));var a=(new Date).getFullYear(),e=a;$("#archiveSide li").each((function(t){var o=$(this);o.data("year")!==a&&$(this).hide(),e!==o.data("year")&&(e=o.data("year"),o.before("<li class='archive-year'><div onclick='collapseArchive(this, "+e+")' class='expand-ico'>"+e+"&nbsp;\u5e74</div></li>"))})),$(".recent-comments .expand-ico").click((function(){"expand-ico"===this.className?($(this).parent().next().css({height:"auto","white-space":"normal"}),this.className="collapse-ico"):($(this).parent().next().animate({height:"18px"},(function(){$(this).css("white-space","nowrap")})),this.className="expand-ico")})),$(".nav ul li").each((function(){$(this).find("a").attr("href")===Label.servePath+location.pathname?$(this).addClass("current"):/\/[0-9]+$/.test(location.pathname)&&($(".nav ul li")[0].className="current")})),Util.setTopBar(),Util.buildTags("tagsSide")}));
\ No newline at end of file
var Skin={init:function(){new Headroom($("header")[0],{tolerance:0,offset:70,classes:{initial:"header",pinned:"header--down",unpinned:"header--up",top:"header",notTop:"header",bottom:"header",notBottom:"header"}}).init(),Util.initPjax((function(){0===$(".post__fix").length?$("body").addClass("body--gray"):$("body").removeClass("body--gray"),$(".header__nav a").each((function(){$(".header__nav a").removeClass("current"),this.href===location.href&&(this.className="current")})),Skin._initToc()})),$(".header__nav a").each((function(){this.href===location.href&&(this.className="current")})).click((function(){$(".header__nav a").removeClass("current"),this.href===location.href&&(this.className="current")}))},_initToc:function(){if(0!==$(".article__toc").length){$(".post__toc").css("left",$(".post").offset().left+$(".post").outerWidth());var t=$(".vditor-reset [id^=b3_solo_h]"),e=$(".article__toc");$(window).unbind("scroll").scroll((function(i){if(0===$(".article__toc li").length)return!1;if($(window).scrollTop()>72){$(".post__toc").show();var n=[];t.each((function(t){n.push({id:this.id,offsetTop:this.offsetTop})}));for(var o=$(window).scrollTop(),a=0,s=n.length;a<s;a++)if(o<n[a].offsetTop-20){e.find("li").removeClass("current");var r=a>0?a-1:0;e.find('a[href="#'+n[r].id+'"]').parent().addClass("current");break}o>=n[n.length-1].offsetTop-20&&(e.find("li").removeClass("current"),e.find("li:last").addClass("current"))}else $(".post__toc").hide()})),$(window).scroll()}},_initShare:function(){var t=$(".post__share"),e=t.find(".post__code"),i=e.data("url"),n=e.data("avatar"),o=encodeURIComponent(e.data("title")+" - "+e.data("blogtitle")),a=encodeURIComponent(i),s={};s.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+a+"&pic="+n,s.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+a+"&sharesource=qzone&title="+o+"&pics="+n,s.twitter="https://twitter.com/intent/tweet?status="+o+" "+a,t.find("span").click((function(){var t=$(this).data("type");if(t)return"wechat"===t?(0===e.find("canvas").length?$.ajax({method:"GET",url:Label.staticServePath+"/js/lib/jquery.qrcode.min.js",dataType:"script",cache:!0,success:function(){e.qrcode({width:128,height:128,text:i})}}):e.find("canvas").slideToggle(),!1):void window.open(s[t],"_blank","top=100,left=200,width=648,height=618")}))},initArticle:function(){new Headroom($(".post__fix")[0],{tolerance:0,offset:48,classes:{initial:"post__fix",pinned:"post__fix--pinned",unpinned:"post__fix--unpinned",top:"post__fix",notTop:"post__fix",bottom:"post__fix",notBottom:"post__fix"}}).init(),Skin._initShare(),Skin._initToc()}};Skin.init();
\ No newline at end of file
var Skin={init:function(){new Headroom($("header")[0],{tolerance:0,offset:70,classes:{initial:"header",pinned:"header--down",unpinned:"header--up",top:"header",notTop:"header",bottom:"header",notBottom:"header"}}).init(),$(".header__nav a").each((function(){this.href===location.href&&(this.className="current")})).click((function(){$(".header__nav a").removeClass("current"),this.href===location.href&&(this.className="current")})),Label.staticSite||Util.initPjax((function(){0===$(".post__fix").length?$("body").addClass("body--gray"):$("body").removeClass("body--gray"),$(".header__nav a").each((function(){$(".header__nav a").removeClass("current"),this.href===location.href&&(this.className="current")})),Skin._initToc()}))},_initToc:function(){if(0!==$(".article__toc").length){$(".post__toc").css("left",$(".post").offset().left+$(".post").outerWidth());var t=$(".vditor-reset [id^=b3_solo_h]"),e=$(".article__toc");$(window).unbind("scroll").scroll((function(i){if(0===$(".article__toc li").length)return!1;if($(window).scrollTop()>72){$(".post__toc").show();var n=[];t.each((function(t){n.push({id:this.id,offsetTop:this.offsetTop})}));for(var o=$(window).scrollTop(),a=0,s=n.length;a<s;a++)if(o<n[a].offsetTop-20){e.find("li").removeClass("current");var r=a>0?a-1:0;e.find('a[href="#'+n[r].id+'"]').parent().addClass("current");break}o>=n[n.length-1].offsetTop-20&&(e.find("li").removeClass("current"),e.find("li:last").addClass("current"))}else $(".post__toc").hide()})),$(window).scroll()}},_initShare:function(){var t=$(".post__share"),e=t.find(".post__code"),i=e.data("url"),n=e.data("avatar"),o=encodeURIComponent(e.data("title")+" - "+e.data("blogtitle")),a=encodeURIComponent(i),s={};s.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+a+"&pic="+n,s.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+a+"&sharesource=qzone&title="+o+"&pics="+n,s.twitter="https://twitter.com/intent/tweet?status="+o+" "+a,t.find("span").click((function(){var t=$(this).data("type");if(t)return"wechat"===t?(0===e.find("canvas").length?$.ajax({method:"GET",url:Label.staticServePath+"/js/lib/jquery.qrcode.min.js",dataType:"script",cache:!0,success:function(){e.qrcode({width:128,height:128,text:i})}}):e.find("canvas").slideToggle(),!1):void window.open(s[t],"_blank","top=100,left=200,width=648,height=618")}))},initArticle:function(){new Headroom($(".post__fix")[0],{tolerance:0,offset:48,classes:{initial:"post__fix",pinned:"post__fix--pinned",unpinned:"post__fix--unpinned",top:"post__fix",notTop:"post__fix",bottom:"post__fix",notBottom:"post__fix"}}).init(),Skin._initShare(),Skin._initToc()}};Skin.init();
\ No newline at end of file
var MetroHot={headerH:$("#header").height()+30+($("#header > div").get(1)?30:0),responsiveType:"large",goTranslate:function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)},init:function(){var e="";$("#admin a").each((function(){$(this).attr("href").indexOf("/logout")>-1&&(e=$(this).attr("href"))})),$("#logout, .logout").attr("href",e),$(".header .title, .navigation").mouseover((function(){$(".navigation").show()})).mouseout((function(){$(".navigation").hide()})),$(".header .title").click((function(){window.location.href=Label.servePath}));var t=$("#top > span").first().text();if($(".online-count .text").append(t.substr(1,t.length)),1===$("#dynamic").length)return $(window).scroll((function(){$(window).scrollTop()>MetroHot.headerH?$("#goTop").fadeIn("slow"):$("#goTop").hide()})).click((function(e){"title"!==e.target.className&&"title"!==e.target.parentElement.className&&$(".navigation").slideUp()})),void $("body").css("min-height","inherit");$(window).scroll((function(){$(window).scrollTop()>MetroHot.headerH?$("#goTop").fadeIn("slow"):$("#goTop").hide()})).click((function(e){"title"!==e.target.className&&"title"!==e.target.parentElement.className&&$(".navigation").slideUp()})).resize((function(){var e=window.innerWidth,t="large";e>460&&e<=860?t="mid":window<460&&(t="small"),MetroHot.responsiveType!==t&&($(window).scroll(),MetroHot.responsiveType)})),$(window).scroll()},loadImg:function(e){e.style.marginTop=(220-e.height)/2+"px"},share:function(){var e=$(".share .text"),t=e.find(".icon-wechat"),a=t.data("url"),n=t.data("avatar"),i=encodeURIComponent(t.data("title")+" - "+t.data("blogtitle")),l=encodeURIComponent(a),r={};r.weibo="http://v.t.sina.com.cn/share/share.php?title="+i+"&url="+l+"&pic="+n,r.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+l+"&sharesource=qzone&title="+i+"&pics="+n,r.twitter="https://twitter.com/intent/tweet?status="+i+" "+l,e.find("span").click((function(){var e=$(this).data("type");if(e)return"wechat"===e?(0===t.find("canvas").length?$.ajax({method:"GET",url:Label.staticServePath+"/js/lib/jquery.qrcode.min.js",dataType:"script",cache:!0,success:function(){t.qrcode({width:111,height:111,text:a})}}):t.find("canvas").slideToggle(),!1):void window.open(r[e],"_blank","top=100,left=200,width=648,height=618")}))},loadRandomArticles:function(){$.ajax({url:Label.servePath+"/articles/random",type:"POST",success:function(e,t){var a=e.randomArticles;if(a&&0!==a.length){for(var n="",i=0;i<a.length&&i<5;i++){var l=a[i],r=l.articleTitle;n+="<li><a rel='nofollow' title='"+r+"' href='"+Label.servePath+l.articlePermalink+"'>"+r+"</a></li>"}var o="<ul>"+n+"</ul>";$("#randomArticles .text").append(o)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(e){$.ajax({url:Label.servePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,t){var a=e.relevantArticles;if(a&&0!==a.length){for(var n="",i=0;i<a.length&&i<5;i++){var l=a[i],r=l.articleTitle;n+="<li><a rel='nofollow' title='"+r+"' href='"+Label.servePath+l.articlePermalink+"'>"+r+"</a></li>"}var o="<ul>"+n+"</ul>";$("#relevantArticles .text").append(o)}else $("#relevantArticles").remove()},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(e){var t=this.tips;try{$.ajax({url:"http://rhythm.b3log.org:80/get-articles-by-tags.do?tags="+e+"&blogHost="+t.blogHost+"&paginationPageSize="+t.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(e,t){var a=e.articles;if(a&&0!==a.length){for(var n="",i=0;i<a.length&&i<5;i++){var l=a[i],r=l.articleTitle;n+="<li><a rel='nofollow' title='"+r+"' target='_blank' href='"+l.articlePermalink+"'>"+r+"</a></li>"}var o="<ul>"+n+"</ul>";$("#externalRelevantArticles .text").append(o)}else $("#externalRelevantArticles").remove()}})}catch(e){$("#externalRelevantArticles").remove()}},goCmt:function(){$("html, body").animate({scrollTop:$(".comment-disabled").get(0).offsetTop})}};MetroHot.init(),$(".article-header").length>0&&MetroHot.share();
\ No newline at end of file
var MetroHot={headerH:$("#header").height()+30+($("#header > div").get(1)?30:0),responsiveType:"large",goTranslate:function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)},init:function(){var e="";if($("#admin a").each((function(){$(this).attr("href").indexOf("/logout")>-1&&(e=$(this).attr("href"))})),$("#logout, .logout").attr("href",e),$(".header .title, .navigation").mouseover((function(){$(".navigation").show()})).mouseout((function(){$(".navigation").hide()})),$(".header .title").click((function(){window.location.href=Label.servePath})),1===$("#dynamic").length)return $(window).scroll((function(){$(window).scrollTop()>MetroHot.headerH?$("#goTop").fadeIn("slow"):$("#goTop").hide()})).click((function(e){"title"!==e.target.className&&"title"!==e.target.parentElement.className&&$(".navigation").slideUp()})),void $("body").css("min-height","inherit");$(window).scroll((function(){$(window).scrollTop()>MetroHot.headerH?$("#goTop").fadeIn("slow"):$("#goTop").hide()})).click((function(e){"title"!==e.target.className&&"title"!==e.target.parentElement.className&&$(".navigation").slideUp()})).resize((function(){var e=window.innerWidth,t="large";e>460&&e<=860?t="mid":window<460&&(t="small"),MetroHot.responsiveType!==t&&($(window).scroll(),MetroHot.responsiveType)})),$(window).scroll()},loadImg:function(e){e.style.marginTop=(220-e.height)/2+"px"},share:function(){var e=$(".share .text"),t=e.find(".icon-wechat"),a=t.data("url"),i=t.data("avatar"),l=encodeURIComponent(t.data("title")+" - "+t.data("blogtitle")),n=encodeURIComponent(a),r={};r.weibo="http://v.t.sina.com.cn/share/share.php?title="+l+"&url="+n+"&pic="+i,r.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+n+"&sharesource=qzone&title="+l+"&pics="+i,r.twitter="https://twitter.com/intent/tweet?status="+l+" "+n,e.find("span").click((function(){var e=$(this).data("type");if(e)return"wechat"===e?(0===t.find("canvas").length?$.ajax({method:"GET",url:Label.staticServePath+"/js/lib/jquery.qrcode.min.js",dataType:"script",cache:!0,success:function(){t.qrcode({width:111,height:111,text:a})}}):t.find("canvas").slideToggle(),!1):void window.open(r[e],"_blank","top=100,left=200,width=648,height=618")}))},loadRandomArticles:function(){$.ajax({url:Label.servePath+"/articles/random",type:"POST",success:function(e,t){var a=e.randomArticles;if(a&&0!==a.length){for(var i="",l=0;l<a.length&&l<5;l++){var n=a[l],r=n.articleTitle;i+="<li><a rel='nofollow' title='"+r+"' href='"+Label.servePath+n.articlePermalink+"'>"+r+"</a></li>"}var o="<ul>"+i+"</ul>";$("#randomArticles .text").append(o)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(e){$.ajax({url:Label.servePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,t){var a=e.relevantArticles;if(a&&0!==a.length){for(var i="",l=0;l<a.length&&l<5;l++){var n=a[l],r=n.articleTitle;i+="<li><a rel='nofollow' title='"+r+"' href='"+Label.servePath+n.articlePermalink+"'>"+r+"</a></li>"}var o="<ul>"+i+"</ul>";$("#relevantArticles .text").append(o)}else $("#relevantArticles").remove()},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(e){var t=this.tips;try{$.ajax({url:"http://rhythm.b3log.org:80/get-articles-by-tags.do?tags="+e+"&blogHost="+t.blogHost+"&paginationPageSize="+t.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(e,t){var a=e.articles;if(a&&0!==a.length){for(var i="",l=0;l<a.length&&l<5;l++){var n=a[l],r=n.articleTitle;i+="<li><a rel='nofollow' title='"+r+"' target='_blank' href='"+n.articlePermalink+"'>"+r+"</a></li>"}var o="<ul>"+i+"</ul>";$("#externalRelevantArticles .text").append(o)}else $("#externalRelevantArticles").remove()}})}catch(e){$("#externalRelevantArticles").remove()}},goCmt:function(){$("html, body").animate({scrollTop:$(".comment-disabled").get(0).offsetTop})}};MetroHot.init(),$(".article-header").length>0&&MetroHot.share();
\ No newline at end of file
var Skin={_initCommon:function(e){$(window).scroll((function(){$(window).scrollTop()>125?e.show():e.hide(),$(".side .article__toc").length>0&&$(window).width()>768&&($(window).scrollTop()>50?$(".side").css("position","fixed"):$(".side").css("position","initial"))}))},_initAnimation:function(){if(!("IntersectionObserver"in window))return $(".item").addClass("item--active"),!1;window.imageIntersectionObserver?(window.imageIntersectionObserver.disconnect(),$(".item").each((function(){window.imageIntersectionObserver.observe(this)}))):(window.imageIntersectionObserver=new IntersectionObserver((function(e){e.forEach((function(e){if(void 0===e.isIntersecting?0!==e.intersectionRatio:e.isIntersecting)$(e.target).addClass("item--active");else{if(1===$(e.target).closest(".side").length||1===$(e.target).closest("#articlePage").length||$(e.target).outerHeight()>768)return;$(e.target).removeClass("item--active")}}))})),$(".item").each((function(){window.imageIntersectionObserver.observe(this)})))},init:function(){Util.initPjax((function(){Skin._initAnimation()})),Skin._initAnimation(),this._initCommon($(".icon__up")),$(".header__nav a, .header__m a").each((function(){this.href===location.href&&(this.className="current")})).click((function(){$(".header__nav a, .header__m a").removeClass("current"),this.className="current",$(".header__m .module__list").hide()})),$(".header__logo").click((function(){$(".header__nav a, .header__m a").removeClass("current")}))},_initArticleCommon:function(){if($(window).width()>768){if(0===$(".article__toc li").length)return void $(".side").css({height:"auto",position:"initial"});$("#articlePage").width($(".main").width()-310),$(".side").css({right:($(window).width()-$(".main").width())/2,position:"fixed",overflow:"auto",height:$(window).height()-30,top:30}),$(window).scroll(),$(".side").scrollTop(0)}},initArticle:function(){this._initArticleCommon(),setTimeout((function(){0===$("#externalRelevantArticlesWrap li").length&&($("#externalRelevantArticlesWrap").next().remove(),$("#externalRelevantArticlesWrap").remove()),0===$("#relevantArticlesWrap li").length&&($("#relevantArticlesWrap").prev().remove(),$("#relevantArticlesWrap").remove()),0===$("#randomArticlesWrap li").length&&($("#randomArticlesWrap").prev().remove(),$("#randomArticlesWrap").remove())}),1e3)}};Skin.init();
\ No newline at end of file
var Skin={_initCommon:function(e){$(window).scroll((function(){$(window).scrollTop()>125?e.show():e.hide(),$(".side .article__toc").length>0&&$(window).width()>768&&($(window).scrollTop()>50?$(".side").css("position","fixed"):$(".side").css("position","initial"))}))},_initAnimation:function(){if(!("IntersectionObserver"in window))return $(".item").addClass("item--active"),!1;window.imageIntersectionObserver?(window.imageIntersectionObserver.disconnect(),$(".item").each((function(){window.imageIntersectionObserver.observe(this)}))):(window.imageIntersectionObserver=new IntersectionObserver((function(e){e.forEach((function(e){if(void 0===e.isIntersecting?0!==e.intersectionRatio:e.isIntersecting)$(e.target).addClass("item--active");else{if(1===$(e.target).closest(".side").length||1===$(e.target).closest("#articlePage").length||$(e.target).outerHeight()>768)return;$(e.target).removeClass("item--active")}}))})),$(".item").each((function(){window.imageIntersectionObserver.observe(this)})))},init:function(){Skin._initAnimation(),this._initCommon($(".icon__up")),$(".header__nav a, .header__m a").each((function(){this.href===location.href&&(this.className="current")})).click((function(){$(".header__nav a, .header__m a").removeClass("current"),this.className="current",$(".header__m .module__list").hide()})),$(".header__logo").click((function(){$(".header__nav a, .header__m a").removeClass("current")})),Label.staticSite||Util.initPjax((function(){Skin._initAnimation()}))},_initArticleCommon:function(){if($(window).width()>768){if(0===$(".article__toc li").length)return void $(".side").css({height:"auto",position:"initial"});$("#articlePage").width($(".main").width()-310),$(".side").css({right:($(window).width()-$(".main").width())/2,position:"fixed",overflow:"auto",height:$(window).height()-30,top:30}),$(window).scroll(),$(".side").scrollTop(0)}},initArticle:function(){this._initArticleCommon(),setTimeout((function(){0===$("#externalRelevantArticlesWrap li").length&&($("#externalRelevantArticlesWrap").next().remove(),$("#externalRelevantArticlesWrap").remove()),0===$("#relevantArticlesWrap li").length&&($("#relevantArticlesWrap").prev().remove(),$("#relevantArticlesWrap").remove()),0===$("#randomArticlesWrap li").length&&($("#randomArticlesWrap").prev().remove(),$("#randomArticlesWrap").remove())}),1e3)}};Skin.init();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment