mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
🔖 2.2.5發佈
更新内容請看 https://github.com/jerryc127/hexo-theme-butterfly/releases
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# hexo-theme-butterfly
|
# hexo-theme-butterfly
|
||||||
|
|
||||||
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.0-blue"/></a>
|
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.5-blue"/></a>
|
||||||
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
||||||
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
||||||
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# hexo-theme-butterfly
|
# hexo-theme-butterfly
|
||||||
|
|
||||||
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.0-blue"/></a>
|
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.5-blue"/></a>
|
||||||
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
||||||
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
||||||
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
||||||
|
|||||||
13
_config.yml
13
_config.yml
@@ -49,12 +49,12 @@ copy:
|
|||||||
|
|
||||||
# social settings
|
# social settings
|
||||||
# formal:
|
# formal:
|
||||||
# icon: link
|
# icon: link || the description
|
||||||
# ---------------
|
# ---------------
|
||||||
social:
|
social:
|
||||||
fa fa-github: https://github.com/jerryc127
|
fa fa-github: https://github.com/jerryc127 || Github
|
||||||
fa fa-envelope: mailto:xxxxxxxx@gmail.com
|
fa fa-envelope: mailto:xxxxxxx@gmail.com || Email
|
||||||
fa fa-rss: /atom.xml
|
fa fa-rss: /atom.xml || RSS
|
||||||
|
|
||||||
#### search ####
|
#### search ####
|
||||||
# Algolia search
|
# Algolia search
|
||||||
@@ -170,6 +170,7 @@ post_meta:
|
|||||||
|
|
||||||
# Please see doc for more details: https://docs.jerryc.me/config.html#字數統計
|
# Please see doc for more details: https://docs.jerryc.me/config.html#字數統計
|
||||||
wordcount:
|
wordcount:
|
||||||
|
enable: false
|
||||||
post_wordcount: true
|
post_wordcount: true
|
||||||
min2read: true
|
min2read: true
|
||||||
total_wordcount: true
|
total_wordcount: true
|
||||||
@@ -356,6 +357,10 @@ related_post:
|
|||||||
limit: 6 # 顯示推薦文章數目
|
limit: 6 # 顯示推薦文章數目
|
||||||
date_type: created # or created or updated 文章日期顯示創建日或者更新日
|
date_type: created # or created or updated 文章日期顯示創建日或者更新日
|
||||||
|
|
||||||
|
# figcaption
|
||||||
|
# 圖片描述文字
|
||||||
|
photofigcaption: false
|
||||||
|
|
||||||
#### 美化/效果 ####
|
#### 美化/效果 ####
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ post:
|
|||||||
created: 發表於
|
created: 發表於
|
||||||
updated: 更新於
|
updated: 更新於
|
||||||
wordcount: 字數總計
|
wordcount: 字數總計
|
||||||
min2read: "閲讀時長: %s 分鐘"
|
min2read: "閱讀時長: %s 分鐘"
|
||||||
page_pv: 閲讀量
|
page_pv: 閱讀量
|
||||||
comments: 評論數
|
comments: 評論數
|
||||||
copyright:
|
copyright:
|
||||||
author: 文章作者
|
author: 文章作者
|
||||||
@@ -78,7 +78,7 @@ bookmark:
|
|||||||
title: 添加書籤
|
title: 添加書籤
|
||||||
|
|
||||||
rightside:
|
rightside:
|
||||||
readmode_title: 閲讀模式
|
readmode_title: 閱讀模式
|
||||||
font_plus_title: 放大字體
|
font_plus_title: 放大字體
|
||||||
font_minus_title: 縮小字體
|
font_minus_title: 縮小字體
|
||||||
translate_title: 簡繁轉換
|
translate_title: 簡繁轉換
|
||||||
|
|||||||
@@ -1,87 +1,23 @@
|
|||||||
|
- var top_img = theme.error_404.background || theme.default_top_img
|
||||||
|
- var bg_img = `background-image: url(${top_img})`
|
||||||
|
|
||||||
doctype html
|
doctype html
|
||||||
html(lang=config.language data-theme=theme.display_mode)
|
html(lang=config.language data-theme=theme.display_mode)
|
||||||
head
|
head
|
||||||
- var pageTitle = _p('error_title')
|
include includes/head.pug
|
||||||
- var tabTitle = pageTitle + ' | ' + config.title
|
|
||||||
- var pageDescription = page.description || page.title || config.description
|
|
||||||
- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
|
||||||
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
|
||||||
- var pageCopyright = config.copyright || config.author
|
|
||||||
- var without_html = url.replace('index.html', '')
|
|
||||||
- var top_img = theme.error_404.background || theme.default_top_img
|
|
||||||
- var bg_img = `background-image: url(${top_img})`
|
|
||||||
|
|
||||||
|
|
||||||
meta(charset='UTF-8')
|
|
||||||
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
|
||||||
meta(name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5")
|
|
||||||
title= tabTitle
|
|
||||||
meta(name="description" content=pageDescription)
|
|
||||||
if pageKeywords
|
|
||||||
meta(name="keywords" content=pageKeywords)
|
|
||||||
meta(name="author" content=pageAuthor)
|
|
||||||
meta(name="copyright" content=pageCopyright)
|
|
||||||
meta(name ="format-detection" content="telephone=no")
|
|
||||||
!=favicon_tag(theme.favicon || config.favicon)
|
|
||||||
//- 預解析
|
|
||||||
include includes/head/dns_prefetch.pug
|
|
||||||
//- 網站驗證
|
|
||||||
include includes/head/site_verification.pug
|
|
||||||
//- Open_Graph
|
|
||||||
include includes/head/Open_Graph.pug
|
|
||||||
//- PWA
|
|
||||||
if (theme.pwa && theme.pwa.enable)
|
|
||||||
include includes/head/pwa
|
|
||||||
|
|
||||||
script(src=url_for(theme.CDN.js_cookies))
|
|
||||||
|
|
||||||
if theme.darkmode.enable
|
|
||||||
include includes/head/darkmode.pug
|
|
||||||
|
|
||||||
each item in theme.CDN_USE.css
|
|
||||||
link(rel='stylesheet', href=url_for(item))
|
|
||||||
|
|
||||||
if theme.fontawesome_v5 && theme.fontawesome_v5.enable
|
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5))
|
|
||||||
else
|
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v4))
|
|
||||||
|
|
||||||
if (theme.snackbar && theme.snackbar.enable)
|
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css))
|
|
||||||
|
|
||||||
if theme.canonical
|
|
||||||
link(rel="canonical" href=without_html)
|
|
||||||
|
|
||||||
if theme.algolia_search.enable
|
|
||||||
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.algolia_search_css))
|
|
||||||
script(src=url_for(theme.CDN.algolia_search) defer)
|
|
||||||
|
|
||||||
//- google_adsense
|
|
||||||
include includes/head/google_adsense.pug
|
|
||||||
|
|
||||||
//- analytics
|
|
||||||
include includes/head/analytics.pug
|
|
||||||
|
|
||||||
if theme.blog_title_font.font_link
|
|
||||||
link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link))
|
|
||||||
|
|
||||||
include includes/head/config.pug
|
|
||||||
include includes/head/config_site.pug
|
|
||||||
|
|
||||||
body
|
body
|
||||||
if theme.fireworks && theme.fireworks.enable
|
if theme.fireworks && theme.fireworks.enable
|
||||||
canvas.fireworks
|
canvas.fireworks
|
||||||
|
|
||||||
|
include includes/mobile-sidebar/index.pug
|
||||||
|
|
||||||
nav#nav.error-no-found(style=bg_img)
|
nav#nav.error-no-found(style=bg_img)
|
||||||
include includes/header/header.pug
|
include includes/header/header.pug
|
||||||
#error_info.is-center
|
#error_info.is-center
|
||||||
h1#error_title= '404'
|
h1#error_title= '404'
|
||||||
#error_subtitle= theme.error_404.subtitle
|
#error_subtitle= theme.error_404.subtitle
|
||||||
include includes/mobile-sidebar/index.pug
|
|
||||||
include includes/rightside.pug
|
include includes/rightside.pug
|
||||||
|
include includes/search/index.pug
|
||||||
each item in theme.CDN_USE.js
|
each item in theme.CDN_USE.js
|
||||||
script(src=url_for(item))
|
script(src=url_for(item))
|
||||||
include includes/additional-js.pug
|
include includes/additional-js.pug
|
||||||
include includes/search/index.pug
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,4 +62,4 @@ if theme.mermaid.enable
|
|||||||
include ./math/mermaid.pug
|
include ./math/mermaid.pug
|
||||||
|
|
||||||
if is_home()
|
if is_home()
|
||||||
include index-js.pug
|
include ./head/subtitle.pug
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
- var pageTitle = page.title || config.title || ''
|
- var pageTitle
|
||||||
- if (is_archive()) pageTitle = _p('page.archives')
|
- if (is_archive()) pageTitle = _p('page.archives')
|
||||||
- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
|
- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
|
||||||
- if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
|
- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
|
||||||
- if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
|
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
|
||||||
- if (is_year()) pageTitle += ': ' + page.year
|
- else if (is_year()) pageTitle += ': ' + page.year
|
||||||
|
- else if (is_current('/404.html', [strict])) pageTitle = _p('error_title')
|
||||||
|
- else pageTitle = page.title || config.title || ''
|
||||||
|
|
||||||
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
||||||
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
|
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
|
||||||
- pageTitle ? '' : pageTitle = config.title || ''
|
|
||||||
|
|
||||||
- var pageDescription = page.description || page.title || config.description
|
- var pageDescription = page.description || page.title || config.description
|
||||||
- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
- var pageKeywords
|
||||||
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
||||||
|
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
||||||
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
||||||
- var pageCopyright = config.copyright || config.author
|
- var pageCopyright = config.copyright || config.author
|
||||||
- var without_html = url.replace('index.html', '')
|
- var without_html = url.replace('index.html', '')
|
||||||
@@ -97,4 +100,6 @@ if theme.blog_title_font.font_link
|
|||||||
|
|
||||||
//- global config
|
//- global config
|
||||||
!=partial('includes/head/config', {}, {cache:theme.fragment_cache})
|
!=partial('includes/head/config', {}, {cache:theme.fragment_cache})
|
||||||
|
|
||||||
include ./head/config_site.pug
|
include ./head/config_site.pug
|
||||||
|
include ./head/noscript.pug
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
copyright = JSON.stringify({
|
copyright = JSON.stringify({
|
||||||
languages: {
|
languages: {
|
||||||
author: _p("copy_copyright.author") + ': ' + config.author,
|
author: _p("copy_copyright.author") + ': ' + config.author,
|
||||||
link: _p("copy_copyright.link") + ': ' + without_html,
|
link: _p("copy_copyright.link") + ': ',
|
||||||
source: _p("copy_copyright.source") + ': ' + config.title,
|
source: _p("copy_copyright.source") + ': ' + config.title,
|
||||||
info: _p("copy_copyright.info")
|
info: _p("copy_copyright.info")
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,6 @@
|
|||||||
if (theme.snackbar && theme.snackbar.enable) {
|
if (theme.snackbar && theme.snackbar.enable) {
|
||||||
Snackbar = JSON.stringify({
|
Snackbar = JSON.stringify({
|
||||||
bookmark: {
|
bookmark: {
|
||||||
title: _p("Snackbar.bookmark.title"),
|
|
||||||
message_prev: _p("Snackbar.bookmark.message_prev"),
|
message_prev: _p("Snackbar.bookmark.message_prev"),
|
||||||
message_next: _p("Snackbar.bookmark.message_next")
|
message_next: _p("Snackbar.bookmark.message_next")
|
||||||
},
|
},
|
||||||
@@ -76,16 +75,6 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var highlightCopy = theme.highlight_copy
|
|
||||||
var highlightLang = theme.highlight_lang
|
|
||||||
var highlightShrink = theme.highlight_shrink
|
|
||||||
var runtime = theme.runtimeshow.enable
|
|
||||||
var fancybox = theme.fancybox.enable
|
|
||||||
var medium_zoom = theme.medium_zoom.enable
|
|
||||||
var baiduPush = theme.baidu_push && theme.baidu_push.enable
|
|
||||||
var isFontAwesomeV5 = theme.fontawesome_v5 && theme.fontawesome_v5.enable
|
|
||||||
|
|
||||||
|
|
||||||
script.
|
script.
|
||||||
var GLOBAL_CONFIG = {
|
var GLOBAL_CONFIG = {
|
||||||
root: '!{config.root}',
|
root: '!{config.root}',
|
||||||
@@ -98,22 +87,22 @@ script.
|
|||||||
noSupport: '!{_p("copy.noSupport")}'
|
noSupport: '!{_p("copy.noSupport")}'
|
||||||
},
|
},
|
||||||
bookmark: {
|
bookmark: {
|
||||||
title: '!{_p("Snackbar.bookmark.title")}',
|
|
||||||
message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
|
message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
|
||||||
message_next: '!{_p("Snackbar.bookmark.message_next")}'
|
message_next: '!{_p("Snackbar.bookmark.message_next")}'
|
||||||
},
|
},
|
||||||
runtime_unit: '!{_p("runtime_unit")}',
|
runtime_unit: '!{_p("runtime_unit")}',
|
||||||
runtime: !{runtime},
|
runtime: !{theme.runtimeshow.enable},
|
||||||
copyright: !{copyright},
|
copyright: !{copyright},
|
||||||
ClickShowText: !{ClickShowText},
|
ClickShowText: !{ClickShowText},
|
||||||
medium_zoom: !{medium_zoom},
|
medium_zoom: !{theme.medium_zoom.enable},
|
||||||
fancybox: !{fancybox},
|
fancybox: !{theme.fancybox.enable},
|
||||||
Snackbar: !{Snackbar},
|
Snackbar: !{Snackbar},
|
||||||
baiduPush: !{baiduPush},
|
baiduPush: !{theme.baidu_push && theme.baidu_push.enable},
|
||||||
highlightCopy: !{highlightCopy},
|
highlightCopy: !{theme.highlight_copy},
|
||||||
highlightLang: !{highlightLang},
|
highlightLang: !{theme.highlight_lang},
|
||||||
highlightShrink: !{highlightShrink},
|
highlightShrink: '!{theme.highlight_shrink}',
|
||||||
isFontAwesomeV5: !{isFontAwesomeV5}
|
isFontAwesomeV5: !{theme.fontawesome_v5 && theme.fontawesome_v5.enable},
|
||||||
|
isPhotoFigcaption: !{theme.photofigcaption}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
script.
|
script.
|
||||||
var GLOBAL_CONFIG_SITE = {
|
var GLOBAL_CONFIG_SITE = {
|
||||||
isPost: !{is_post()},
|
isPost: !{is_post()},
|
||||||
isHome: !{is_home()}
|
isHome: !{is_home()},
|
||||||
}
|
isSidebar: !{is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
script.
|
script.
|
||||||
const autoChangeMode = '#{theme.darkmode.autoChangeMode}'
|
var autoChangeMode = '#{theme.darkmode.autoChangeMode}'
|
||||||
var t = Cookies.get("theme")
|
var t = Cookies.get("theme")
|
||||||
if (autoChangeMode == '1'){
|
if (autoChangeMode == '1'){
|
||||||
const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
|
var isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
const isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches
|
var isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches
|
||||||
const isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches
|
var isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches
|
||||||
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
|
var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
|
||||||
|
|
||||||
if (t === undefined){
|
if (t === undefined){
|
||||||
if (isLightMode) activateLightMode()
|
if (isLightMode) activateLightMode()
|
||||||
else if (isDarkMode) activateDarkMode()
|
else if (isDarkMode) activateDarkMode()
|
||||||
else if (isNotSpecified || hasNoSupport){
|
else if (isNotSpecified || hasNoSupport){
|
||||||
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
|
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
|
||||||
now = new Date();
|
var now = new Date()
|
||||||
hour = now.getHours();
|
var hour = now.getHours()
|
||||||
isNight = hour < 6 || hour >= 18
|
var isNight = hour < 6 || hour >= 18
|
||||||
isNight ? activateDarkMode() : activateLightMode()
|
isNight ? activateDarkMode() : activateLightMode()
|
||||||
}
|
}
|
||||||
} else if (t == 'light') activateLightMode()
|
} else if (t == 'light') activateLightMode()
|
||||||
|
|||||||
9
layout/includes/head/noscript.pug
Normal file
9
layout/includes/head/noscript.pug
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
noscript.
|
||||||
|
<style>
|
||||||
|
#page-header {
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
.justified-gallery img{
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
if theme.subtitle.enable
|
if theme.subtitle.enable
|
||||||
- let source = theme.subtitle.source
|
- var source = theme.subtitle.source
|
||||||
- let subtitleEffect = theme.subtitle.effect
|
- var subtitleEffect = theme.subtitle.effect
|
||||||
|
|
||||||
if subtitleEffect
|
if subtitleEffect
|
||||||
script(src=url_for(theme.CDN.typed))
|
script(src=url_for(theme.CDN.typed))
|
||||||
|
|
||||||
if source == '1'
|
if source == '1'
|
||||||
script.
|
script.
|
||||||
let subtitleEffect = !{subtitleEffect}
|
var subtitleEffect = !{subtitleEffect}
|
||||||
fetch('https://api.ooopn.com/ciba/api.php',)
|
fetch('https://api.ooopn.com/ciba/api.php',)
|
||||||
.then(function (res){
|
.then(function (res){
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
if (subtitleEffect){
|
if (subtitleEffect){
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||||
let both = sub.unshift(data['ciba-en'],data.ciba)
|
var both = sub.unshift(data['ciba-en'],data.ciba)
|
||||||
let typed = new Typed("#subtitle", {
|
var typed = new Typed("#subtitle", {
|
||||||
strings: sub,
|
strings: sub,
|
||||||
startDelay: 300,
|
startDelay: 300,
|
||||||
typeSpeed: 150,
|
typeSpeed: 150,
|
||||||
@@ -33,17 +33,17 @@ if theme.subtitle.enable
|
|||||||
|
|
||||||
else if source == '2'
|
else if source == '2'
|
||||||
script.
|
script.
|
||||||
let subtitleEffect = !{subtitleEffect}
|
var subtitleEffect = !{subtitleEffect}
|
||||||
fetch('https://v1.hitokoto.cn')
|
fetch('https://v1.hitokoto.cn')
|
||||||
.then(function (res){
|
.then(function (res){
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
if (subtitleEffect){
|
if (subtitleEffect){
|
||||||
let from = '出自 ' + data.from
|
var from = '出自 ' + data.from
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||||
let both = sub.unshift(data.hitokoto,from)
|
var both = sub.unshift(data.hitokoto,from)
|
||||||
let typed = new Typed("#subtitle", {
|
var typed = new Typed("#subtitle", {
|
||||||
strings: sub,
|
strings: sub,
|
||||||
startDelay: 300,
|
startDelay: 300,
|
||||||
typeSpeed: 150,
|
typeSpeed: 150,
|
||||||
@@ -61,13 +61,13 @@ if theme.subtitle.enable
|
|||||||
else if source == "3"
|
else if source == "3"
|
||||||
script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js")
|
script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js")
|
||||||
script.
|
script.
|
||||||
let subtitleEffect = !{subtitleEffect}
|
var subtitleEffect = !{subtitleEffect}
|
||||||
let con = str[0];
|
var con = str[0];
|
||||||
if (subtitleEffect){
|
if (subtitleEffect){
|
||||||
let from = "出自 " + str[1];
|
var from = "出自 " + str[1];
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||||
let both = sub.unshift(con,from)
|
var both = sub.unshift(con,from)
|
||||||
let typed = new Typed("#subtitle", {
|
var typed = new Typed("#subtitle", {
|
||||||
strings: sub,
|
strings: sub,
|
||||||
startDelay: 300,
|
startDelay: 300,
|
||||||
typeSpeed: 150,
|
typeSpeed: 150,
|
||||||
@@ -81,13 +81,13 @@ if theme.subtitle.enable
|
|||||||
else if source == '4'
|
else if source == '4'
|
||||||
script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8")
|
script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8")
|
||||||
script.
|
script.
|
||||||
let subtitleEffect = !{subtitleEffect}
|
var subtitleEffect = !{subtitleEffect}
|
||||||
jinrishici.load(function(result) {
|
jinrishici.load(function(result) {
|
||||||
if (subtitleEffect){
|
if (subtitleEffect){
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||||
let content = result.data.content;
|
var content = result.data.content;
|
||||||
let both = sub.unshift(content)
|
var both = sub.unshift(content)
|
||||||
let typed = new Typed("#subtitle", {
|
var typed = new Typed("#subtitle", {
|
||||||
strings: sub,
|
strings: sub,
|
||||||
startDelay: 300,
|
startDelay: 300,
|
||||||
typeSpeed: 150,
|
typeSpeed: 150,
|
||||||
@@ -102,9 +102,9 @@ if theme.subtitle.enable
|
|||||||
else
|
else
|
||||||
- var subtitle = theme.subtitle.sub[0]
|
- var subtitle = theme.subtitle.sub[0]
|
||||||
script.
|
script.
|
||||||
let subtitleEffect = !{subtitleEffect}
|
var subtitleEffect = !{subtitleEffect}
|
||||||
if (subtitleEffect){
|
if (subtitleEffect){
|
||||||
let typed = new Typed("#subtitle", {
|
var typed = new Typed("#subtitle", {
|
||||||
strings: '!{theme.subtitle.sub}'.split(","),
|
strings: '!{theme.subtitle.sub}'.split(","),
|
||||||
startDelay: 300,
|
startDelay: 300,
|
||||||
typeSpeed: 150,
|
typeSpeed: 150,
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
#page-header
|
#page-header
|
||||||
span#blog_name.pull_left
|
span#blog_name.pull_left
|
||||||
a#site-name.blog_title(href=url_for('/')) #[=config.title]
|
a#site-name.blog_title(href=url_for('/')) #[=config.title]
|
||||||
span.toggle-menu.pull_right.close
|
|
||||||
a.site-page
|
|
||||||
i.fa.fa-bars.fa-fw(aria-hidden="true")
|
|
||||||
span.pull_right.menus
|
span.pull_right.menus
|
||||||
|
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
|
||||||
|
#search_button
|
||||||
|
a.site-page.social-icon.search
|
||||||
|
i.fa.fa-search.fa-fw
|
||||||
|
span=' '+_p('search')
|
||||||
.menus_items
|
.menus_items
|
||||||
include ./menu_item.pug
|
include ./menu_item.pug
|
||||||
|
|
||||||
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
|
span.toggle-menu.close
|
||||||
span#search_button.pull_right
|
a.site-page
|
||||||
a.site-page.social-icon.search
|
i.fa.fa-bars.fa-fw(aria-hidden="true")
|
||||||
i.fa.fa-search.fa-fw
|
|
||||||
span=' '+_p('search')
|
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ if theme.douban
|
|||||||
span#subtitle
|
span#subtitle
|
||||||
if(theme.social)
|
if(theme.social)
|
||||||
#site_social_icons
|
#site_social_icons
|
||||||
each url, icon in theme.social
|
!=partial('includes/header/social', {}, {cache:theme.fragment_cache})
|
||||||
a.social-icon(href=url target="_blank")
|
|
||||||
i(class=icon aria-hidden="true")
|
|
||||||
#scroll_down
|
#scroll_down
|
||||||
i.fa.fa-angle-down.scroll-down-effects
|
i.fa.fa-angle-down.scroll-down-effects
|
||||||
else if is_post()
|
else if is_post()
|
||||||
|
|||||||
@@ -7,17 +7,19 @@
|
|||||||
if (theme.post_meta.post.date_type)
|
if (theme.post_meta.post.date_type)
|
||||||
if (theme.post_meta.post.date_type === 'both')
|
if (theme.post_meta.post.date_type === 'both')
|
||||||
time.post-meta__date
|
time.post-meta__date
|
||||||
i.fa.fa-calendar(aria-hidden="true")
|
span.post-meta__date-created(title= _p('post.created')+' '+full_date(page.date))
|
||||||
=' '+_p('post.created')+' '+date(page.date, config.date_format)
|
i.fa.fa-calendar(aria-hidden="true")
|
||||||
|
=' '+_p('post.created')+' '+date(page.date, config.date_format)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
i.fa.fa-history(aria-hidden="true")
|
span.post-meta__date-updated(title= _p('post.updated')+' '+full_date(page.updated))
|
||||||
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
|
i.fa.fa-history(aria-hidden="true")
|
||||||
|
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
|
||||||
else
|
else
|
||||||
- var data_type_update = theme.post_meta.post.date_type === 'updated'
|
- var data_type_update = theme.post_meta.post.date_type === 'updated'
|
||||||
- var date_type = data_type_update ? 'updated' : 'date'
|
- var date_type = data_type_update ? 'updated' : 'date'
|
||||||
- var date_icon = data_type_update ? 'fa-history' :'fa-calendar'
|
- var date_icon = data_type_update ? 'fa-history' :'fa-calendar'
|
||||||
- var data_info = data_type_update ? _p('post.updated') : _p('post.created')
|
- var data_info = data_type_update ? _p('post.updated') : _p('post.created')
|
||||||
time.post-meta__date
|
time.post-meta__date(title=data_info + ' ' + full_date(page[date_type]))
|
||||||
i.fa(class=date_icon aria-hidden="true")
|
i.fa(class=date_icon aria-hidden="true")
|
||||||
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
|
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
|
||||||
|
|
||||||
@@ -33,7 +35,7 @@
|
|||||||
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
|
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
|
||||||
|
|
||||||
.meta-secondline
|
.meta-secondline
|
||||||
- let postWordcount = theme.wordcount.post_wordcount || theme.wordcount.min2read
|
- let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read)
|
||||||
if (postWordcount)
|
if (postWordcount)
|
||||||
span.post-meta-wordcount
|
span.post-meta-wordcount
|
||||||
if theme.wordcount.post_wordcount
|
if theme.wordcount.post_wordcount
|
||||||
|
|||||||
4
layout/includes/header/social.pug
Normal file
4
layout/includes/header/social.pug
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
each url, icon in theme.social
|
||||||
|
a.social-icon(href=trim(url.split('||')[0]) target="_blank"
|
||||||
|
title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1]))
|
||||||
|
i(class=icon aria-hidden="true")
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
|
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
|
||||||
- var autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : ''
|
|
||||||
|
|
||||||
doctype html
|
doctype html
|
||||||
html(lang=config.language data-theme=theme.display_mode)
|
html(lang=config.language data-theme=theme.display_mode)
|
||||||
@@ -8,10 +7,11 @@ html(lang=config.language data-theme=theme.display_mode)
|
|||||||
body
|
body
|
||||||
if theme.fireworks && theme.fireworks.enable
|
if theme.fireworks && theme.fireworks.enable
|
||||||
canvas.fireworks
|
canvas.fireworks
|
||||||
|
|
||||||
!=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache})
|
!=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache})
|
||||||
if (is_post() && page.toc != false && theme.toc.enable)
|
|
||||||
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar)
|
include ./sidebar.pug
|
||||||
include ./sidebar.pug
|
|
||||||
#body-wrap
|
#body-wrap
|
||||||
if theme.background
|
if theme.background
|
||||||
- var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color'
|
- var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color'
|
||||||
@@ -36,10 +36,14 @@ html(lang=config.language data-theme=theme.display_mode)
|
|||||||
- var is_bg = theme.footer_bg == false ? 'color' : 'photo'
|
- var is_bg = theme.footer_bg == false ? 'color' : 'photo'
|
||||||
footer#footer(style=footer_bg data-type=is_bg)
|
footer#footer(style=footer_bg data-type=is_bg)
|
||||||
!=partial('includes/footer', {}, {cache:theme.fragment_cache})
|
!=partial('includes/footer', {}, {cache:theme.fragment_cache})
|
||||||
|
|
||||||
include ./rightside.pug
|
include ./rightside.pug
|
||||||
|
|
||||||
!=partial('includes/search/index', {}, {cache:theme.fragment_cache})
|
!=partial('includes/search/index', {}, {cache:theme.fragment_cache})
|
||||||
|
|
||||||
each item in theme.CDN_USE.js
|
each item in theme.CDN_USE.js
|
||||||
script(src=url_for(item))
|
script(src=url_for(item))
|
||||||
|
|
||||||
include ./additional-js.pug
|
include ./additional-js.pug
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,15 +19,19 @@ mixin UI_NEW(posts)
|
|||||||
if (theme.post_meta.page.date_type)
|
if (theme.post_meta.page.date_type)
|
||||||
if (theme.post_meta.page.date_type === 'both')
|
if (theme.post_meta.page.date_type === 'both')
|
||||||
time.post-meta__date
|
time.post-meta__date
|
||||||
i.fa.fa-calendar(aria-hidden="true")
|
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
|
||||||
=date(article.date, config.date_format)
|
i.fa.fa-calendar(aria-hidden="true")
|
||||||
|
=date(article.date, config.date_format)
|
||||||
span.article-meta__separator |
|
span.article-meta__separator |
|
||||||
i.fa.fa-history(aria-hidden="true")
|
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
|
||||||
=date(article.updated, config.date_format)
|
i.fa.fa-history(aria-hidden="true")
|
||||||
|
=date(article.updated, config.date_format)
|
||||||
else
|
else
|
||||||
- var date_type = theme.post_meta.page.date_type === 'updated' ? 'updated' : 'date'
|
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
|
||||||
- var date_icon = theme.post_meta.page.date_type === 'updated' ? 'fa-history' :'fa-calendar'
|
- var date_type = data_type_updated ? 'updated' : 'date'
|
||||||
time.post-meta__date
|
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
|
||||||
|
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
|
||||||
|
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
|
||||||
i.fa(class=date_icon aria-hidden="true")
|
i.fa(class=date_icon aria-hidden="true")
|
||||||
=date(article[date_type], config.date_format)
|
=date(article[date_type], config.date_format)
|
||||||
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ mixin articleSort(posts)
|
|||||||
.article-sort-post
|
.article-sort-post
|
||||||
a.article-sort-item__post(href=url_for(article.path))
|
a.article-sort-item__post(href=url_for(article.path))
|
||||||
i.fa.fa-clock-o(aria-hidden="true")
|
i.fa.fa-clock-o(aria-hidden="true")
|
||||||
time.article-sort-item__time= date(article.date)
|
time.article-sort-item__time(title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format)
|
||||||
.article-sort-item__title= article.title || 'No Title'
|
.article-sort-item__title= article.title || 'No Title'
|
||||||
- })
|
- })
|
||||||
@@ -23,15 +23,19 @@ each article , index in page.posts.data
|
|||||||
if (theme.post_meta.page.date_type)
|
if (theme.post_meta.page.date_type)
|
||||||
if (theme.post_meta.page.date_type === 'both')
|
if (theme.post_meta.page.date_type === 'both')
|
||||||
time.post-meta__date
|
time.post-meta__date
|
||||||
i.fa.fa-calendar(aria-hidden="true")
|
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
|
||||||
=date(article.date, config.date_format)
|
i.fa.fa-calendar(aria-hidden="true")
|
||||||
|
=date(article.date, config.date_format)
|
||||||
span.article-meta__separator |
|
span.article-meta__separator |
|
||||||
i.fa.fa-history(aria-hidden="true")
|
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
|
||||||
=date(article.updated, config.date_format)
|
i.fa.fa-history(aria-hidden="true")
|
||||||
|
=date(article.updated, config.date_format)
|
||||||
else
|
else
|
||||||
- var date_type = theme.post_meta.page.date_type === 'updated' ? 'updated' : 'date'
|
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
|
||||||
- var date_icon = theme.post_meta.page.date_type === 'updated' ? 'fa-history' :'fa-calendar'
|
- var date_type = data_type_updated ? 'updated' : 'date'
|
||||||
time.post-meta__date
|
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
|
||||||
|
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
|
||||||
|
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
|
||||||
i.fa(class=date_icon aria-hidden="true")
|
i.fa(class=date_icon aria-hidden="true")
|
||||||
=date(article[date_type], config.date_format)
|
=date(article[date_type], config.date_format)
|
||||||
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
||||||
|
|||||||
@@ -18,6 +18,6 @@ section#rightside.rightside
|
|||||||
if is_post() && page.comments !== false && isComment
|
if is_post() && page.comments !== false && isComment
|
||||||
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
|
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
|
||||||
i.scroll_to_comment.fa.fa-comments
|
i.scroll_to_comment.fa.fa-comments
|
||||||
if is_post() && page.toc != false && theme.toc.enable
|
if is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
|
||||||
i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true")
|
i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true")
|
||||||
i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true")
|
i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true")
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
#sidebar
|
- let showToc = is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
|
||||||
- const showToc = is_post() && page.toc != false && theme.toc.enable
|
- let autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : ''
|
||||||
-
|
|
||||||
let tocNumber
|
-
|
||||||
if (page.toc_number !== undefined) tocNumber = page.toc_number
|
let tocNumber
|
||||||
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
|
if (page.toc_number !== undefined) tocNumber = page.toc_number
|
||||||
else tocNumber = true
|
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
|
||||||
-
|
else tocNumber = true
|
||||||
if(showToc)
|
-
|
||||||
|
|
||||||
|
if(showToc)
|
||||||
|
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar)
|
||||||
|
#sidebar
|
||||||
.sidebar-toc
|
.sidebar-toc
|
||||||
div.sidebar-toc__title= _p('sidebar.catalog')
|
div.sidebar-toc__title= _p('sidebar.catalog')
|
||||||
div.sidebar-toc__progress
|
div.sidebar-toc__progress
|
||||||
|
|||||||
@@ -31,6 +31,4 @@
|
|||||||
|
|
||||||
if(theme.social)
|
if(theme.social)
|
||||||
.card-info-social-icons.is-center
|
.card-info-social-icons.is-center
|
||||||
each url, icon in theme.social
|
include ../header/social.pug
|
||||||
a.social-icon(href=url target="_blank")
|
|
||||||
i(class=icon aria-hidden="true")
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
||||||
.aside-post-title(class=no_cover)
|
.aside-post-title(class=no_cover)
|
||||||
.aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
|
.aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
|
||||||
if (theme.post_meta.page.date_type)
|
time.aside-post_meta.post-meta__date(title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
|
||||||
- var date_type = theme.post_meta.page.date_type == 'updated' ? 'updated' : 'date'
|
|
||||||
time.aside-post_meta.post-meta__date #[=date(article[date_type], config.date_format)]
|
|
||||||
|
|
||||||
- })
|
- })
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
.webinfo-item
|
.webinfo-item
|
||||||
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
|
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
|
||||||
#webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
|
#webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
|
||||||
if theme.wordcount.total_wordcount
|
if theme.wordcount.enable && theme.wordcount.total_wordcount
|
||||||
.webinfo-item
|
.webinfo-item
|
||||||
.webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :"
|
.webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :"
|
||||||
.webinfo-site-wordcount=totalcount(site)
|
.webinfo-site-wordcount=totalcount(site)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "2.2.0",
|
"version": "2.2.5",
|
||||||
"description": "A Hexo Theme: Butterfly"
|
"description": "A Hexo Theme: Butterfly"
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('hexo-fs');
|
|
||||||
const url_for = require('hexo-util').url_for.bind(hexo);
|
const url_for = require('hexo-util').url_for.bind(hexo);
|
||||||
|
|
||||||
function lazyProcess(htmlContent) {
|
function lazyProcess(htmlContent) {
|
||||||
var bg = url_for(hexo.theme.config.lodding_bg.post);
|
var bg = url_for(hexo.theme.config.lodding_bg.post);
|
||||||
return htmlContent.replace(/<img(\s*?)src="(.*?)"(.*?)>/gi, (str, p1, p2, p3) => {
|
return htmlContent.replace(/<img(.*?)src="(.*?)"(.*?)>/gi, (str, p1, p2, p3) => {
|
||||||
if (/data-src/gi.test(str)) {
|
if (/data-src/gi.test(str)) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -14,10 +13,10 @@ function lazyProcess(htmlContent) {
|
|||||||
return classStr.replace(p1, `${p1} lazyload`);
|
return classStr.replace(p1, `${p1} lazyload`);
|
||||||
})
|
})
|
||||||
str = str.replace(p2, `${bg}`)
|
str = str.replace(p2, `${bg}`)
|
||||||
return str.replace(p3, `${p3} data-src="${p2}"`);
|
return str.replace('>', ` data-src="${p2}">`);
|
||||||
}
|
}
|
||||||
str = str.replace(p2, `${bg}`)
|
str = str.replace(p2, `${bg}`)
|
||||||
return str.replace(p3, `${p3} class="lazyload" data-src="${p2}"`);
|
return str.replace(p3, ` class="lazyload" data-src="${p2}" ${p3}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ hexo.extend.helper.register("list_archives", function(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.length > limit) {
|
if (data.length > limit) {
|
||||||
result += `<li class="archive-list-item">`;
|
result += `<li class="archive-list-item is-center">`;
|
||||||
result +=
|
result +=
|
||||||
`<a class="archive-list-link-more" href="` +
|
`<a class="archive-list-link-more" href="` +
|
||||||
"/" +
|
"/" +
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ h6
|
|||||||
left: $sidebar-icon-left
|
left: $sidebar-icon-left
|
||||||
z-index: 100
|
z-index: 100
|
||||||
font-size: $sidebar-icon-size
|
font-size: $sidebar-icon-size
|
||||||
opacity: 0
|
// opacity: 0
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
transition: all .2s
|
transition: all .2s
|
||||||
|
|
||||||
@@ -143,6 +143,9 @@ table
|
|||||||
.is_visible
|
.is_visible
|
||||||
display: block !important
|
display: block !important
|
||||||
|
|
||||||
|
.is-visible-inline
|
||||||
|
display: inline-block !important
|
||||||
|
|
||||||
.is_invisible
|
.is_invisible
|
||||||
display: none !important
|
display: none !important
|
||||||
|
|
||||||
@@ -187,6 +190,9 @@ img[src=''],
|
|||||||
img:not([src])
|
img:not([src])
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
|
.img-alt
|
||||||
|
margin: -.5rem 0 .5rem
|
||||||
|
|
||||||
// hexo tag video
|
// hexo tag video
|
||||||
.video-container
|
.video-container
|
||||||
position: relative
|
position: relative
|
||||||
@@ -240,8 +246,8 @@ img:not([src])
|
|||||||
margin: 2rem 0 !important
|
margin: 2rem 0 !important
|
||||||
|
|
||||||
.ad_height
|
.ad_height
|
||||||
height: auto !important
|
|
||||||
display: block !important
|
display: block !important
|
||||||
|
height: auto !important
|
||||||
|
|
||||||
#content-inner,
|
#content-inner,
|
||||||
#footer
|
#footer
|
||||||
@@ -250,9 +256,8 @@ img:not([src])
|
|||||||
#nav
|
#nav
|
||||||
animation: nav-effect 1s
|
animation: nav-effect 1s
|
||||||
|
|
||||||
#page-header
|
// #page-header
|
||||||
animation: header-effect 1s
|
// animation: header-effect 1s
|
||||||
|
|
||||||
#site_title,
|
#site_title,
|
||||||
#site_subtitle
|
#site_subtitle
|
||||||
animation: titlescale 1s
|
animation: titlescale 1s
|
||||||
@@ -290,10 +295,10 @@ if hexo-config('avatar.effect') == true
|
|||||||
animation: tocsidebarRtoL .5s
|
animation: tocsidebarRtoL .5s
|
||||||
|
|
||||||
.sidebar-toc__progress
|
.sidebar-toc__progress
|
||||||
animation: tocsidebarRtoL .5s
|
animation: tocsidebarRtoL .7s
|
||||||
|
|
||||||
.sidebar-toc__content
|
.sidebar-toc__content
|
||||||
animation: tocsidebarRtoL .7s
|
animation: tocsidebarRtoL .9s
|
||||||
|
|
||||||
@keyframes scroll-down-effect
|
@keyframes scroll-down-effect
|
||||||
0%
|
0%
|
||||||
@@ -321,9 +326,9 @@ if hexo-config('avatar.effect') == true
|
|||||||
0%
|
0%
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
50%
|
60%
|
||||||
opacity: 0
|
opacity: 0
|
||||||
transform: translateY(-50px)
|
transform: translateY(-30px)
|
||||||
|
|
||||||
100%
|
100%
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|||||||
@@ -185,10 +185,6 @@
|
|||||||
&.child
|
&.child
|
||||||
padding: 0 0 0 1.2rem
|
padding: 0 0 0 1.2rem
|
||||||
|
|
||||||
.card-archives
|
|
||||||
.archive-list-link-more
|
|
||||||
justify-content: center
|
|
||||||
|
|
||||||
.card-webinfo
|
.card-webinfo
|
||||||
.webinfo
|
.webinfo
|
||||||
padding: .2rem 1rem
|
padding: .2rem 1rem
|
||||||
|
|||||||
@@ -52,6 +52,9 @@
|
|||||||
border-radius: 35px
|
border-radius: 35px
|
||||||
transition: all .3s
|
transition: all .3s
|
||||||
|
|
||||||
|
.img-alt
|
||||||
|
display: none
|
||||||
|
|
||||||
.md-links-title
|
.md-links-title
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
padding: 16px 10px 0 0
|
padding: 16px 10px 0 0
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ figure.gallery-group
|
|||||||
img
|
img
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
|
.img-alt
|
||||||
|
display: none
|
||||||
|
|
||||||
.fancybox
|
.fancybox
|
||||||
width: auto
|
width: auto
|
||||||
text-align: inherit
|
text-align: inherit
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
|
|
||||||
> .meta-secondline,
|
> .meta-secondline,
|
||||||
> .meta-thirdline
|
> .meta-thirdline
|
||||||
display inline
|
display: inline
|
||||||
|
|
||||||
.word-count,
|
.word-count,
|
||||||
#busuanzi_value_page_pv,
|
#busuanzi_value_page_pv,
|
||||||
@@ -136,16 +136,22 @@
|
|||||||
height: 58px
|
height: 58px
|
||||||
border: none
|
border: none
|
||||||
font-size: 18px
|
font-size: 18px
|
||||||
|
opacity: 0
|
||||||
transition: all .5s
|
transition: all .5s
|
||||||
|
|
||||||
|
&:not(.fixed)
|
||||||
|
.menus
|
||||||
|
padding-right: 0 !important
|
||||||
|
|
||||||
.toggle-menu
|
.toggle-menu
|
||||||
display: none
|
display: none
|
||||||
padding: .1rem 0 0 .3rem
|
padding: .1rem 0 0 .3rem
|
||||||
|
vertical-align: top
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
color: $white
|
color: $white
|
||||||
|
|
||||||
&.is_visible
|
&.is-visible-inline
|
||||||
.site-page
|
.site-page
|
||||||
font-size: inherit
|
font-size: inherit
|
||||||
|
|
||||||
@@ -163,11 +169,6 @@
|
|||||||
box-shadow: 0 5px 6px -5px alpha($grey, .6)
|
box-shadow: 0 5px 6px -5px alpha($grey, .6)
|
||||||
transition: transform .2s ease-in-out, opacity .2s ease-in-out
|
transition: transform .2s ease-in-out, opacity .2s ease-in-out
|
||||||
|
|
||||||
&.open-sidebar
|
|
||||||
.menus,
|
|
||||||
#search_button
|
|
||||||
display: none
|
|
||||||
|
|
||||||
a,
|
a,
|
||||||
#site-name,
|
#site-name,
|
||||||
.toggle-menu
|
.toggle-menu
|
||||||
@@ -189,71 +190,75 @@
|
|||||||
font-weight: bold
|
font-weight: bold
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
.menus_item
|
.menus_items
|
||||||
position: relative
|
display: inline
|
||||||
display: inline-block
|
|
||||||
padding: 0 0 0 .7rem
|
|
||||||
|
|
||||||
&:hover
|
.menus_item
|
||||||
.menus_item_child
|
position: relative
|
||||||
display: block
|
display: inline-block
|
||||||
|
padding: 0 0 0 .7rem
|
||||||
.menus-expand
|
|
||||||
transform: rotate(180deg) !important
|
|
||||||
|
|
||||||
.menus-expand
|
|
||||||
padding: 4px
|
|
||||||
transition: all .3s
|
|
||||||
transform: rotate(0)
|
|
||||||
|
|
||||||
& > a
|
|
||||||
&:after
|
|
||||||
position: absolute
|
|
||||||
bottom: 0
|
|
||||||
left: 0
|
|
||||||
z-index: -1
|
|
||||||
width: 0
|
|
||||||
height: 3px
|
|
||||||
background-color: lighten($theme-color, 30%)
|
|
||||||
content: ''
|
|
||||||
transition: all .3s ease-in-out
|
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
|
.menus_item_child
|
||||||
|
display: block
|
||||||
|
|
||||||
|
.menus-expand
|
||||||
|
transform: rotate(180deg) !important
|
||||||
|
|
||||||
|
.menus-expand
|
||||||
|
padding: 4px
|
||||||
|
transition: all .3s
|
||||||
|
transform: rotate(0)
|
||||||
|
|
||||||
|
& > a
|
||||||
&:after
|
&:after
|
||||||
width: 100%
|
position: absolute
|
||||||
|
bottom: 0
|
||||||
.menus_item_child
|
left: 0
|
||||||
position: absolute
|
z-index: -1
|
||||||
right: 0
|
width: 0
|
||||||
display: none
|
height: 3px
|
||||||
margin-top: 8px
|
background-color: lighten($theme-color, 30%)
|
||||||
padding: 0
|
content: ''
|
||||||
width: max-content
|
transition: all .3s ease-in-out
|
||||||
background-color: alpha($white, .8)
|
|
||||||
box-shadow: 0 5px 20px -4px rgba($dark-black, .5)
|
|
||||||
animation: sub_menus .3s .1s ease both
|
|
||||||
|
|
||||||
&:before
|
|
||||||
position: absolute
|
|
||||||
top: -8px
|
|
||||||
left: 0
|
|
||||||
width: 100%
|
|
||||||
height: 20px
|
|
||||||
content: ''
|
|
||||||
|
|
||||||
li
|
|
||||||
padding: 1px 10px
|
|
||||||
list-style: none
|
|
||||||
text-align: center
|
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
background: $theme-color
|
&:after
|
||||||
|
width: 100%
|
||||||
|
|
||||||
a
|
.menus_item_child
|
||||||
color: $font-black
|
position: absolute
|
||||||
text-shadow: none
|
right: 0
|
||||||
|
display: none
|
||||||
|
margin-top: 8px
|
||||||
|
padding: 0
|
||||||
|
width: max-content
|
||||||
|
background-color: alpha($white, .8)
|
||||||
|
box-shadow: 0 5px 20px -4px rgba($dark-black, .5)
|
||||||
|
animation: sub_menus .3s .1s ease both
|
||||||
|
|
||||||
|
&:before
|
||||||
|
position: absolute
|
||||||
|
top: -8px
|
||||||
|
left: 0
|
||||||
|
width: 100%
|
||||||
|
height: 20px
|
||||||
|
content: ''
|
||||||
|
|
||||||
|
li
|
||||||
|
padding: 1px 10px
|
||||||
|
list-style: none
|
||||||
|
text-align: center
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
background: $theme-color
|
||||||
|
|
||||||
|
a
|
||||||
|
color: $font-black
|
||||||
|
text-shadow: none
|
||||||
|
|
||||||
#search_button
|
#search_button
|
||||||
|
display: inline
|
||||||
padding: 0 0 0 .7rem
|
padding: 0 0 0 .7rem
|
||||||
|
|
||||||
.site-page
|
.site-page
|
||||||
|
|||||||
@@ -100,6 +100,7 @@
|
|||||||
|
|
||||||
& > time
|
& > time
|
||||||
color: $theme-meta-color
|
color: $theme-meta-color
|
||||||
|
cursor: pointer
|
||||||
|
|
||||||
& > .article-meta
|
& > .article-meta
|
||||||
color: $theme-meta-color
|
color: $theme-meta-color
|
||||||
|
|||||||
@@ -1,60 +1,55 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
const isSnackbar = GLOBAL_CONFIG.Snackbar !== undefined
|
const isSnackbar = GLOBAL_CONFIG.Snackbar !== undefined
|
||||||
const isTocContent = $('#sidebar .sidebar-toc__content').children().length > 0
|
|
||||||
const $pageHead = $('#page-header')
|
const $pageHead = $('#page-header')
|
||||||
const $rightside = $('#rightside')
|
const $rightside = $('#rightside')
|
||||||
const $body = $('body')
|
const $body = $('body')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 當menu過多時,自動適配,避免UI錯亂
|
* 當menu過多時,自動適配,避免UI錯亂
|
||||||
*/
|
* 傳入 1 sidebar打開時
|
||||||
const searchWidth = $('#search_button').outerWidth() !== undefined ? $('#search_button').outerWidth() : 0
|
|
||||||
const blogNameWidth = $('#blog_name').width()
|
|
||||||
|
|
||||||
var mw = 0
|
|
||||||
var $menusItem = $pageHead.find('.menus_item')
|
|
||||||
for (var i = 0; i < $menusItem.length; i++) {
|
|
||||||
mw = mw + $menusItem.eq(i).outerWidth()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 傳入 1 sidebar打開時
|
|
||||||
* 傳入 2 正常狀態下
|
* 傳入 2 正常狀態下
|
||||||
* 傳入 3 resize時使用
|
|
||||||
*/
|
*/
|
||||||
|
var blogNameWidth = $('#blog_name').width()
|
||||||
|
var menusWidth = $('.menus').width()
|
||||||
|
var sidebarWidth = $('#sidebar').width()
|
||||||
|
|
||||||
function isAdjust (n) {
|
function isAdjust (n) {
|
||||||
var t
|
var t
|
||||||
if (n === 1) {
|
if (n === 1) {
|
||||||
t = blogNameWidth + searchWidth + mw > $pageHead.width() - 300
|
t = blogNameWidth + menusWidth > $pageHead.width() - sidebarWidth - 20
|
||||||
} else if (n === 2) {
|
} else if (n === 2) {
|
||||||
t = blogNameWidth + searchWidth + mw > $pageHead.width()
|
t = blogNameWidth + menusWidth > $pageHead.width() - 20
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t) headerAdjust()
|
if (t) headerAdjust()
|
||||||
else headerAdjustBack()
|
else headerAdjustBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function headerAdjust () {
|
||||||
|
$pageHead.find('.toggle-menu').addClass('is-visible-inline')
|
||||||
|
$pageHead.find('.menus_items').addClass('is_invisible')
|
||||||
|
$pageHead.find('#search_button span').addClass('is_invisible')
|
||||||
|
}
|
||||||
|
|
||||||
|
function headerAdjustBack () {
|
||||||
|
$pageHead.find('.toggle-menu').removeClass('is-visible-inline')
|
||||||
|
$pageHead.find('.menus_items').removeClass('is_invisible')
|
||||||
|
$pageHead.find('#search_button span').removeClass('is_invisible')
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化header
|
// 初始化header
|
||||||
function initAjust () {
|
function initAjust () {
|
||||||
if (window.innerWidth < 768) headerAdjust()
|
if (window.innerWidth < 768) headerAdjust()
|
||||||
else isAdjust(2)
|
else isAdjust(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
initAjust()
|
initAjust()
|
||||||
|
$('#page-header').css({ opacity: '1', animation: 'headerNoOpacity 1s' })
|
||||||
function headerAdjust () {
|
|
||||||
$pageHead.find('.toggle-menu').addClass('is_visible')
|
|
||||||
$pageHead.find('.menus').addClass('is_invisible')
|
|
||||||
$pageHead.find('#search_button span').addClass('is_invisible')
|
|
||||||
}
|
|
||||||
|
|
||||||
function headerAdjustBack () {
|
|
||||||
$pageHead.find('.toggle-menu').removeClass('is_visible')
|
|
||||||
$pageHead.find('.menus').removeClass('is_invisible')
|
|
||||||
$pageHead.find('#search_button span').removeClass('is_invisible')
|
|
||||||
}
|
|
||||||
|
|
||||||
$(window).on('resize', function () {
|
$(window).on('resize', function () {
|
||||||
if (!$pageHead.hasClass('open-sidebar')) {
|
if ($('#sidebar').hasClass('tocOpenPc') && $pageHead.hasClass('fixed')) {
|
||||||
|
isAdjust(1)
|
||||||
|
} else {
|
||||||
initAjust()
|
initAjust()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -72,21 +67,12 @@ $(function () {
|
|||||||
/**
|
/**
|
||||||
* 進入post頁sidebar處理
|
* 進入post頁sidebar處理
|
||||||
*/
|
*/
|
||||||
|
if (GLOBAL_CONFIG_SITE.isPost) {
|
||||||
var isSidebarOpen = $('#toggle-sidebar').hasClass('on') && isTocContent
|
if (window.innerWidth > 1024 && $('#toggle-sidebar').hasClass('on')) {
|
||||||
var isPcSidebarOpen = false
|
setTimeout(function () {
|
||||||
if (window.innerWidth > 1024 && isSidebarOpen) {
|
openSidebar()
|
||||||
setTimeout(function () {
|
}, 400)
|
||||||
openSidebar()
|
}
|
||||||
}, 400)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 當toc爲空時,隱藏toc按鈕
|
|
||||||
if (isTocContent) {
|
|
||||||
$('#toggle-sidebar').css('opacity', '1')
|
|
||||||
} else {
|
|
||||||
$('#toggle-sidebar').css('display', 'none')
|
|
||||||
$('#mobile-toc-button').css('display', 'none')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,9 +80,10 @@ $(function () {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function closeSidebar () {
|
function closeSidebar () {
|
||||||
isPcSidebarOpen = false
|
|
||||||
$pageHead.removeClass('open-sidebar')
|
|
||||||
$('#sidebar').removeClass('tocOpenPc')
|
$('#sidebar').removeClass('tocOpenPc')
|
||||||
|
$('.menus').animate({
|
||||||
|
paddingRight: 0
|
||||||
|
}, 400)
|
||||||
$('#body-wrap').animate({
|
$('#body-wrap').animate({
|
||||||
paddingLeft: 0
|
paddingLeft: 0
|
||||||
}, 400)
|
}, 400)
|
||||||
@@ -114,9 +101,10 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openSidebar () {
|
function openSidebar () {
|
||||||
isPcSidebarOpen = true
|
|
||||||
$pageHead.addClass('open-sidebar')
|
|
||||||
$('#sidebar').addClass('tocOpenPc')
|
$('#sidebar').addClass('tocOpenPc')
|
||||||
|
$('.menus').animate({
|
||||||
|
paddingRight: 300
|
||||||
|
}, 400)
|
||||||
$('#body-wrap').animate({
|
$('#body-wrap').animate({
|
||||||
paddingLeft: 300
|
paddingLeft: 300
|
||||||
}, 400)
|
}, 400)
|
||||||
@@ -129,7 +117,8 @@ $(function () {
|
|||||||
opacity: '1'
|
opacity: '1'
|
||||||
})
|
})
|
||||||
var isAdjustTimeCount = window.setInterval(function () {
|
var isAdjustTimeCount = window.setInterval(function () {
|
||||||
isAdjust(1)
|
if ($pageHead.hasClass('fixed')) isAdjust(1)
|
||||||
|
else isAdjust(2)
|
||||||
}, 100)
|
}, 100)
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
clearInterval(isAdjustTimeCount)
|
clearInterval(isAdjustTimeCount)
|
||||||
@@ -165,7 +154,7 @@ $(function () {
|
|||||||
$toggleMenu.removeClass('close').addClass('open')
|
$toggleMenu.removeClass('close').addClass('open')
|
||||||
$mobileSidevarMenus.css('transform', 'translate3d(-100%,0,0)')
|
$mobileSidevarMenus.css('transform', 'translate3d(-100%,0,0)')
|
||||||
var $mobileSidevarMenusChild = $mobileSidevarMenus.children()
|
var $mobileSidevarMenusChild = $mobileSidevarMenus.children()
|
||||||
for (i = 0; i <= $mobileSidevarMenusChild.length; i++) {
|
for (let i = 0; i <= $mobileSidevarMenusChild.length; i++) {
|
||||||
const duration = i / 5 + 0.2
|
const duration = i / 5 + 0.2
|
||||||
$mobileSidevarMenusChild.eq(i).css('animation', 'sidebarItem ' + duration + 's')
|
$mobileSidevarMenusChild.eq(i).css('animation', 'sidebarItem ' + duration + 's')
|
||||||
}
|
}
|
||||||
@@ -221,9 +210,9 @@ $(function () {
|
|||||||
const mql = window.matchMedia('(max-width: 1024px)')
|
const mql = window.matchMedia('(max-width: 1024px)')
|
||||||
mql.addListener(function (ev) {
|
mql.addListener(function (ev) {
|
||||||
if (ev.matches) {
|
if (ev.matches) {
|
||||||
if (isPcSidebarOpen === true) closeSidebar()
|
if ($('#sidebar').hasClass('tocOpenPc')) closeSidebar()
|
||||||
} else {
|
} else {
|
||||||
if ($('#toggle-sidebar').hasClass('on') && isTocContent) openSidebar()
|
if ($('#toggle-sidebar').hasClass('on')) openSidebar()
|
||||||
if ($mobileTocButton.hasClass('open')) closeMobileSidebar('toc')
|
if ($mobileTocButton.hasClass('open')) closeMobileSidebar('toc')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -271,16 +260,16 @@ $(function () {
|
|||||||
* 代碼收縮
|
* 代碼收縮
|
||||||
*/
|
*/
|
||||||
const $highlightTools = $('.highlight-tools')
|
const $highlightTools = $('.highlight-tools')
|
||||||
if (isHighlightShrink === true) {
|
if (isHighlightShrink === 'true') {
|
||||||
$highlightTools.append('<i class="fa fa-angle-down code-expand code-closed" aria-hidden="true"></i>')
|
$highlightTools.append('<i class="fa fa-angle-down code-expand code-closed" aria-hidden="true"></i>')
|
||||||
} else if (isHighlightShrink === false) {
|
} else if (isHighlightShrink === 'false') {
|
||||||
$highlightTools.append('<i class="fa fa-angle-down code-expand" aria-hidden="true"></i>')
|
$highlightTools.append('<i class="fa fa-angle-down code-expand" aria-hidden="true"></i>')
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.highlight-tools >.code-expand', function () {
|
$(document).on('click', '.highlight-tools >.code-expand', function () {
|
||||||
var $table = $(this).parent().next()
|
var $table = $(this).parent().next()
|
||||||
if ($(this).hasClass('code-closed')) {
|
if ($(this).hasClass('code-closed')) {
|
||||||
$table.css('display', '')
|
$table.css('display', 'block')
|
||||||
$(this).removeClass('code-closed')
|
$(this).removeClass('code-closed')
|
||||||
} else {
|
} else {
|
||||||
$table.css('display', 'none')
|
$table.css('display', 'none')
|
||||||
@@ -419,18 +408,16 @@ $(function () {
|
|||||||
} else if (isMediumZoom) {
|
} else if (isMediumZoom) {
|
||||||
const zoom = mediumZoom(document.querySelectorAll('#article-container :not(a)>img'))
|
const zoom = mediumZoom(document.querySelectorAll('#article-container :not(a)>img'))
|
||||||
zoom.on('open', function (event) {
|
zoom.on('open', function (event) {
|
||||||
const photoBg = $(document.documentElement).attr('data-theme') === 'dark' ? '#121212' : '#fff'
|
var photoBg = $(document.documentElement).attr('data-theme') === 'dark' ? '#121212' : '#fff'
|
||||||
zoom.update({
|
zoom.update({
|
||||||
background: photoBg
|
background: photoBg
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 點擊toc,收起sidebar
|
/**
|
||||||
// $('.toc-link').on('click', function () {
|
* 滾動處理
|
||||||
// closeMobileSidebar('toc')
|
*/
|
||||||
// })
|
|
||||||
|
|
||||||
var initTop = 0
|
var initTop = 0
|
||||||
$(window).scroll(function (event) {
|
$(window).scroll(function (event) {
|
||||||
var currentTop = $(this).scrollTop()
|
var currentTop = $(this).scrollTop()
|
||||||
@@ -442,7 +429,6 @@ $(function () {
|
|||||||
if (!$pageHead.hasClass('visible')) $pageHead.addClass('visible')
|
if (!$pageHead.hasClass('visible')) $pageHead.addClass('visible')
|
||||||
}
|
}
|
||||||
$pageHead.addClass('fixed')
|
$pageHead.addClass('fixed')
|
||||||
|
|
||||||
if ($rightside.css('opacity') === '0') {
|
if ($rightside.css('opacity') === '0') {
|
||||||
$rightside.css({ opacity: '1', transform: 'translateX(-38px)' })
|
$rightside.css({ opacity: '1', transform: 'translateX(-38px)' })
|
||||||
}
|
}
|
||||||
@@ -450,7 +436,6 @@ $(function () {
|
|||||||
if (currentTop === 0) {
|
if (currentTop === 0) {
|
||||||
$pageHead.removeClass('fixed').removeClass('visible')
|
$pageHead.removeClass('fixed').removeClass('visible')
|
||||||
}
|
}
|
||||||
|
|
||||||
$rightside.css({ opacity: '', transform: '' })
|
$rightside.css({ opacity: '', transform: '' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -473,7 +458,7 @@ $(function () {
|
|||||||
* toc
|
* toc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GLOBAL_CONFIG_SITE.isPost && isTocContent) {
|
if (GLOBAL_CONFIG_SITE.isPost && GLOBAL_CONFIG_SITE.isSidebar) {
|
||||||
$('.toc-child').hide()
|
$('.toc-child').hide()
|
||||||
|
|
||||||
// main of scroll
|
// main of scroll
|
||||||
@@ -647,7 +632,7 @@ $(function () {
|
|||||||
if (copyFont.length > 45) {
|
if (copyFont.length > 45) {
|
||||||
textFont = copyFont + '\n' + '\n' + '\n' +
|
textFont = copyFont + '\n' + '\n' + '\n' +
|
||||||
copyright.languages.author + '\n' +
|
copyright.languages.author + '\n' +
|
||||||
copyright.languages.link + '\n' +
|
copyright.languages.link + window.location.href + '\n' +
|
||||||
copyright.languages.source + '\n' +
|
copyright.languages.source + '\n' +
|
||||||
copyright.languages.info
|
copyright.languages.info
|
||||||
} else {
|
} else {
|
||||||
@@ -668,8 +653,7 @@ $(function () {
|
|||||||
var isFontAwesomeV5 = GLOBAL_CONFIG.isFontAwesomeV5
|
var isFontAwesomeV5 = GLOBAL_CONFIG.isFontAwesomeV5
|
||||||
var $darkModeButtom = $('#darkmode')
|
var $darkModeButtom = $('#darkmode')
|
||||||
if (typeof autoChangeMode !== 'undefined') {
|
if (typeof autoChangeMode !== 'undefined') {
|
||||||
if (Cookies.get('theme') === 'dark') changeLightIcon()
|
document.documentElement.getAttribute('data-theme') === 'dark' ? changeLightIcon() : changeDarkIcon()
|
||||||
else changeDarkIcon()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeLightIcon () {
|
function changeLightIcon () {
|
||||||
@@ -752,4 +736,16 @@ $(function () {
|
|||||||
margins: 4
|
margins: 4
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function addPhotoFigcaption () {
|
||||||
|
var images = $('#article-container img')
|
||||||
|
images.each(function (i, o) {
|
||||||
|
var $this = $(o)
|
||||||
|
if ($this.attr('alt')) {
|
||||||
|
var t = $('<div class="img-alt is-center">' + $this.attr('alt') + '</div>')
|
||||||
|
$this.after(t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (GLOBAL_CONFIG.isPhotoFigcaption) addPhotoFigcaption()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user