This commit is contained in:
Van 2019-03-20 07:59:29 +08:00
parent d5c44707aa
commit 1605dceed8
No known key found for this signature in database
GPG Key ID: 7059B8783A78F16C
40 changed files with 161 additions and 142 deletions

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

File diff suppressed because one or more lines are too long

View File

@ -515,6 +515,10 @@ aside .b3-solo-list {
aside.has-toc > section:last-child {
margin-top: 20px;
}
.article__toc {
display: none;
}
/* end side */
/* start article list */

View File

@ -27,110 +27,106 @@
* @static
*/
var Skin = {
_initCommon: function ($goTop) {
var $banner = $('header .banner'),
$navbar = $('header .navbar');
_initCommon: function ($goTop) {
var $banner = $('header .banner'),
$navbar = $('header .navbar')
$(window).scroll(function () {
if ($(window).scrollTop() > 125) {
$goTop.show();
} else {
$goTop.hide();
}
$(window).scroll(function () {
if ($(window).scrollTop() > 125) {
$goTop.show()
} else {
$goTop.hide()
}
if ($(window).width() < 701) {
return false;
}
if ($(window).width() < 701) {
return false
}
if ($(window).scrollTop() > $banner.height()) {
$navbar.addClass('pin');
$('.main-wrap').parent().css('margin-top', '86px')
} else {
$navbar.removeClass('pin');
$('.main-wrap').parent().css('margin-top', '0')
}
});
},
init: function () {
this._initCommon($('.icon-up'));
if ($(window).scrollTop() > $banner.height()) {
$navbar.addClass('pin')
$('.main-wrap').parent().css('margin-top', '86px')
} else {
$navbar.removeClass('pin')
$('.main-wrap').parent().css('margin-top', '0')
}
})
},
init: function () {
this._initCommon($('.icon-up'))
$('.navbar nav a').each(function () {
if (this.href === location.href) {
this.className = 'current'
}
});
$('.navbar nav a').each(function () {
if (this.href === location.href) {
this.className = 'current'
}
})
$('.responsive .list a').each(function () {
if (this.href === location.href) {
$(this).parent().addClass('current');
}
});
$('.responsive .list a').each(function () {
if (this.href === location.href) {
$(this).parent().addClass('current')
}
})
$('.responsive .icon-list').click(function () {
$('.responsive .list').slideToggle();
});
},
_initArticleCommon: function (tocLabel, siteViewLabel) {
// TOC
if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) {
// add color to sidebar menu
$('aside').addClass('has-toc');
$('.responsive .icon-list').click(function () {
$('.responsive .list').slideToggle()
})
},
_initArticleCommon: function (tocLabel, siteViewLabel) {
// TOC
if ($('.article__toc').length > 0 && $(window).width() > 1000) {
$('.article__toc, .article__toc > ul').show()
// append toc to sidebar menu
var articleTocHTML = '<ul class="fn-clear"><li class="current" data-tab="toc">' + tocLabel
+ '</li><li data-tab="site">' + siteViewLabel + '</li></ul><section></section>';
$('aside').prepend(articleTocHTML);
var $sectionF = $('aside section:first').html($('.b3-solo-list')),
$sectionL = $('aside section:last');
$sectionF.height($(window).height() - 154).css({ 'overflow': 'auto', 'width': $('aside').width() + 'px'});
$sectionL.hide();
// 切换 tab
$('aside > 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).show();
});
} else {
$sectionF.animate({
"opacity": '0',
"top": '-50px'
}, 300, function () {
$sectionF.hide().css('top', '-50px');
$sectionL.animate({
"opacity": '1',
"top": '0'
}, 300).show();
}).hide();
}
$('aside > ul > li').removeClass('current');
$(this).addClass('current');
});
$(window).scroll(function () {
if ($(window).scrollTop() > 125) {
$('aside section:eq(0)').css({
position: "fixed",
top: "51px",
backgroundColor: "#fff"
})
} else {
$('aside section:eq(0)').css({
position: "inherit",
borderLeft: 0
})
}
});
var $sectionF = $('aside section:first').html($('.b3-solo-list')),
$sectionL = $('aside section:last')
$sectionF.height($(window).height() - 154).
css({'overflow': 'auto', 'width': $('aside').width() + 'px'})
$sectionL.hide()
// 切换 tab
$('aside > 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).show()
})
} else {
$sectionF.animate({
'opacity': '0',
'top': '-50px',
}, 300, function () {
$sectionF.hide().css('top', '-50px')
$sectionL.animate({
'opacity': '1',
'top': '0',
}, 300).show()
}).hide()
}
},
initArticle: function (tocLabel, siteViewLabel) {
this._initArticleCommon(tocLabel, siteViewLabel);
$('aside > ul > li').removeClass('current')
$(this).addClass('current')
})
$(window).scroll(function () {
if ($(window).scrollTop() > 125) {
$('aside section:eq(0)').css({
position: 'fixed',
top: '51px',
backgroundColor: '#fff',
})
} else {
$('aside section:eq(0)').css({
position: 'inherit',
borderLeft: 0,
})
}
})
}
};
Skin.init();
},
initArticle: function (tocLabel, siteViewLabel) {
this._initArticleCommon(tocLabel, siteViewLabel)
},
}
Skin.init()

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -17,7 +17,26 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<aside>
<aside<#if article?? && article.articleToC?size &gt; 0 > class="has-toc"</#if>>
<ul class="fn__clear fn__none">
<li class="current" data-tab="toc">
${tocLabel}
</li>
<li data-tab="site">
${siteViewLabel}
</li>
</ul>
<section>
<#if article??>
<ul class="article__toc">
<#list article.articleToC as item>
<li>
<a class="${item.className}" href="#${item.id}">${item.text}</a>
</li>
</#list>
</ul>
</#if>
</section>
<section>
<#if noticeBoard??>
<div class="ad vditor-reset">
@ -33,7 +52,7 @@
<a href="${servePath}/category/${category.categoryURI}"
aria-label="${category.categoryTagCnt} ${cntLabel}${tagsLabel}"
class="tag tooltipped tooltipped-n">
${category.categoryTitle}</a>
${category.categoryTitle}</a>
</#list>
</main>
</div>
@ -48,7 +67,7 @@
href="${servePath}/tags/${tag.tagTitle?url('UTF-8')}"
class="tag tooltipped tooltipped-n"
aria-label="${tag.tagPublishedRefCount} ${countLabel}${articleLabel}">
${tag.tagTitle}</a>
${tag.tagTitle}</a>
</#list>
</main>
</div>
@ -62,13 +81,13 @@
<img src="${adminUser.userAvatar}" aria-label="${adminUser.userName}"/>
<div class="fn-right">
<a href="${servePath}/archives.html">
${statistic.statisticPublishedBlogArticleCount}
${statistic.statisticPublishedBlogArticleCount}
<span class="ft-gray">${articleLabel}</span></a><br/>
<a href="${servePath}/dynamic.html">
${statistic.statisticPublishedBlogCommentCount}
${statistic.statisticPublishedBlogCommentCount}
<span class="ft-gray">${commentLabel}</span></a><br/>
${statistic.statisticBlogViewCount} <span class="ft-gray">${viewLabel}</span><br/>
${onlineVisitorCnt} <span class="ft-gray">${onlineVisitorLabel}</span>
${statistic.statisticBlogViewCount} <span class="ft-gray">${viewLabel}</span><br/>
${onlineVisitorCnt} <span class="ft-gray">${onlineVisitorLabel}</span>
</div>
</main>
</div>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<#include "macro-side.ftl">
<!DOCTYPE html>
<html>

View File

@ -20,7 +20,7 @@
<#include "macro-head.ftl">
<#include "macro-side.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>

View File

@ -19,7 +19,7 @@
-->
<#include "macro-head.ftl">
<#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl">
<#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html>
<html>
<head>