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

@ -29,108 +29,104 @@
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 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')), var $sectionF = $('aside section:first').html($('.b3-solo-list')),
$sectionL = $('aside section:last'); $sectionL = $('aside section:last')
$sectionF.height($(window).height() - 154).css({ 'overflow': 'auto', 'width': $('aside').width() + 'px'}); $sectionF.height($(window).height() - 154).
$sectionL.hide(); css({'overflow': 'auto', 'width': $('aside').width() + 'px'})
$sectionL.hide()
// 切换 tab // 切换 tab
$('aside > ul > li').click(function () { $('aside > ul > li').click(function () {
if ($(this).data('tab') === 'toc') { if ($(this).data('tab') === 'toc') {
$sectionL.animate({ $sectionL.animate({
"opacity": '0', 'opacity': '0',
"top": '-50px' 'top': '-50px',
}, 300, function () { }, 300, function () {
$sectionF.show().css('top', '-50px'); $sectionF.show().css('top', '-50px')
$sectionF.animate({ $sectionF.animate({
"opacity": '1', 'opacity': '1',
"top": '0' 'top': '0',
}, 300).show(); }, 300).show()
}); })
} else { } else {
$sectionF.animate({ $sectionF.animate({
"opacity": '0', 'opacity': '0',
"top": '-50px' 'top': '-50px',
}, 300, function () { }, 300, function () {
$sectionF.hide().css('top', '-50px'); $sectionF.hide().css('top', '-50px')
$sectionL.animate({ $sectionL.animate({
"opacity": '1', 'opacity': '1',
"top": '0' 'top': '0',
}, 300).show(); }, 300).show()
}).hide(); }).hide()
} }
$('aside > ul > li').removeClass('current'); $('aside > ul > li').removeClass('current')
$(this).addClass('current'); $(this).addClass('current')
}); })
$(window).scroll(function () { $(window).scroll(function () {
if ($(window).scrollTop() > 125) { if ($(window).scrollTop() > 125) {
$('aside section:eq(0)').css({ $('aside section:eq(0)').css({
position: "fixed", position: 'fixed',
top: "51px", top: '51px',
backgroundColor: "#fff" backgroundColor: '#fff',
}) })
} else { } else {
$('aside section:eq(0)').css({ $('aside section:eq(0)').css({
position: "inherit", position: 'inherit',
borderLeft: 0 borderLeft: 0,
}) })
} }
}); })
} }
}, },
initArticle: function (tocLabel, siteViewLabel) { initArticle: function (tocLabel, siteViewLabel) {
this._initArticleCommon(tocLabel, siteViewLabel); this._initArticleCommon(tocLabel, siteViewLabel)
},
} }
}; Skin.init()
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">

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>