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-head.ftl">
<#include "macro-comments.ftl"> <#include "macro-comments.ftl">
<#include "../../common-template/macro-comment-script.ftl"> <#include "../../common-template/macro-comment_script.ftl">
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <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 { aside.has-toc > section:last-child {
margin-top: 20px; margin-top: 20px;
} }
.article__toc {
display: none;
}
/* end side */ /* end side */
/* start article list */ /* start article list */

View File

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

View File

@ -17,7 +17,26 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. 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> <section>
<#if noticeBoard??> <#if noticeBoard??>
<div class="ad vditor-reset"> <div class="ad vditor-reset">
@ -33,7 +52,7 @@
<a href="${servePath}/category/${category.categoryURI}" <a href="${servePath}/category/${category.categoryURI}"
aria-label="${category.categoryTagCnt} ${cntLabel}${tagsLabel}" aria-label="${category.categoryTagCnt} ${cntLabel}${tagsLabel}"
class="tag tooltipped tooltipped-n"> class="tag tooltipped tooltipped-n">
${category.categoryTitle}</a> ${category.categoryTitle}</a>
</#list> </#list>
</main> </main>
</div> </div>
@ -48,7 +67,7 @@
href="${servePath}/tags/${tag.tagTitle?url('UTF-8')}" href="${servePath}/tags/${tag.tagTitle?url('UTF-8')}"
class="tag tooltipped tooltipped-n" class="tag tooltipped tooltipped-n"
aria-label="${tag.tagPublishedRefCount} ${countLabel}${articleLabel}"> aria-label="${tag.tagPublishedRefCount} ${countLabel}${articleLabel}">
${tag.tagTitle}</a> ${tag.tagTitle}</a>
</#list> </#list>
</main> </main>
</div> </div>
@ -62,13 +81,13 @@
<img src="${adminUser.userAvatar}" aria-label="${adminUser.userName}"/> <img src="${adminUser.userAvatar}" aria-label="${adminUser.userName}"/>
<div class="fn-right"> <div class="fn-right">
<a href="${servePath}/archives.html"> <a href="${servePath}/archives.html">
${statistic.statisticPublishedBlogArticleCount} ${statistic.statisticPublishedBlogArticleCount}
<span class="ft-gray">${articleLabel}</span></a><br/> <span class="ft-gray">${articleLabel}</span></a><br/>
<a href="${servePath}/dynamic.html"> <a href="${servePath}/dynamic.html">
${statistic.statisticPublishedBlogCommentCount} ${statistic.statisticPublishedBlogCommentCount}
<span class="ft-gray">${commentLabel}</span></a><br/> <span class="ft-gray">${commentLabel}</span></a><br/>
${statistic.statisticBlogViewCount} <span class="ft-gray">${viewLabel}</span><br/> ${statistic.statisticBlogViewCount} <span class="ft-gray">${viewLabel}</span><br/>
${onlineVisitorCnt} <span class="ft-gray">${onlineVisitorLabel}</span> ${onlineVisitorCnt} <span class="ft-gray">${onlineVisitorLabel}</span>
</div> </div>
</main> </main>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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