fixed 12325

This commit is contained in:
Vanessa 2017-07-25 14:22:22 +08:00
parent 79ee0cb9c4
commit 679cfbe392
10 changed files with 287 additions and 226 deletions

View File

@ -363,10 +363,6 @@ pre code, pre tt {
-moz-osx-font-smoothing: grayscale;
}
.nav .current[class^="icon-"]:before {
color: #9EABB3;
}
.icon-sitemap:before {
content: "\e900";
}
@ -635,29 +631,28 @@ pre code, pre tt {
}
.menu-button {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
position: fixed;
box-sizing: border-box;
display: inline-block;
float: right;
height: 38px;
padding: 0 15px;
border-style: solid;
border-width: 1px;
opacity: 1;
text-align: center;
font-size: 12px;
text-transform: uppercase;
line-height: 35px;
white-space: nowrap;
line-height: 46px;
border-radius: 3px;
transition: all 0.5s ease;
position: absolute;
right: 20px;
top: 40px;
text-decoration: none;
font-family: 'Open Sans', "Microsoft Yahei", 'Helvetica';
z-index: 30;
overflow: hidden;
background-color: #111;
border: 1px solid #111;
color: #fff;
cursor: pointer;
}
.menu-button:hover {
@ -668,10 +663,6 @@ pre code, pre tt {
outline: 0;
}
.nav-closed .menu-button {
color: #fff;
border-color: rgba(255, 255, 255, 0.6);
}
.nav-closed .menu-button:hover {
color: #222;
}
@ -685,11 +676,15 @@ pre code, pre tt {
-ms-transform: translate3D(50px, 0, 0);
transform: translate3D(50px, 0, 0);
transition: all 0.3s ease;
right: 287px;
z-index: 10;
width: 46px;
border-radius: 3px 0 0 3px;
}
.nav-opened .menu-button .word {
opacity: 0;
transition: all 0.3s ease;
.menu-button .word {
float: right;
margin: -4px 0 0 10px;
}
.nav {
@ -740,13 +735,14 @@ pre code, pre tt {
}
.nav a {
color: #B8B8B8;
color: #989898;
text-decoration: none;
line-height: 1.4;
font-size: 1.4rem;
}
.nav a:hover {
.nav a:hover,
.nav a.current {
color: #FFF;
}
@ -775,12 +771,8 @@ pre code, pre tt {
white-space: nowrap;
}
.nav [class^="icon-"] {
color: #FFF;
}
.nav [class^="icon-"]:hover {
color: #B8B8B8;
.nav .b3-solo-list li.current a {
color: #fff;
}
body.nav-closed .nav {

File diff suppressed because one or more lines are too long

View File

@ -1,23 +1,20 @@
<header class="main-header"<#if !isIndex> style='height:30vh;'</#if>>
<div class="fn-clear">
<a class="menu-button icon-menu" href="#"><span class="word">Menu</span></a>
</div>
<div class="fn-vertical">
<div class="main-header-content fn-wrap">
<h1 class="page-title">
<a href="${servePath}">${blogTitle}</a>
<#if "" != noticeBoard>
<#if "" != noticeBoard>
<small class="page-description"> &nbsp; ${blogSubtitle}</small>
</#if>
</#if>
</h1>
<h2 class="page-description">
<#if "" != noticeBoard>
<#if "" != noticeBoard>
${noticeBoard}
<#else>
${blogSubtitle}
</#if>
${blogSubtitle}
</#if>
</h2>
</div>
</div>
<#if isIndex><a class="scroll-down icon-arrow-left" href="#content" data-offset="-45"></a></#if>
<#if isIndex><a class="scroll-down icon-arrow-left" href="#content" data-offset="-45"></a></#if>
</header>

View File

@ -25,93 +25,124 @@
* @static
*/
var Finding = {
/**
* @description 页面初始化
*/
init: function () {
Util.killIE();
this._initToc();
$(".scroll-down").click(function (event) {
event.preventDefault();
/**
* @description 页面初始化
*/
init: function () {
Util.killIE();
this._initToc();
$(".scroll-down").click(function (event) {
event.preventDefault();
var $this = $(this),
$htmlBody = $('html, body'),
offset = ($this.attr('data-offset')) ? $this.attr('data-offset') : false,
toMove = parseInt(offset);
var $this = $(this),
$htmlBody = $('html, body'),
offset = ($this.attr('data-offset')) ? $this.attr('data-offset') : false,
toMove = parseInt(offset);
$htmlBody.stop(true, false).animate({scrollTop: ($(this.hash).offset().top + toMove)}, 500);
});
$htmlBody.stop(true, false).animate({ scrollTop: ($(this.hash).offset().top + toMove) }, 500);
});
$('body').click(function (event) {
if ($(event.target).closest('.nav').length === 0
&& $("body").hasClass('nav-opened')
&& !$(event.target).hasClass('icon-gotop')) {
$("body").removeClass('nav-opened').addClass('nav-closed');
}
});
$('body').append('<a class="icon-gotop fn-none" href="javascript:Util.goTop()"></a>' +
'<span class="menu-button icon-menu"><span class="word">Menu</span></span>');
$(".menu-button").click(function (event) {
event.stopPropagation();
$("body").toggleClass("nav-opened nav-closed");
});
$(".menu-button").click(function (event) {
event.stopPropagation();
$("body").toggleClass("nav-opened nav-closed");
});
$('body').append('<a class="icon-gotop fn-none" href="javascript:Util.goTop()"></a>');
$(window).scroll(function () {
if ($(window).scrollTop() > $(window).height()) {
$(".icon-gotop").show();
} else {
$(".icon-gotop").hide();
}
});
},
/**
* 文章目录
* @returns {undefined}
*/
_initToc: function () {
if ($('.b3-solo-list').length === 0) {
$('.nav .icon-sitemap, .nav .icon-list').show();
return false;
}
$('.nav .icon-sitemap, .nav .icon-list').show();
$('.nav ul:first').hide();
$('.nav ul:first').after($('.b3-solo-list'));
$("body").toggleClass("nav-opened nav-closed");
},
tabNav: function (type) {
$('.nav .current').removeClass('current');
if (type === 'toc') {
$('.nav ul:first').hide();
$('.nav ul:last').show();
$('.icon-list').addClass('current');
} else {
$('.nav ul:first').show();
$('.nav ul:last').hide();
$('.icon-sitemap').addClass('current');
}
},
/**
* 分享
* @returns {undefined}
*/
share: function () {
$(".share span").click(function () {
var key = $(this).data("type");
var title = encodeURIComponent($("title").text()),
url = $(".post-title a").attr('href') ? $(".post-title a").attr('href') : location,
pic = $(".post-content img:eq(0)").attr("src");
var urls = {};
urls.tencent = "http://share.v.t.qq.com/index.php?c=share&a=index&title=" + title +
"&url=" + url + "&pic=" + pic;
urls.weibo = "http://v.t.sina.com.cn/share/share.php?title=" +
title + "&url=" + url + "&pic=" + pic;
urls.google = "https://plus.google.com/share?url=" + url;
urls.twitter = "https://twitter.com/intent/tweet?status=" + title + " " + url;
window.open(urls[key], "_blank", "top=100,left=200,width=648,height=618");
});
$(window).scroll(function () {
if ($(window).scrollTop() > $('.main-header').height()) {
$(".icon-gotop").show();
} else {
$(".icon-gotop").hide();
}
});
},
/**
* 文章目录
* @returns {undefined}
*/
_initToc: function () {
if ($('.b3-solo-list li').length === 0) {
$('.nav .icon-list').hide();
$('.nav .icon-sitemap').click();
return;
}
$('.nav ul:first').after($('.b3-solo-list'));
$("body").toggleClass("nav-opened nav-closed");
$('.nav .icon-list').show();
Finding.tabNav('toc')
var $articleTocs = $('.article-body [id^=b3_solo_h]'),
$articleToc = $('.b3-solo-list');
$(window).scroll(function (event) {
if ($('.b3-solo-list li').length === 0) {
return false;
}
// 界面各种图片加载会导致帖子目录定位
var toc = [];
$articleTocs.each(function (i) {
toc.push({
id: this.id,
offsetTop: this.offsetTop
});
});
// 当前目录样式
var scrollTop = $(window).scrollTop();
for (var i = 0, iMax = toc.length; i < iMax; i++) {
if (scrollTop < toc[i].offsetTop + 280) {
$articleToc.find('li').removeClass('current');
var index = i > 0 ? i - 1 : 0;
$articleToc.find('a[href="#' + toc[index].id + '"]').parent().addClass('current');
break;
}
}
if (scrollTop >= toc[toc.length - 1].offsetTop + 280) {
$articleToc.find('li').removeClass('current');
$articleToc.find('li:last').addClass('current');
}
});
$(window).scroll();
},
tabNav: function (type) {
$('.nav .current').removeClass('current');
if (type === 'toc') {
$('.nav ul:first').hide();
$('.nav ul:last').show();
$('.icon-list').addClass('current');
} else {
$('.nav ul:first').show();
$('.nav ul:last').hide();
$('.icon-sitemap').addClass('current');
}
},
/**
* 分享
* @returns {undefined}
*/
share: function () {
$(".share span").click(function () {
var key = $(this).data("type");
var title = encodeURIComponent($("title").text()),
url = $(".post-title a").attr('href') ? $(".post-title a").attr('href') : location,
pic = $(".post-content img:eq(0)").attr("src");
var urls = {};
urls.tencent = "http://share.v.t.qq.com/index.php?c=share&a=index&title=" + title +
"&url=" + url + "&pic=" + pic;
urls.weibo = "http://v.t.sina.com.cn/share/share.php?title=" +
title + "&url=" + url + "&pic=" + pic;
urls.google = "https://plus.google.com/share?url=" + url;
urls.twitter = "https://twitter.com/intent/tweet?status=" + title + " " + url;
window.open(urls[key], "_blank", "top=100,left=200,width=648,height=618");
});
}
};
Finding.init();

View File

@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Finding={init:function(){Util.killIE(),this._initToc(),$(".scroll-down").click(function(t){t.preventDefault();var o=$(this),n=$("html, body"),a=!!o.attr("data-offset")&&o.attr("data-offset"),i=parseInt(a);n.stop(!0,!1).animate({scrollTop:$(this.hash).offset().top+i},500)}),$("body").click(function(t){0===$(t.target).closest(".nav").length&&$("body").hasClass("nav-opened")&&!$(t.target).hasClass("icon-gotop")&&$("body").removeClass("nav-opened").addClass("nav-closed")}),$(".menu-button").click(function(t){t.stopPropagation(),$("body").toggleClass("nav-opened nav-closed")}),$("body").append('<a class="icon-gotop fn-none" href="javascript:Util.goTop()"></a>'),$(window).scroll(function(){$(window).scrollTop()>$(window).height()?$(".icon-gotop").show():$(".icon-gotop").hide()})},_initToc:function(){if(0===$(".b3-solo-list").length)return $(".nav .icon-sitemap, .nav .icon-list").show(),!1;$(".nav .icon-sitemap, .nav .icon-list").show(),$(".nav ul:first").hide(),$(".nav ul:first").after($(".b3-solo-list")),$("body").toggleClass("nav-opened nav-closed")},tabNav:function(t){$(".nav .current").removeClass("current"),"toc"===t?($(".nav ul:first").hide(),$(".nav ul:last").show(),$(".icon-list").addClass("current")):($(".nav ul:first").show(),$(".nav ul:last").hide(),$(".icon-sitemap").addClass("current"))},share:function(){$(".share span").click(function(){var t=$(this).data("type"),o=encodeURIComponent($("title").text()),n=$(".post-title a").attr("href")?$(".post-title a").attr("href"):location,a=$(".post-content img:eq(0)").attr("src"),i={};i.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+o+"&url="+n+"&pic="+a,i.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+n+"&pic="+a,i.google="https://plus.google.com/share?url="+n,i.twitter="https://twitter.com/intent/tweet?status="+o+" "+n,window.open(i[t],"_blank","top=100,left=200,width=648,height=618")})}};Finding.init();
var Finding={init:function(){Util.killIE(),this._initToc(),$(".scroll-down").click(function(t){t.preventDefault();var o=$(this),n=$("html, body"),i=!!o.attr("data-offset")&&o.attr("data-offset"),e=parseInt(i);n.stop(!0,!1).animate({scrollTop:$(this.hash).offset().top+e},500)}),$("body").append('<a class="icon-gotop fn-none" href="javascript:Util.goTop()"></a><span class="menu-button icon-menu"><span class="word">Menu</span></span>'),$(".menu-button").click(function(t){t.stopPropagation(),$("body").toggleClass("nav-opened nav-closed")}),$(window).scroll(function(){$(window).scrollTop()>$(".main-header").height()?$(".icon-gotop").show():$(".icon-gotop").hide()})},_initToc:function(){if(0===$(".b3-solo-list li").length)return $(".nav .icon-list").hide(),void $(".nav .icon-sitemap").click();$(".nav ul:first").after($(".b3-solo-list")),$("body").toggleClass("nav-opened nav-closed"),$(".nav .icon-list").show(),Finding.tabNav("toc");var t=$(".article-body [id^=b3_solo_h]"),o=$(".b3-solo-list");$(window).scroll(function(n){if(0===$(".b3-solo-list li").length)return!1;var i=[];t.each(function(t){i.push({id:this.id,offsetTop:this.offsetTop})});for(var e=$(window).scrollTop(),s=0,a=i.length;s<a;s++)if(e<i[s].offsetTop+280){o.find("li").removeClass("current");var l=s>0?s-1:0;o.find('a[href="#'+i[l].id+'"]').parent().addClass("current");break}e>=i[i.length-1].offsetTop+280&&(o.find("li").removeClass("current"),o.find("li:last").addClass("current"))}),$(window).scroll()},tabNav:function(t){$(".nav .current").removeClass("current"),"toc"===t?($(".nav ul:first").hide(),$(".nav ul:last").show(),$(".icon-list").addClass("current")):($(".nav ul:first").show(),$(".nav ul:last").hide(),$(".icon-sitemap").addClass("current"))},share:function(){$(".share span").click(function(){var t=$(this).data("type"),o=encodeURIComponent($("title").text()),n=$(".post-title a").attr("href")?$(".post-title a").attr("href"):location,i=$(".post-content img:eq(0)").attr("src"),e={};e.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+o+"&url="+n+"&pic="+i,e.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+n+"&pic="+i,e.google="https://plus.google.com/share?url="+n,e.twitter="https://twitter.com/intent/tweet?status="+o+" "+n,window.open(e[t],"_blank","top=100,left=200,width=648,height=618")})}};Finding.init();

View File

@ -1,9 +1,8 @@
<div class="fn-clear">
<span class="fn-right">
<a href="javascript:Finding.tabNav('link')" title="${permalinkLabel}" class="icon-sitemap"></a>
&nbsp;
<a href="javascript:Finding.tabNav('toc')" title="${tocLabel}" class="icon-list current"></a>
<a href="javascript:Finding.tabNav('link')" title="${permalinkLabel}" class="icon-sitemap current"></a>
&nbsp;
<a href="javascript:Finding.tabNav('toc')" title="${tocLabel}" class="icon-list fn-none"> &nbsp; </a>
<#if isLoggedIn>
<a href="${servePath}/admin-index.do#main" title="${adminLabel}" class="icon-setting"></a>
&nbsp;
@ -57,4 +56,4 @@
${onlineVisitor1Label}
${onlineVisitorCnt}
</span>
</div>
</div>

View File

@ -18,7 +18,7 @@
* skin next style
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.4.3.1, Feb 16, 2017
* @version 0.5.0.0, Jul 25, 2017
*/
/* start reset */
html {
@ -577,6 +577,10 @@ img {
line-height: 2;
}
.sidebar .b3-solo-list li.current a {
color: #87daff;
}
.sidebar section {
opacity: 0;
position: relative;

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@
* @fileoverview util and every page should be used.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.3.1.0, Feb 17, 2017
* @version 0.4.0.0, Jul 26, 2017
*/
/**
@ -25,114 +25,152 @@
* @static
*/
var NexT = {
init: function () {
$('.sidebar-toggle').click(function () {
var $sidebar = $('.sidebar');
if ($(this).hasClass('sidebar-active')) {
$(this).removeClass('sidebar-active');
init: function () {
$('.sidebar-toggle').click(function () {
var $sidebar = $('.sidebar');
if ($(this).hasClass('sidebar-active')) {
$(this).removeClass('sidebar-active');
$('body').animate({
'padding-right': 0
});
$sidebar.animate({
right: -320
});
$sidebar.find('section').css('opacity', 0);
} else {
$(this).addClass('sidebar-active');
$('body').animate({
'padding-right': 320
});
$sidebar.animate({
right: 0
}, function () {
$sidebar.find('section:first').animate({
'opacity': 1
});
});
}
$('body').animate({
'padding-right': 0
});
$('.site-nav-toggle').click(function () {
$('.site-nav').slideToggle();
$sidebar.animate({
right: -320
});
$sidebar.find('section').css('opacity', 0);
} else {
$(this).addClass('sidebar-active');
$('body').animate({
'padding-right': 320
});
$sidebar.animate({
right: 0
}, function () {
$sidebar.find('section:first').animate({
'opacity': 1
});
});
}
});
$(document).ready(function () {
setTimeout(function () {
// logo animate
$('.logo-wrap').css('opacity', 1);
$('.logo-line-before i').animate({
'left': '0'
}, function () {
$('.site-title').css('opacity', 1).animate({
'top': 0
}, function () {
$('.menu').css('opacity', 1).animate({
'margin-top': '15px'
});
$('.main').css('opacity', 1).animate({
'top': '0'
}, function () {
// 当有文章页面有目录时,回调不放这里,侧边栏就会一片空白
if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) {
$('.sidebar-toggle').click();
}
});
});
$('.site-nav-toggle').click(function () {
$('.site-nav').slideToggle();
});
});
$('.logo-line-after i').animate({
'right': '0'
});
}, 500);
$('body').on('click', '.article-body img', function () {
window.open(this.src);
$(document).ready(function () {
setTimeout(function () {
// logo animate
$('.logo-wrap').css('opacity', 1);
$('.logo-line-before i').animate({
'left': '0'
}, function () {
$('.site-title').css('opacity', 1).animate({
'top': 0
}, function () {
$('.menu').css('opacity', 1).animate({
'margin-top': '15px'
});
});
},
initArticle: function () {
if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) {
// add color to sidebar menu
$('.sidebar-toggle').addClass('has-toc');
// append toc to sidebar menu
var articleTocHTML = '<ul><li class="current" data-tab="toc">' + Label.tocLabel + '</li><li data-tab="site">' + Label.siteViewLabel + '</li></ul><section></section>';
$('.sidebar').prepend(articleTocHTML);
var $sectionF = $('.sidebar section:first').html($('.b3-solo-list')),
$sectionL = $('.sidebar section:last');
$sectionF.height($(window).height() - 90);
// 切换 tab
$('.sidebar > ul > li').click(function () {
if ($(this).data('tab') === 'toc') {
$sectionL.animate({
"opacity": '0',
"top": '-50px'
}, 300, function () {
$sectionF.show().css('top', '-50px');
$sectionF.animate({
"opacity": '1',
"top": '0'
}, 300);
});
} else {
$sectionF.animate({
"opacity": '0',
"top": '-50px'
}, 300, function () {
$sectionF.hide().css('top', '-50px');
$sectionL.animate({
"opacity": '1',
"top": '0'
}, 300);
});
}
$('.sidebar > ul > li').removeClass('current');
$(this).addClass('current');
$('.main').css('opacity', 1).animate({
'top': '0'
}, function () {
// 当有文章页面有目录时,回调不放这里,侧边栏就会一片空白
if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) {
$('.sidebar-toggle').click();
}
});
});
});
$('.logo-line-after i').animate({
'right': '0'
});
}, 500);
$('body').on('click', '.article-body img', function () {
window.open(this.src);
});
});
},
initArticle: function () {
if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) {
// add color to sidebar menu
$('.sidebar-toggle').addClass('has-toc');
// append toc to sidebar menu
var articleTocHTML = '<ul><li class="current" data-tab="toc">' + Label.tocLabel + '</li><li data-tab="site">' + Label.siteViewLabel + '</li></ul><section></section>';
$('.sidebar').prepend(articleTocHTML);
var $sectionF = $('.sidebar section:first').html($('.b3-solo-list')),
$sectionL = $('.sidebar section:last');
$sectionF.height($(window).height() - 90);
// 切换 tab
$('.sidebar > ul > li').click(function () {
if ($(this).data('tab') === 'toc') {
$sectionL.animate({
"opacity": '0',
"top": '-50px'
}, 300, function () {
$sectionF.show().css('top', '-50px');
$sectionF.animate({
"opacity": '1',
"top": '0'
}, 300);
});
} else {
$sectionF.animate({
"opacity": '0',
"top": '-50px'
}, 300, function () {
$sectionF.hide().css('top', '-50px');
$sectionL.animate({
"opacity": '1',
"top": '0'
}, 300);
});
}
$('.sidebar > ul > li').removeClass('current');
$(this).addClass('current');
});
this.initToc();
}
},
initToc: function () {
var $articleTocs = $('.article-body [id^=b3_solo_h]'),
$articleToc = $('.b3-solo-list');
$(window).scroll(function (event) {
if ($('.b3-solo-list li').length === 0) {
return false;
}
// 界面各种图片加载会导致帖子目录定位
var toc = [];
$articleTocs.each(function (i) {
toc.push({
id: this.id,
offsetTop: this.offsetTop
});
});
// 当前目录样式
var scrollTop = $(window).scrollTop();
for (var i = 0, iMax = toc.length; i < iMax; i++) {
if (scrollTop < toc[i].offsetTop + 200) {
$articleToc.find('li').removeClass('current');
var index = i > 0 ? i - 1 : 0;
$articleToc.find('a[href="#' + toc[index].id + '"]').parent().addClass('current');
break;
}
}
if (scrollTop >= toc[toc.length - 1].offsetTop + 200) {
$articleToc.find('li').removeClass('current');
$articleToc.find('li:last').addClass('current');
}
});
$(window).scroll();
}
};
NexT.init();

2
next/js/next.min.js vendored
View File

@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var NexT={init:function(){$(".sidebar-toggle").click(function(){var i=$(".sidebar");$(this).hasClass("sidebar-active")?($(this).removeClass("sidebar-active"),$("body").animate({"padding-right":0}),i.animate({right:-320}),i.find("section").css("opacity",0)):($(this).addClass("sidebar-active"),$("body").animate({"padding-right":320}),i.animate({right:0},function(){i.find("section:first").animate({opacity:1})}))}),$(".site-nav-toggle").click(function(){$(".site-nav").slideToggle()}),$(document).ready(function(){setTimeout(function(){$(".logo-wrap").css("opacity",1),$(".logo-line-before i").animate({left:"0"},function(){$(".site-title").css("opacity",1).animate({top:0},function(){$(".menu").css("opacity",1).animate({"margin-top":"15px"}),$(".main").css("opacity",1).animate({top:"0"},function(){$(".b3-solo-list li").length>0&&$(window).width()>1e3&&$(".sidebar-toggle").click()})})}),$(".logo-line-after i").animate({right:"0"})},500),$("body").on("click",".article-body img",function(){window.open(this.src)})})},initArticle:function(){if($(".b3-solo-list li").length>0&&$(window).width()>1e3){$(".sidebar-toggle").addClass("has-toc");var i='<ul><li class="current" data-tab="toc">'+Label.tocLabel+'</li><li data-tab="site">'+Label.siteViewLabel+"</li></ul><section></section>";$(".sidebar").prepend(i);var t=$(".sidebar section:first").html($(".b3-solo-list")),a=$(".sidebar section:last");t.height($(window).height()-90),$(".sidebar > ul > li").click(function(){"toc"===$(this).data("tab")?a.animate({opacity:"0",top:"-50px"},300,function(){t.show().css("top","-50px"),t.animate({opacity:"1",top:"0"},300)}):t.animate({opacity:"0",top:"-50px"},300,function(){t.hide().css("top","-50px"),a.animate({opacity:"1",top:"0"},300)}),$(".sidebar > ul > li").removeClass("current"),$(this).addClass("current")})}}};NexT.init();
var NexT={init:function(){$(".sidebar-toggle").click(function(){var i=$(".sidebar");$(this).hasClass("sidebar-active")?($(this).removeClass("sidebar-active"),$("body").animate({"padding-right":0}),i.animate({right:-320}),i.find("section").css("opacity",0)):($(this).addClass("sidebar-active"),$("body").animate({"padding-right":320}),i.animate({right:0},function(){i.find("section:first").animate({opacity:1})}))}),$(".site-nav-toggle").click(function(){$(".site-nav").slideToggle()}),$(document).ready(function(){setTimeout(function(){$(".logo-wrap").css("opacity",1),$(".logo-line-before i").animate({left:"0"},function(){$(".site-title").css("opacity",1).animate({top:0},function(){$(".menu").css("opacity",1).animate({"margin-top":"15px"}),$(".main").css("opacity",1).animate({top:"0"},function(){$(".b3-solo-list li").length>0&&$(window).width()>1e3&&$(".sidebar-toggle").click()})})}),$(".logo-line-after i").animate({right:"0"})},500),$("body").on("click",".article-body img",function(){window.open(this.src)})})},initArticle:function(){if($(".b3-solo-list li").length>0&&$(window).width()>1e3){$(".sidebar-toggle").addClass("has-toc");var i='<ul><li class="current" data-tab="toc">'+Label.tocLabel+'</li><li data-tab="site">'+Label.siteViewLabel+"</li></ul><section></section>";$(".sidebar").prepend(i);var t=$(".sidebar section:first").html($(".b3-solo-list")),a=$(".sidebar section:last");t.height($(window).height()-90),$(".sidebar > ul > li").click(function(){"toc"===$(this).data("tab")?a.animate({opacity:"0",top:"-50px"},300,function(){t.show().css("top","-50px"),t.animate({opacity:"1",top:"0"},300)}):t.animate({opacity:"0",top:"-50px"},300,function(){t.hide().css("top","-50px"),a.animate({opacity:"1",top:"0"},300)}),$(".sidebar > ul > li").removeClass("current"),$(this).addClass("current")}),this.initToc()}},initToc:function(){var i=$(".article-body [id^=b3_solo_h]"),t=$(".b3-solo-list");$(window).scroll(function(a){if(0===$(".b3-solo-list li").length)return!1;var o=[];i.each(function(i){o.push({id:this.id,offsetTop:this.offsetTop})});for(var e=$(window).scrollTop(),n=0,s=o.length;n<s;n++)if(e<o[n].offsetTop+200){t.find("li").removeClass("current");var l=n>0?n-1:0;t.find('a[href="#'+o[l].id+'"]').parent().addClass("current");break}e>=o[o.length-1].offsetTop+200&&(t.find("li").removeClass("current"),t.find("li:last").addClass("current"))}),$(window).scroll()}};NexT.init();