Compare commits

...

3 Commits
1.0.6 ... 1.0.7

24 changed files with 197 additions and 164 deletions

View File

@@ -121,7 +121,6 @@ cdn:
css:
fontawesome: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css
# fontawesomeV5: https://use.fontawesome.com/releases/v5.8.1/css/all.css
googlefont: https://fonts.googleapis.com/css?family=Titillium+Web
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css
js:
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
@@ -241,7 +240,7 @@ valine:
verify: false # valine verify code (true/false)
pageSize: 10 # comment list page size
avatar: monsterid # gravatar style https://valine.js.org/#/avatar
lang: en # i18n: zh-cn/en/tw
lang: en # i18n: zh-cn/en
placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints )
guest_info: nick,mail,link #valine comment header inf
@@ -329,7 +328,7 @@ related_post:
# canvas_ribbon
# See: https://github.com/hustcc/ribbon.js
canvas_ribbon:
enable: false
enable: true
size: 150
alpha: 0.6
zIndex: -1
@@ -337,7 +336,7 @@ canvas_ribbon:
canvas_ribbon_piao:
enable: true
enable: false
# 避免重複網址分散seo
@@ -353,11 +352,18 @@ Open_Graph_meta: true
readmode:
enable: true
#全局字體
font:
enable: false
font-family: Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB,"Microsoft JhengHei", "MicrMicrosoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
code-font: consolas, Menlo, "PingFang SC", "Microsoft JhengHei","Microsoft YaHei", monospace, Helvetica Neue For Number
#網站名字字體
#左上角網站名字 主頁居中網站名字
blog_title_font:
#字體鏈接
font_link: https://fonts.googleapis.com/css?family=Titillium+Web
font-family: Titillium Web, PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
#水平分隔綫
hr:
@@ -387,13 +393,13 @@ aside:
translate:
enable: true
# 默認按鈕顯示文字
default:
default:
#网站默认语言1: 繁體中文, 2: 简体中文
defaultEncoding: 1
defaultEncoding: 2
#延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0
translateDelay: 0
#博客网址
cookieDomain: "https://jerryc.me/"
cookieDomain: "https://xxx/"
#當文字是簡體時,按鈕顯示的文字
msgToTraditionalChinese: "繁"
#當文字是繁體時,按鈕顯示的文字
@@ -406,4 +412,9 @@ fireworks:
#百度推送
baidu_push:
enable: false
enable: false
#https://instant.page/
#prefetch預加載
instantpage:
enable: true

View File

@@ -51,7 +51,6 @@ pagination:
next: Next Post
comment: Comment
relatedPosts_headline: Recommend
aside:
articles: Articles

View File

@@ -51,7 +51,6 @@ pagination:
next: Next Post
comment: Comment
relatedPosts_headline: Recommend
aside:
articles: Articles

View File

@@ -52,7 +52,6 @@ pagination:
next: 下一篇
comment: 评论
relatedPosts_headline: 相关推荐
aside:
articles: 文章

View File

@@ -53,7 +53,6 @@ pagination:
next: 下一篇
comment: 評論
relatedPosts_headline: 相關推薦
aside:
articles: 文章

View File

@@ -8,4 +8,4 @@ block content
+articleSort(page.posts)
include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug
include includes/aside.pug

View File

@@ -6,7 +6,7 @@
each item in i.link_list
li.md-links-item
a(href=item.link title=item.name target="_blank")
img.lozad(data-src=item.avatar alt=item.name onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
img.lozad(data-src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
div(class="md-links-title")= item.name
<br/>
div(class="md-links-des")=item.descr

View File

@@ -87,5 +87,6 @@ if is_home()
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
script(async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js")
script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module")
if theme.instantpage.enable
script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module")

View File

@@ -3,7 +3,6 @@ if theme.disqus.enable
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./disqus.pug
else if theme.laibili && theme.laibili.enable
@@ -11,7 +10,6 @@ else if theme.laibili && theme.laibili.enable
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./laibili.pug
else if theme.gitment && theme.gitment.enable
@@ -19,7 +17,6 @@ else if theme.gitment && theme.gitment.enable
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./gitment.pug
else if theme.gitalk && theme.gitalk.enable
@@ -27,7 +24,6 @@ else if theme.gitalk && theme.gitalk.enable
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./gitalk.pug
else if theme.valine && theme.valine.enable
@@ -35,6 +31,5 @@ else if theme.valine && theme.valine.enable
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./valine.pug

View File

@@ -113,3 +113,6 @@ if (is_archive() && preload_archive_img)
link(rel="preload" href=url_for(preload_archive_img) as="image" )
else if (!is_post() && preload_img)
link(rel="preload" href=url_for(preload_img) as="image" )
if theme.blog_title_font.font_link
link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link))

View File

@@ -7,12 +7,15 @@
- if (is_year()) pageTitle += ': ' + page.year
- var pageTitle_saved //- 暫時存儲pageTitle
- var pageTitle_no_include_blog_name //- 存儲pageTitle 不帶 " | "meta用
- var home_subtitle_true //有subtitle
//- home時顯示config.title (JerryC),其他顯示 pageTitle。meta用
- is_home() ? pageTitle_no_include_blog_name = config.title : pageTitle_no_include_blog_name = pageTitle
//- 暫時存儲pageTitle
- pageTitle ? pageTitle_saved = pageTitle + ' | ' + config.title : pageTitle_saved = config.title
//- 是否有 config.subtitle 是各自显示
- config.subtitle ? home_subtitle_true = ' - ' + config.subtitle : home_subtitle_true = ''
//- home時pageTitle顯示 JerryC - subtitle其他顯示 pageTitle | JerryC
- is_home() ? pageTitle = config.title + ' - ' + config.subtitle : pageTitle = pageTitle_saved
- is_home() ? pageTitle = config.title + home_subtitle_true : pageTitle = pageTitle_saved
- var pageDescription = page.description || page.title || config.description || ''
- var pageKeywords = (config.keywords || []).join(',')

View File

@@ -14,21 +14,19 @@ else
if(page.prev)
if(page.next)
.prev-post.pull-left
- var pagination_cover = page.prev.cover || theme.default_cover
- var pagination_cover = page.prev.cover || random_cover()
a(href=url_for(page.prev.path))
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
.label=_p('pagination.prev')
.prev_info
//- i.fa.fa-chevron-left
span=page.prev.title
else
.prev-post.pull-full
- var pagination_cover = page.prev.cover || theme.default_cover
- var pagination_cover = page.prev.cover || random_cover()
a(href=url_for(page.prev.path))
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.prev')
.prev_info
//- i.fa.fa-chevron-left
span=page.prev.title
@@ -36,21 +34,18 @@ else
if(page.next)
if(page.prev)
.next-post.pull-right
- var pagination_cover = page.next.cover || theme.default_cover
- var pagination_cover = page.next.cover || random_cover()
a(href=url_for(page.next.path))
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.next')
.next_info
span=page.next.title
//- i.fa.fa-chevron-right
else
.next-post.pull-full
- var pagination_cover = page.next.cover || theme.default_cover
- var pagination_cover = page.next.cover || random_cover()
a(href=url_for(page.next.path))
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.next')
.next_info
span=page.next.title
//- i.fa.fa-chevron-right
span=page.next.title

View File

@@ -3,25 +3,25 @@ each article , index in page.posts.data
- var link = article.link || article.path
if index%2 == 0
.post_cover.is_left
a(href=url_for(link))
a(href=url_for(link) title=article.title || _p('no_title'))
- var post_cover = article.cover
- var default_post_cover = random_cover()
if (post_cover)
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
.post_cover.is_right
a(href=url_for(link))
a(href=url_for(link) title=article.title || _p('no_title'))
- var post_cover = article.cover
- var default_post_cover = random_cover()
if (post_cover)
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.recent-post-info
a.article-title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
a.article-title(href=url_for(link) title= article.title || _p('no_title'))= article.title || _p('no_title')
if (article.top)
span.article-meta
i.fa.fa-thumb-tack.article-meta__icon.sticky

View File

@@ -1,6 +0,0 @@
.relatedPosts
.relatedPosts_headline
i.fa.fa-thumbs-up(aria-hidden="true")
span=' ' + _p('relatedPosts_headline')
.relatedPosts_list!= related_posts(page,site.posts)
.clear_both

View File

@@ -1,22 +1,23 @@
.card_widget.card-categories
.card-content
.item_headline
i.fa.fa-folder-open(aria-hidden="true")
span= _p('aside.card_categories')
ul.aside_category_item
mixin displayCategories(parent = undefined)
- site.categories.find({ parent }).sort("name").each(function(category) {
- var childCount = site.categories.find({ parent: category._id }).count();
li.aside_category_list
a.aside_category_list_link(href=url_for(category.path))
span.aside_category_list_name= category.name
span.aside_category_list_length= category.length
if childCount > 0
ul.aside_category_item.child
+displayCategories(category._id)
- })
if site.categories.length
.card_widget.card-categories
.card-content
.item_headline
i.fa.fa-folder-open(aria-hidden="true")
span= _p('aside.card_categories')
ul.aside_category_item
mixin displayCategories(parent = undefined)
- site.categories.find({ parent }).sort("name").each(function(category) {
- var childCount = site.categories.find({ parent: category._id }).count();
li.aside_category_list
a.aside_category_list_link(href=url_for(category.path))
span.aside_category_list_name= category.name
span.aside_category_list_length= category.length
if childCount > 0
ul.aside_category_item.child
+displayCategories(category._id)
- })
+displayCategories()
+displayCategories()

View File

@@ -1,6 +1,7 @@
.card_widget.card-tags
.card-content
.item_headline
i.fa.fa-tags(aria-hidden="true")
span= _p('aside.card_tags')
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 24, amount: 200, color: true, start_color: '#999', end_color: '#000'})
if site.tags.length
.card_widget.card-tags
.card-content
.item_headline
i.fa.fa-tags(aria-hidden="true")
span= _p('aside.card_tags')
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 24, amount: 200, color: true, start_color: '#999', end_color: '#000'})

View File

@@ -5,4 +5,4 @@ block content
include includes/recent-posts.pug
include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug
include includes/aside.pug

View File

@@ -6,7 +6,7 @@ block content
.tag-cloud__title= _p('page.tag')
| -
span.tag-cloud__amount= site.tags.length
.tag-cloud-tags!= tagcloud({min_font: 20, max_font: 43, amount: 200, color: true, start_color: '#A4D8FA', end_color: '#0790E8'})
.tag-cloud-tags!= tags(site.tags)
if page.comments !== false
include includes/comments/index.pug
#aside_content.aside_content

View File

@@ -71,6 +71,6 @@ block content
include includes/pagination.pug
if theme.related_post && theme.related_post.enable
include includes/related-posts.pug
!= related_posts(page,site.posts)
if page.comments !== false
include includes/comments/index.pug

View File

@@ -1,38 +1,59 @@
hexo.extend.helper.register('related_posts', function(currentPost, allPosts){
hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
var relatedPosts = [];
currentPost.tags.forEach(function (tag) {
allPosts.forEach(function (post) {
if (isTagRelated(tag.name, post.tags)) {
var relatedPost = {
title: post.title,
path: post.path,
cover: post.cover,
weight: 1
};
var index = findItem(relatedPosts, 'path', post.path);
if (index != -1) {
relatedPosts[index].weight += 1;
} else{
if (currentPost.path != post.path) {
relatedPosts.push(relatedPost);
};
};
if (isTagRelated(tag.name, post.tags)) {
var relatedPost = {
title: post.title,
path: post.path,
cover: post.cover,
weight: 1
};
var index = findItem(relatedPosts, 'path', post.path);
if (index != -1) {
relatedPosts[index].weight += 1;
} else {
if (currentPost.path != post.path) {
relatedPosts.push(relatedPost);
};
});
};
};
});
});
if (relatedPosts.length == 0) {return ''};
if (relatedPosts.length == 0) { return '' };
var result = "";
var limit_num = hexo.theme.config.related_post.limit || 6
var lang = hexo.theme.config.rootConfig.language;
var headline_lang;
if (lang === 'zh-CN') {
headline_lang = '相关推荐';
} else if ( lang === 'zh-TW') {
headline_lang = '相關推薦';
} else {
headline_lang = 'Recommend';
}
relatedPosts = relatedPosts.sort(compare('weight'));
if (relatedPosts.length > 0) {
result += '<div class="relatedPosts">'
result += '<div class="relatedPosts_headline"><i class="fa fa-fw fa-thumbs-up" aria-hidden="true"></i><span>' + headline_lang + '</span></div>'
result += '<div class="relatedPosts_list">'
for (var i = 0; i < Math.min(relatedPosts.length, limit_num); i++) {
var cover = relatedPosts[i].cover|| random_cover()
result += '<div class="relatedPosts_item"><a href="' + hexo.theme.config.rootConfig.root + relatedPosts[i].path + '" title="' + relatedPosts[i].title +'">';
var cover = relatedPosts[i].cover || random_cover()
result += '<div class="relatedPosts_item"><a href="' + hexo.theme.config.rootConfig.root + relatedPosts[i].path + '" title="' + relatedPosts[i].title + '">';
result += '<img class="relatedPosts_cover lozad" data-src="' + cover + '">';
result += '<div class="relatedPosts_title">' + relatedPosts[i].title + '</div>';
result += '</a></div>'
};
result += '</a></div>'
};
result += '</div><div class="clear_both"></div></div>'
return result;
}
});
hexo.extend.helper.register('echo', function(path){
return path;

16
scripts/tags.js Normal file
View File

@@ -0,0 +1,16 @@
hexo.extend.helper.register('tags', function (site_tags) {
var result = "";
site_tags.sort('path').each(function (tags) {
var fontSize = Math.floor(Math.random() * 15 + 15) + "px"; //15 ~ 30
var color =
"rgb(" +
Math.floor(Math.random() * 201) +
", " +
Math.floor(Math.random() * 201) +
", " +
Math.floor(Math.random() * 201) +
")"; // 0,0,0 -> 200,200,200
result += '<a href="' + hexo.theme.config.rootConfig.root + tags.path + '" style="font-size:' + fontSize + ';color:' + color + '">' + tags.name + '</a>'
})
return result;
})

View File

@@ -206,7 +206,7 @@ table
#site-name,
#aside_content .author-info__name,
#aside_content .author-info__description
font-family: 'Titillium Web',Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
font-family: $site-name-font
@@ -350,4 +350,9 @@ table
.fireworks
position: fixed
z-index: -1
pointer-events: none
pointer-events: none
//
img[src=""],img:not([src])
opacity: 0

View File

@@ -9,6 +9,7 @@ $theme-hr-color = #A4D8FA
$theme-read-mode-bg-color = #FAF9DE
$font-family= Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
$code-font = consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace, Helvetica Neue For Number
$site-name-font = "Titillium Web", Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
//hr icon
$hr-icon = '\f0c4'
$hr-icon-top = -10px
@@ -27,6 +28,10 @@ if hexo-config("font") && hexo-config("font.enable")
$font-family = convert(hexo-config("font.font-family")) || 'Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif'
$code-font = convert(hexo-config("font.code-font")) || 'consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace, Helvetica Neue For Number'
if hexo-config("blog_title_font.font-family")
$site-name-font = convert(hexo-config("blog_title_font.font-family")) || '"Titillium Web",Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif'
if hexo-config("hr") && hexo-config("hr.enable")
$hr-icon = hexo-config("hr.icon") || '\f0c4'
$hr-icon-top = convert(hexo-config("hr.icon-top")) || -10px
@@ -38,6 +43,7 @@ $font-color = #1F2D3D
$rem = 20px
$font-family = $font-family
$code-font = $code-font
$site-name-font = $site-name-font
$text-line-height = 2
$sm = 768px
$bg = 1024px

View File

@@ -94,37 +94,6 @@ $(function () {
});
//--------------------------------------------------------------------------------------------------------
// tags 隨機大小 顔色
var list = document.querySelectorAll(".tag-cloud .tag-cloud-tags a");
if ($(window).width() > 768) {
Array.prototype.forEach.call(list, (item, index) => {
item.style.fontSize = Math.floor(Math.random() * 20 + 15) + "px"; //15 ~ 35
item.style.color =
"rgb(" +
Math.floor(Math.random() * 201) +
", " +
Math.floor(Math.random() * 201) +
", " +
Math.floor(Math.random() * 201) +
")"; // 0,0,0 -> 200,200,200
});
} else {
Array.prototype.forEach.call(list, (item, index) => {
item.style.fontSize = Math.floor(Math.random() * 13 + 15) + "px"; //15 ~ 28
item.style.color =
"rgb(" +
Math.floor(Math.random() * 201) +
", " +
Math.floor(Math.random() * 201) +
", " +
Math.floor(Math.random() * 201) +
")"; // 0,0,0 -> 200,200,200
});
}
//--------------------------------------------------------------------------------------------------------
// bookmark
$.fancyConfirm = function (opts) {
@@ -316,6 +285,7 @@ $(function () {
$(".toggle-menu *").css({ 'background-color': '#3b3a3a', 'text-shadow': 'none' });
$('body').addClass("is_hidden");
$('.menus').addClass("menu_open");
fixbg_menu();
} else {
$(".toggle-menu").removeClass("close").addClass("open");
$("#page-header #site-name,#page-header .search").css({ 'color': '', 'text-shadow': '' });
@@ -329,41 +299,44 @@ $(function () {
}
})
const fixScroll = (scrollEl) => {
let startY
scrollEl.addEventListener('touchstart', function (event) {
// 如果多於1根手指點擊屏幕,則不處理
if (event.targetTouches.length > 1) {
return
}
// 儲存手指的初始位置
startY = event.targetTouches[0].clientY
}, false)
scrollEl.addEventListener('touchmove', function (event) {
if (event.targetTouches.length > 1) {
return
}
// 判斷手指滑動方向, y大於0時向下滑動, 小於0時向上滑動
const y = event.targetTouches[0].clientY - startY
// 如果到頂時繼續向下拉
if (scrollEl.scrollTop <= 0 && y > 0) {
// 重置滾動距離為最小值
scrollEl.scrollTop = 0
// 阻止滾動
event.preventDefault()
}
// 如果到底時繼續上滑
const maxScrollTop = scrollEl.scrollHeight - scrollEl.clientHeight
if (maxScrollTop - scrollEl.scrollTop <= 0 && y < 0) {
scrollEl.scrollTop = maxScrollTop
event.preventDefault()
}
}, {
passive: false
})
function fixbg_menu() {
const fixScroll = (scrollEl) => {
let startY
scrollEl.addEventListener('touchstart', function (event) {
// 如果多於1根手指點擊屏幕,則不處理
if (event.targetTouches.length > 1) {
return
}
// 儲存手指的初始位置
startY = event.targetTouches[0].clientY
}, false)
scrollEl.addEventListener('touchmove', function (event) {
if (event.targetTouches.length > 1) {
return
}
// 判斷手指滑動方向, y大於0時向下滑動, 小於0時向上滑動
const y = event.targetTouches[0].clientY - startY
// 如果到頂時繼續向下拉
if (scrollEl.scrollTop <= 0 && y > 0) {
// 重置滾動距離為最小值
scrollEl.scrollTop = 0
// 阻止滾動
event.preventDefault()
}
// 如果到底時繼續上滑
const maxScrollTop = scrollEl.scrollHeight - scrollEl.clientHeight
if (maxScrollTop - scrollEl.scrollTop <= 0 && y < 0) {
scrollEl.scrollTop = maxScrollTop
event.preventDefault()
}
}, {
passive: false
})
}
const scrollEl = document.querySelector(".menus");
fixScroll(scrollEl)
}
const scrollEl = document.querySelector(".menus");
fixScroll(scrollEl)
$(window).on('resize', function (e) {
@@ -373,7 +346,7 @@ $(function () {
$("#page-header #site-name,#page-header .search").css({ 'color': '', 'text-shadow': '' });
$(".toggle-menu *").css({ 'background-color': '', 'text-shadow': '' });
$('body').removeClass("is_hidden");
$('.menus').removeClass("menu_open");
$('.menus').removeClass("menu_open");
}
}
})
@@ -546,6 +519,18 @@ $(function () {
// Hide their respective list of subsections
.find('.toc-child').hide()
}
if ($('.toc-link').hasClass('active')){
var active_position = $(".active").offset().top;
var sidebar_scrolltop = $("#sidebar").scrollTop();
if (active_position > (top + $(window).height() - 50)) {
$("#sidebar").scrollTop(sidebar_scrolltop + 100);
} else if (active_position < top + 50)
{
$("#sidebar").scrollTop(sidebar_scrolltop - 100);
}
}
}
//代碼框雙擊全屏