mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
breaking changes: cdn 可一鍵設置 本地文件/可單獨配置主題文件,第三方文件的 cdn
breaking changes: 移除 utterances,giscus, addtoany, busuanzi 的 cdn 配置
This commit is contained in:
143
_config.yml
143
_config.yml
@@ -827,88 +827,61 @@ inject:
|
|||||||
# Don't modify the following settings unless you know how they work
|
# Don't modify the following settings unless you know how they work
|
||||||
# 非必要請不要修改
|
# 非必要請不要修改
|
||||||
CDN:
|
CDN:
|
||||||
# main
|
# The CDN provider of internal scripts (主題內部 js 的 cdn 配置)
|
||||||
main_css:
|
# option: local/jsdelivr
|
||||||
main:
|
# Dev version cannot choose jsdelivr (dev版的主題不能設置為 jsdelivr)
|
||||||
utils:
|
internal_provider: local
|
||||||
|
# The CDN provider of third party scripts (第三方 js 的 cdn 配置)
|
||||||
# pjax
|
# option: local/jsdelivr
|
||||||
pjax:
|
# when set it to local, you need to install hexo-butterfly-extjs
|
||||||
|
third_party_provider: jsdelivr
|
||||||
# comments
|
option:
|
||||||
gitalk:
|
# main_css:
|
||||||
gitalk_css:
|
# main:
|
||||||
blueimp_md5:
|
# utils:
|
||||||
valine:
|
# translate:
|
||||||
disqusjs:
|
# local_search:
|
||||||
disqusjs_css:
|
# algolia_js:
|
||||||
utterances:
|
# algolia_search_v4:
|
||||||
twikoo:
|
# instantsearch_v4:
|
||||||
waline:
|
# pjax:
|
||||||
giscus:
|
# gitalk:
|
||||||
|
# gitalk_css:
|
||||||
# share
|
# blueimp_md5:
|
||||||
addtoany:
|
# valine:
|
||||||
sharejs:
|
# disqusjs:
|
||||||
sharejs_css:
|
# disqusjs_css:
|
||||||
|
# twikoo:
|
||||||
# search
|
# waline:
|
||||||
local_search:
|
# sharejs:
|
||||||
algolia_js:
|
# sharejs_css:
|
||||||
algolia_search_v4:
|
# mathjax:
|
||||||
instantsearch_v4:
|
# katex:
|
||||||
|
# katex_copytex:
|
||||||
# math
|
# katex_copytex_css:
|
||||||
mathjax:
|
# mermaid:
|
||||||
katex:
|
# canvas_ribbon:
|
||||||
katex_copytex:
|
# canvas_fluttering_ribbon:
|
||||||
katex_copytex_css:
|
# canvas_nest:
|
||||||
mermaid:
|
# lazyload:
|
||||||
|
# instantpage:
|
||||||
# count
|
# typed:
|
||||||
busuanzi:
|
# pangu:
|
||||||
|
# fancybox_css_v4:
|
||||||
# background effect
|
# fancybox_v4:
|
||||||
canvas_ribbon:
|
# medium_zoom:
|
||||||
canvas_fluttering_ribbon:
|
# snackbar_css:
|
||||||
canvas_nest:
|
# snackbar:
|
||||||
|
# activate_power_mode:
|
||||||
lazyload:
|
# fireworks:
|
||||||
instantpage:
|
# click_heart:
|
||||||
typed:
|
# ClickShowText:
|
||||||
pangu:
|
# fontawesomeV6:
|
||||||
|
# flickr_justified_gallery_js:
|
||||||
# photo
|
# flickr_justified_gallery_css:
|
||||||
fancybox_css_v4:
|
# aplayer_css:
|
||||||
fancybox_v4:
|
# aplayer_js:
|
||||||
medium_zoom:
|
# meting_js:
|
||||||
|
# prismjs_js:
|
||||||
# snackbar
|
# prismjs_lineNumber_js:
|
||||||
snackbar_css:
|
# prismjs_autoloader:
|
||||||
snackbar:
|
|
||||||
|
|
||||||
# effect
|
|
||||||
activate_power_mode:
|
|
||||||
fireworks:
|
|
||||||
click_heart:
|
|
||||||
ClickShowText:
|
|
||||||
|
|
||||||
# fontawesome
|
|
||||||
fontawesomeV6:
|
|
||||||
|
|
||||||
# Conversion between Traditional and Simplified Chinese
|
|
||||||
translate:
|
|
||||||
|
|
||||||
# flickr-justified-gallery
|
|
||||||
flickr_justified_gallery_js:
|
|
||||||
flickr_justified_gallery_css:
|
|
||||||
|
|
||||||
# aplayer
|
|
||||||
aplayer_css:
|
|
||||||
aplayer_js:
|
|
||||||
meting_js:
|
|
||||||
|
|
||||||
# Prism.js
|
|
||||||
prismjs_js:
|
|
||||||
prismjs_lineNumber_js:
|
|
||||||
prismjs_autoloader:
|
|
||||||
@@ -1,34 +1,34 @@
|
|||||||
div
|
div
|
||||||
script(src=url_for(theme.CDN.utils))
|
script(src=url_for(theme.asset.utils))
|
||||||
script(src=url_for(theme.CDN.main))
|
script(src=url_for(theme.asset.main))
|
||||||
|
|
||||||
if theme.translate.enable
|
if theme.translate.enable
|
||||||
script(src=url_for(theme.CDN.translate))
|
script(src=url_for(theme.asset.translate))
|
||||||
|
|
||||||
if theme.medium_zoom
|
if theme.medium_zoom
|
||||||
script(src=url_for(theme.CDN.medium_zoom))
|
script(src=url_for(theme.asset.medium_zoom))
|
||||||
else if theme.fancybox
|
else if theme.fancybox
|
||||||
script(src=url_for(theme.CDN.fancybox_v4))
|
script(src=url_for(theme.asset.fancybox_v4))
|
||||||
|
|
||||||
if theme.instantpage
|
if theme.instantpage
|
||||||
script(src=url_for(theme.CDN.instantpage), type='module')
|
script(src=url_for(theme.asset.instantpage), type='module')
|
||||||
|
|
||||||
if theme.lazyload.enable
|
if theme.lazyload.enable
|
||||||
script(src=url_for(theme.CDN.lazyload))
|
script(src=url_for(theme.asset.lazyload))
|
||||||
|
|
||||||
if theme.snackbar.enable
|
if theme.snackbar.enable
|
||||||
script(src=url_for(theme.CDN.snackbar))
|
script(src=url_for(theme.asset.snackbar))
|
||||||
|
|
||||||
if theme.pangu.enable
|
if theme.pangu.enable
|
||||||
!= partial("includes/third-party/pangu.pug", {}, { cache: true })
|
!= partial("includes/third-party/pangu.pug", {}, { cache: true })
|
||||||
|
|
||||||
//- search
|
//- search
|
||||||
if theme.algolia_search.enable
|
if theme.algolia_search.enable
|
||||||
script(src=url_for(theme.CDN.algolia_search_v4))
|
script(src=url_for(theme.asset.algolia_search_v4))
|
||||||
script(src=url_for(theme.CDN.instantsearch_v4))
|
script(src=url_for(theme.asset.instantsearch_v4))
|
||||||
script(src=url_for(theme.CDN.algolia_js))
|
script(src=url_for(theme.asset.algolia_js))
|
||||||
else if theme.local_search.enable
|
else if theme.local_search.enable
|
||||||
script(src=url_for(theme.CDN.local_search))
|
script(src=url_for(theme.asset.local_search))
|
||||||
|
|
||||||
if theme.preloader
|
if theme.preloader
|
||||||
!= partial("includes/loading/loading-js", {}, { cache: true })
|
!= partial("includes/loading/loading-js", {}, { cache: true })
|
||||||
@@ -69,4 +69,4 @@ div
|
|||||||
!= partial("includes/third-party/pjax", {}, { cache: true })
|
!= partial("includes/third-party/pjax", {}, { cache: true })
|
||||||
|
|
||||||
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
||||||
script(async data-pjax src=url_for(theme.CDN.busuanzi))
|
script(async data-pjax src='//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js')
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ if (theme.pwa && theme.pwa.enable)
|
|||||||
!=partial('includes/head/pwa', {}, {cache: true})
|
!=partial('includes/head/pwa', {}, {cache: true})
|
||||||
|
|
||||||
//- main css
|
//- main css
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.main_css))
|
link(rel='stylesheet', href=url_for(theme.asset.main_css))
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.fontawesomeV6) media="print" onload="this.media='all'")
|
link(rel='stylesheet', href=url_for(theme.asset.fontawesomeV6) media="print" onload="this.media='all'")
|
||||||
|
|
||||||
if (theme.snackbar && theme.snackbar.enable)
|
if (theme.snackbar && theme.snackbar.enable)
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css) media="print" onload="this.media='all'")
|
link(rel='stylesheet', href=url_for(theme.asset.snackbar_css) media="print" onload="this.media='all'")
|
||||||
|
|
||||||
if theme.fancybox
|
if theme.fancybox
|
||||||
link(rel='stylesheet' href=url_for(theme.CDN.fancybox_css_v4) media="print" onload="this.media='all'")
|
link(rel='stylesheet' href=url_for(theme.asset.fancybox_css_v4) media="print" onload="this.media='all'")
|
||||||
|
|
||||||
//- google_adsense
|
//- google_adsense
|
||||||
!=partial('includes/head/google_adsense', {}, {cache: true})
|
!=partial('includes/head/google_adsense', {}, {cache: true})
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ script.
|
|||||||
Snackbar: !{Snackbar},
|
Snackbar: !{Snackbar},
|
||||||
source: {
|
source: {
|
||||||
justifiedGallery: {
|
justifiedGallery: {
|
||||||
js: '!{url_for(theme.CDN.flickr_justified_gallery_js)}',
|
js: '!{url_for(theme.asset.flickr_justified_gallery_js)}',
|
||||||
css: '!{url_for(theme.CDN.flickr_justified_gallery_css)}'
|
css: '!{url_for(theme.asset.flickr_justified_gallery_css)}'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isPhotoFigcaption: !{theme.photofigcaption},
|
isPhotoFigcaption: !{theme.photofigcaption},
|
||||||
|
|||||||
6
layout/includes/third-party/aplayer.pug
vendored
6
layout/includes/third-party/aplayer.pug
vendored
@@ -1,3 +1,3 @@
|
|||||||
link(rel='stylesheet' href=url_for(theme.CDN.aplayer_css) media="print" onload="this.media='all'")
|
link(rel='stylesheet' href=url_for(theme.asset.aplayer_css) media="print" onload="this.media='all'")
|
||||||
script(src=url_for(theme.CDN.aplayer_js))
|
script(src=url_for(theme.asset.aplayer_js))
|
||||||
script(src=url_for(theme.CDN.meting_js))
|
script(src=url_for(theme.asset.meting_js))
|
||||||
@@ -28,7 +28,7 @@ script.
|
|||||||
if (typeof twikoo === 'object') {
|
if (typeof twikoo === 'object') {
|
||||||
runTwikoo()
|
runTwikoo()
|
||||||
} else {
|
} else {
|
||||||
getScript('!{theme.CDN.twikoo}').then(runTwikoo)
|
getScript('!{theme.asset.twikoo}').then(runTwikoo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof Valine === 'function') initValine()
|
if (typeof Valine === 'function') initValine()
|
||||||
else getScript('!{url_for(theme.CDN.valine)}').then(initValine)
|
else getScript('!{url_for(theme.asset.valine)}').then(initValine)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.pjax ? loadValine() : window.addEventListener('load', loadValine)
|
window.pjax ? loadValine() : window.addEventListener('load', loadValine)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof Waline === 'function') initWaline()
|
if (typeof Waline === 'function') initWaline()
|
||||||
else getScript('!{url_for(theme.CDN.waline)}').then(initWaline)
|
else getScript('!{url_for(theme.asset.waline)}').then(initWaline)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.pjax ? loadWaline() : window.addEventListener('load', loadWaline)
|
window.pjax ? loadWaline() : window.addEventListener('load', loadWaline)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ script.
|
|||||||
function addDisqusjsCSS () {
|
function addDisqusjsCSS () {
|
||||||
const ele = document.createElement('link')
|
const ele = document.createElement('link')
|
||||||
ele.rel = 'stylesheet'
|
ele.rel = 'stylesheet'
|
||||||
ele.href= '!{url_for(theme.CDN.disqusjs_css)}'
|
ele.href= '!{url_for(theme.asset.disqusjs_css)}'
|
||||||
document.getElementsByTagName('head')[0].appendChild(ele)
|
document.getElementsByTagName('head')[0].appendChild(ele)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ script.
|
|||||||
if (window.disqusJsLoad) initDisqusjs()
|
if (window.disqusJsLoad) initDisqusjs()
|
||||||
else {
|
else {
|
||||||
addDisqusjsCSS()
|
addDisqusjsCSS()
|
||||||
getScript('!{url_for(theme.CDN.disqusjs)}').then(initDisqusjs)
|
getScript('!{url_for(theme.asset.disqusjs)}').then(initDisqusjs)
|
||||||
window.disqusJsLoad = true
|
window.disqusJsLoad = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ script.
|
|||||||
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}'
|
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}'
|
||||||
|
|
||||||
const config = Object.assign({
|
const config = Object.assign({
|
||||||
src: '!{theme.CDN.giscus}',
|
src: 'https://giscus.app/client.js',
|
||||||
'data-repo': '!{repo}',
|
'data-repo': '!{repo}',
|
||||||
'data-repo-id': '!{repo_id}',
|
'data-repo-id': '!{repo_id}',
|
||||||
'data-category-id': '!{category_id}',
|
'data-category-id': '!{category_id}',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ script.
|
|||||||
function addGitalkSource () {
|
function addGitalkSource () {
|
||||||
const ele = document.createElement('link')
|
const ele = document.createElement('link')
|
||||||
ele.rel = 'stylesheet'
|
ele.rel = 'stylesheet'
|
||||||
ele.href= '!{url_for(theme.CDN.gitalk_css)}'
|
ele.href= '!{url_for(theme.asset.gitalk_css)}'
|
||||||
document.getElementsByTagName('head')[0].appendChild(ele)
|
document.getElementsByTagName('head')[0].appendChild(ele)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ script.
|
|||||||
if (typeof Gitalk === 'function') initGitalk()
|
if (typeof Gitalk === 'function') initGitalk()
|
||||||
else {
|
else {
|
||||||
addGitalkSource()
|
addGitalkSource()
|
||||||
getScript('!{url_for(theme.CDN.gitalk)}').then(initGitalk)
|
getScript('!{url_for(theme.asset.gitalk)}').then(initGitalk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ script.
|
|||||||
setTimeout(runFn,0)
|
setTimeout(runFn,0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getScript('!{theme.CDN.twikoo}').then(runFn)
|
getScript('!{theme.asset.twikoo}').then(runFn)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {
|
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ script.
|
|||||||
function loadUtterances () {
|
function loadUtterances () {
|
||||||
let ele = document.createElement('script')
|
let ele = document.createElement('script')
|
||||||
ele.setAttribute('id', 'utterances_comment')
|
ele.setAttribute('id', 'utterances_comment')
|
||||||
ele.setAttribute('src', '!{url_for(theme.CDN.utterances)}')
|
ele.setAttribute('src', 'https://utteranc.es/client.js')
|
||||||
ele.setAttribute('repo', '!{theme.utterances.repo}')
|
ele.setAttribute('repo', '!{theme.utterances.repo}')
|
||||||
ele.setAttribute('issue-term', '!{theme.utterances.issue_term}')
|
ele.setAttribute('issue-term', '!{theme.utterances.issue_term}')
|
||||||
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
|
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof Valine === 'function') initValine()
|
if (typeof Valine === 'function') initValine()
|
||||||
else getScript('!{url_for(theme.CDN.valine)}').then(initValine)
|
else getScript('!{url_for(theme.asset.valine)}').then(initValine)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
|
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof Waline === 'function') initWaline()
|
if (typeof Waline === 'function') initWaline()
|
||||||
else getScript('!{url_for(theme.CDN.waline)}').then(initWaline)
|
else getScript('!{url_for(theme.asset.waline)}').then(initWaline)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('!{theme.comments.use[0]}' === 'Waline' || !!{theme.comments.lazyload}) {
|
if ('!{theme.comments.use[0]}' === 'Waline' || !!{theme.comments.lazyload}) {
|
||||||
|
|||||||
14
layout/includes/third-party/effect.pug
vendored
14
layout/includes/third-party/effect.pug
vendored
@@ -1,19 +1,19 @@
|
|||||||
if theme.fireworks && theme.fireworks.enable
|
if theme.fireworks && theme.fireworks.enable
|
||||||
canvas.fireworks(mobile=`${theme.fireworks.mobile}`)
|
canvas.fireworks(mobile=`${theme.fireworks.mobile}`)
|
||||||
script(src=url_for(theme.CDN.fireworks))
|
script(src=url_for(theme.asset.fireworks))
|
||||||
|
|
||||||
if (theme.canvas_ribbon && theme.canvas_ribbon.enable)
|
if (theme.canvas_ribbon && theme.canvas_ribbon.enable)
|
||||||
script(defer id="ribbon" src=url_for(theme.CDN.canvas_ribbon) size=theme.canvas_ribbon.size
|
script(defer id="ribbon" src=url_for(theme.asset.canvas_ribbon) size=theme.canvas_ribbon.size
|
||||||
alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`)
|
alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`)
|
||||||
|
|
||||||
if (theme.canvas_fluttering_ribbon && theme.canvas_fluttering_ribbon.enable)
|
if (theme.canvas_fluttering_ribbon && theme.canvas_fluttering_ribbon.enable)
|
||||||
script(defer id="fluttering_ribbon" mobile=`${theme.canvas_fluttering_ribbon.mobile}` src=url_for(theme.CDN.canvas_fluttering_ribbon))
|
script(defer id="fluttering_ribbon" mobile=`${theme.canvas_fluttering_ribbon.mobile}` src=url_for(theme.asset.canvas_fluttering_ribbon))
|
||||||
|
|
||||||
if (theme.canvas_nest && theme.canvas_nest.enable)
|
if (theme.canvas_nest && theme.canvas_nest.enable)
|
||||||
script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.CDN.canvas_nest))
|
script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.asset.canvas_nest))
|
||||||
|
|
||||||
if theme.activate_power_mode.enable
|
if theme.activate_power_mode.enable
|
||||||
script(src=url_for(theme.CDN.activate_power_mode))
|
script(src=url_for(theme.asset.activate_power_mode))
|
||||||
script.
|
script.
|
||||||
POWERMODE.colorful = !{theme.activate_power_mode.colorful};
|
POWERMODE.colorful = !{theme.activate_power_mode.colorful};
|
||||||
POWERMODE.shake = !{theme.activate_power_mode.shake};
|
POWERMODE.shake = !{theme.activate_power_mode.shake};
|
||||||
@@ -22,11 +22,11 @@ if theme.activate_power_mode.enable
|
|||||||
|
|
||||||
//- 鼠標特效
|
//- 鼠標特效
|
||||||
if theme.click_heart && theme.click_heart.enable
|
if theme.click_heart && theme.click_heart.enable
|
||||||
script#click-heart(src=url_for(theme.CDN.click_heart) async mobile=`${theme.click_heart.mobile}`)
|
script#click-heart(src=url_for(theme.asset.click_heart) async mobile=`${theme.click_heart.mobile}`)
|
||||||
|
|
||||||
if theme.ClickShowText && theme.ClickShowText.enable
|
if theme.ClickShowText && theme.ClickShowText.enable
|
||||||
script#click-show-text(
|
script#click-show-text(
|
||||||
src= url_for(theme.CDN.ClickShowText)
|
src= url_for(theme.asset.ClickShowText)
|
||||||
data-mobile= `${theme.ClickShowText.mobile}`
|
data-mobile= `${theme.ClickShowText.mobile}`
|
||||||
data-text= theme.ClickShowText.text.join(",")
|
data-text= theme.ClickShowText.text.join(",")
|
||||||
data-fontsize= theme.ClickShowText.fontSize
|
data-fontsize= theme.ClickShowText.fontSize
|
||||||
|
|||||||
6
layout/includes/third-party/math/katex.pug
vendored
6
layout/includes/third-party/math/katex.pug
vendored
@@ -1,6 +1,6 @@
|
|||||||
link(rel="stylesheet" type="text/css" href=theme.CDN.katex)
|
link(rel="stylesheet" type="text/css" href=theme.asset.katex)
|
||||||
script(src=url_for(theme.CDN.katex_copytex))
|
script(src=url_for(theme.asset.katex_copytex))
|
||||||
link(rel="stylesheet" type="text/css" href=theme.CDN.katex_copytex_css)
|
link(rel="stylesheet" type="text/css" href=theme.asset.katex_copytex_css)
|
||||||
script.
|
script.
|
||||||
(() => {
|
(() => {
|
||||||
document.querySelectorAll('#article-container span.katex-display').forEach(item => {
|
document.querySelectorAll('#article-container span.katex-display').forEach(item => {
|
||||||
|
|||||||
2
layout/includes/third-party/math/mathjax.pug
vendored
2
layout/includes/third-party/math/mathjax.pug
vendored
@@ -37,7 +37,7 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
const script = document.createElement('script')
|
const script = document.createElement('script')
|
||||||
script.src = '!{theme.CDN.mathjax}'
|
script.src = '!{theme.asset.mathjax}'
|
||||||
script.id = 'MathJax-script'
|
script.id = 'MathJax-script'
|
||||||
script.async = true
|
script.async = true
|
||||||
document.head.appendChild(script)
|
document.head.appendChild(script)
|
||||||
|
|||||||
2
layout/includes/third-party/math/mermaid.pug
vendored
2
layout/includes/third-party/math/mermaid.pug
vendored
@@ -18,7 +18,7 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loadMermaid = () => {
|
const loadMermaid = () => {
|
||||||
window.loadMermaid ? runMermaid() : getScript('!{theme.CDN.mermaid}').then(runMermaid)
|
window.loadMermaid ? runMermaid() : getScript('!{theme.asset.mermaid}').then(runMermaid)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
|
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ script.
|
|||||||
if (typeof twikoo === 'object') {
|
if (typeof twikoo === 'object') {
|
||||||
runTwikoo()
|
runTwikoo()
|
||||||
} else {
|
} else {
|
||||||
getScript('!{theme.CDN.twikoo}').then(runTwikoo)
|
getScript('!{theme.asset.twikoo}').then(runTwikoo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
- let default_avatar = theme.valine.avatar
|
- let default_avatar = theme.valine.avatar
|
||||||
|
|
||||||
script(src=url_for(theme.CDN.blueimp_md5))
|
script(src=url_for(theme.asset.blueimp_md5))
|
||||||
script.
|
script.
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
const changeContent = (content) => {
|
const changeContent = (content) => {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof Waline === 'function') loadWaline()
|
if (typeof Waline === 'function') loadWaline()
|
||||||
else getScript('!{url_for(theme.CDN.waline)}').then(loadWaline)
|
else getScript('!{url_for(theme.asset.waline)}').then(loadWaline)
|
||||||
}
|
}
|
||||||
|
|
||||||
const newestCommentInit = () => {
|
const newestCommentInit = () => {
|
||||||
|
|||||||
2
layout/includes/third-party/pangu.pug
vendored
2
layout/includes/third-party/pangu.pug
vendored
@@ -2,7 +2,7 @@ script.
|
|||||||
function panguFn () {
|
function panguFn () {
|
||||||
if (typeof pangu === 'object') pangu.autoSpacingPage()
|
if (typeof pangu === 'object') pangu.autoSpacingPage()
|
||||||
else {
|
else {
|
||||||
getScript('!{url_for(theme.CDN.pangu)}')
|
getScript('!{url_for(theme.asset.pangu)}')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
pangu.autoSpacingPage()
|
pangu.autoSpacingPage()
|
||||||
})
|
})
|
||||||
|
|||||||
2
layout/includes/third-party/pjax.pug
vendored
2
layout/includes/third-party/pjax.pug
vendored
@@ -12,7 +12,7 @@ if choose
|
|||||||
if choose.includes('Utterances') || choose.includes('Giscus')
|
if choose.includes('Utterances') || choose.includes('Giscus')
|
||||||
- pjaxSelectors.unshift('link[rel="canonical"]')
|
- pjaxSelectors.unshift('link[rel="canonical"]')
|
||||||
|
|
||||||
script(src=url_for(theme.CDN.pjax))
|
script(src=url_for(theme.asset.pjax))
|
||||||
script.
|
script.
|
||||||
let pjaxSelectors = !{JSON.stringify(pjaxSelectors)}
|
let pjaxSelectors = !{JSON.stringify(pjaxSelectors)}
|
||||||
|
|
||||||
|
|||||||
6
layout/includes/third-party/prismjs.pug
vendored
6
layout/includes/third-party/prismjs.pug
vendored
@@ -1,5 +1,5 @@
|
|||||||
if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess
|
if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess
|
||||||
script(src=url_for(theme.CDN.prismjs_js))
|
script(src=url_for(theme.asset.prismjs_js))
|
||||||
script(src=url_for(theme.CDN.prismjs_autoloader))
|
script(src=url_for(theme.asset.prismjs_autoloader))
|
||||||
if config.prismjs.line_number
|
if config.prismjs.line_number
|
||||||
script(src=url_for(theme.CDN.prismjs_lineNumber_js))
|
script(src=url_for(theme.asset.prismjs_lineNumber_js))
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
a(class="a2a_button_" + name)
|
a(class="a2a_button_" + name)
|
||||||
|
|
||||||
a.a2a_dd(href="https://www.addtoany.com/share")
|
a.a2a_dd(href="https://www.addtoany.com/share")
|
||||||
script(async src=url_for(theme.CDN.addtoany))
|
script(async src='https://static.addtoany.com/menu/page.js')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
.social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites)
|
.social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites)
|
||||||
link(rel='stylesheet' href=url_for(theme.CDN.sharejs_css) media="print" onload="this.media='all'")
|
link(rel='stylesheet' href=url_for(theme.asset.sharejs_css) media="print" onload="this.media='all'")
|
||||||
script(src=url_for(theme.CDN.sharejs) defer)
|
script(src=url_for(theme.asset.sharejs) defer)
|
||||||
8
layout/includes/third-party/subtitle.pug
vendored
8
layout/includes/third-party/subtitle.pug
vendored
@@ -29,7 +29,7 @@ case source
|
|||||||
if (typeof Typed === 'function') {
|
if (typeof Typed === 'function') {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
} else {
|
} else {
|
||||||
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
|
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
@@ -61,7 +61,7 @@ case source
|
|||||||
if (typeof Typed === 'function') {
|
if (typeof Typed === 'function') {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
} else {
|
} else {
|
||||||
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
|
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
@@ -94,7 +94,7 @@ case source
|
|||||||
if (typeof Typed === 'function') {
|
if (typeof Typed === 'function') {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
} else {
|
} else {
|
||||||
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
|
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
@@ -121,7 +121,7 @@ case source
|
|||||||
if (typeof Typed === 'function') {
|
if (typeof Typed === 'function') {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
} else {
|
} else {
|
||||||
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
|
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
subtitleType()
|
subtitleType()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "4.1.0",
|
"version": "4.2.0-b1",
|
||||||
"description": "A Simple and Card UI Design theme for Hexo",
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -6,115 +6,243 @@
|
|||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const { version } = require('../../package.json')
|
||||||
|
|
||||||
hexo.extend.filter.register('before_generate', () => {
|
hexo.extend.filter.register('before_generate', () => {
|
||||||
const themeConfig = hexo.theme.config
|
const themeConfig = hexo.theme.config
|
||||||
|
const { CDN, comments } = themeConfig
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge CDN
|
* Merge CDN
|
||||||
*/
|
*/
|
||||||
|
const internalData = {
|
||||||
|
main_css: {
|
||||||
|
cdn: '/css/index.css',
|
||||||
|
local: '/css/index.css'
|
||||||
|
},
|
||||||
|
main: {
|
||||||
|
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/main.min.js`,
|
||||||
|
local: '/js/main.js'
|
||||||
|
},
|
||||||
|
utils: {
|
||||||
|
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/utils.min.js`,
|
||||||
|
local: '/js/utils.js'
|
||||||
|
},
|
||||||
|
translate: {
|
||||||
|
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/tw_cn.min.js`,
|
||||||
|
local: '/js/tw_cn.js'
|
||||||
|
},
|
||||||
|
local_search: {
|
||||||
|
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/search/local-search.min.js`,
|
||||||
|
local: '/js/search/local-search.js'
|
||||||
|
},
|
||||||
|
algolia_js: {
|
||||||
|
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/search/algolia.min.js`,
|
||||||
|
local: '/js/search/algolia.js'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const defaultCDN = {
|
const data = {
|
||||||
main_css: '/css/index.css',
|
algolia_search_v4: {
|
||||||
main: '/js/main.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js',
|
||||||
utils: '/js/utils.js',
|
local: '/js/lib/algolia/algoliasearch-lite.umd.js'
|
||||||
|
},
|
||||||
// pjax
|
instantsearch_v4: {
|
||||||
pjax: 'https://cdn.jsdelivr.net/npm/pjax/pjax.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js',
|
||||||
|
local: '/js/lib/algolia/instantsearch.production.min.js'
|
||||||
// comments
|
},
|
||||||
gitalk: 'https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js',
|
pjax: {
|
||||||
gitalk_css: 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css',
|
cdn: 'https://cdn.jsdelivr.net/npm/pjax/pjax.min.js',
|
||||||
blueimp_md5: 'https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js',
|
local: '/js/lib/pjax/pjax.min.js'
|
||||||
valine: 'https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js',
|
},
|
||||||
disqusjs: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js',
|
gitalk: {
|
||||||
disqusjs_css: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css',
|
cdn: 'https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js',
|
||||||
utterances: 'https://utteranc.es/client.js',
|
local: '/js/lib/gitalk/gitalk.min.js'
|
||||||
twikoo: 'https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js',
|
},
|
||||||
waline: 'https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js',
|
gitalk_css: {
|
||||||
giscus: 'https://giscus.app/client.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css',
|
||||||
|
local: '/js/lib/gitalk/gitalk.css'
|
||||||
// share
|
},
|
||||||
addtoany: 'https://static.addtoany.com/menu/page.js',
|
blueimp_md5: {
|
||||||
sharejs: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js',
|
||||||
sharejs_css: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css',
|
local: '/js/lib/blueimp-md5/md5.min.js'
|
||||||
|
},
|
||||||
// search
|
valine: {
|
||||||
local_search: '/js/search/local-search.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js',
|
||||||
algolia_js: '/js/search/algolia.js',
|
local: '/js/lib/valine/Valine.min.js'
|
||||||
algolia_search_v4: 'https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js',
|
},
|
||||||
instantsearch_v4: 'https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js',
|
disqusjs: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js',
|
||||||
// math
|
local: '/js/lib/disqusjs/disqus.js'
|
||||||
mathjax: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js',
|
},
|
||||||
katex: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css',
|
disqusjs_css: {
|
||||||
katex_copytex: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css',
|
||||||
katex_copytex_css: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.css',
|
local: '/js/lib/disqusjs/disqusjs.css'
|
||||||
mermaid: 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js',
|
},
|
||||||
|
twikoo: {
|
||||||
// count
|
cdn: 'https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js',
|
||||||
busuanzi: '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js',
|
local: '/js/lib/twikoo/twikoo.all.min.js'
|
||||||
|
},
|
||||||
// background effect
|
waline: {
|
||||||
canvas_ribbon: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js',
|
||||||
canvas_fluttering_ribbon: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js',
|
local: '/js/lib/waline/Waline.min.js'
|
||||||
canvas_nest: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js',
|
},
|
||||||
|
sharejs: {
|
||||||
lazyload: 'https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js',
|
||||||
instantpage: 'https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js',
|
local: '/js/lib/social-share.js/dist/social-share.min.js'
|
||||||
typed: 'https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js',
|
},
|
||||||
pangu: 'https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js',
|
sharejs_css: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css',
|
||||||
// photo
|
local: '/js/lib/social-share.js/dist/share.min.css'
|
||||||
fancybox_css_v4: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css',
|
},
|
||||||
fancybox_v4: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js',
|
mathjax: {
|
||||||
medium_zoom: 'https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js',
|
||||||
|
local: '/js/lib/mathjax/tex-mml-chtml.js'
|
||||||
// snackbar
|
},
|
||||||
snackbar_css: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css',
|
katex: {
|
||||||
snackbar: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css',
|
||||||
|
local: '/js/lib/katex/katex.min.css'
|
||||||
// effect
|
},
|
||||||
activate_power_mode: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js',
|
katex_copytex: {
|
||||||
fireworks: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.min.js',
|
||||||
click_heart: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js',
|
local: '/js/lib/katex/copy-tex.min.js'
|
||||||
ClickShowText: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js',
|
},
|
||||||
|
katex_copytex_css: {
|
||||||
// fontawesome
|
cdn: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.css',
|
||||||
fontawesomeV6: 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css',
|
local: '/js/lib/katex/copy-tex.css'
|
||||||
|
},
|
||||||
// Conversion between Traditional and Simplified Chinese
|
mermaid: {
|
||||||
translate: '/js/tw_cn.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js',
|
||||||
|
local: '/js/lib/mermaid/mermaid.min.js'
|
||||||
// flickr-justified-gallery
|
},
|
||||||
flickr_justified_gallery_js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
|
canvas_ribbon: {
|
||||||
flickr_justified_gallery_css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css',
|
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js',
|
||||||
|
local: '/js/lib/effect/canvas-ribbon.min.js'
|
||||||
// aplayer
|
},
|
||||||
aplayer_css: 'https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css',
|
canvas_fluttering_ribbon: {
|
||||||
aplayer_js: 'https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js',
|
||||||
meting_js: 'https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js',
|
local: '/js/lib/effect/canvas-fluttering-ribbon.min.js'
|
||||||
|
},
|
||||||
// Prism.js
|
canvas_nest: {
|
||||||
prismjs_js: 'https://cdn.jsdelivr.net/npm/prismjs/prism.min.js',
|
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js',
|
||||||
prismjs_lineNumber_js: 'https://cdn.jsdelivr.net/npm/prismjs/plugins/line-numbers/prism-line-numbers.min.js',
|
local: '/js/lib/effect/canvas-nest.min.js'
|
||||||
prismjs_autoloader: 'https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js'
|
},
|
||||||
|
activate_power_mode: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js',
|
||||||
|
local: '/js/lib/effect/activate-power-mode.min.js'
|
||||||
|
},
|
||||||
|
fireworks: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js',
|
||||||
|
local: '/js/lib/effect/fireworks.min.js'
|
||||||
|
},
|
||||||
|
click_heart: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js',
|
||||||
|
local: '/js/lib/effect/click-heart.min.js'
|
||||||
|
},
|
||||||
|
ClickShowText: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js',
|
||||||
|
local: '/js/lib/effect/click-show-text.min.js'
|
||||||
|
},
|
||||||
|
lazyload: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js',
|
||||||
|
local: '/js/lib/vanilla-lazyload/lazyload.iife.min.js'
|
||||||
|
},
|
||||||
|
instantpage: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/instant.page@5/instantpage.min.js',
|
||||||
|
local: '/js/lib/instant.page/instantpage.min.js'
|
||||||
|
},
|
||||||
|
typed: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js',
|
||||||
|
local: '/js/lib/typed.js/typed.min.js'
|
||||||
|
},
|
||||||
|
pangu: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js',
|
||||||
|
local: '/js/lib/pangu/pangu.min.js'
|
||||||
|
},
|
||||||
|
fancybox_css_v4: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css',
|
||||||
|
local: '/js/lib/fancyapps/fancybox.css'
|
||||||
|
},
|
||||||
|
fancybox_v4: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js',
|
||||||
|
local: '/js/lib/fancyapps/fancybox.umd.js'
|
||||||
|
},
|
||||||
|
medium_zoom: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js',
|
||||||
|
local: '/js/lib/medium-zoom/medium-zoom.min.js'
|
||||||
|
},
|
||||||
|
snackbar_css: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css',
|
||||||
|
local: '/js/lib/node-snackbar/snackbar.min.css'
|
||||||
|
},
|
||||||
|
snackbar: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js',
|
||||||
|
local: '/js/lib/node-snackbar/snackbar.min.js'
|
||||||
|
},
|
||||||
|
fontawesomeV6: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css',
|
||||||
|
local: '/js/lib/fontawesome-free/dist/all.min.css'
|
||||||
|
},
|
||||||
|
flickr_justified_gallery_js: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
|
||||||
|
local: '/js/lib/flickr-justified-gallery/fjGallery.min.js'
|
||||||
|
},
|
||||||
|
flickr_justified_gallery_css: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css',
|
||||||
|
local: '/js/lib/flickr-justified-gallery/fjGallery.min.css'
|
||||||
|
},
|
||||||
|
aplayer_css: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/aplayer@1/dist/APlayer.min.css',
|
||||||
|
local: '/js/lib/aplayer/APlayer.min.css'
|
||||||
|
},
|
||||||
|
aplayer_js: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/aplayer@1/dist/APlayer.min.js',
|
||||||
|
local: '/js/lib/aplayer/APlayer.min.js'
|
||||||
|
},
|
||||||
|
meting_js: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js',
|
||||||
|
local: '/js/lib/aplayer/Meting.min.js'
|
||||||
|
},
|
||||||
|
prismjs_js: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/prismjs@1/prism.min.js',
|
||||||
|
local: '/js/lib/prismjs/prism.min.js'
|
||||||
|
},
|
||||||
|
prismjs_lineNumber_js: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/prismjs@1/plugins/line-numbers/prism-line-numbers.min.js',
|
||||||
|
local: '/js/lib/prismjs/prism-line-numbers.min.js'
|
||||||
|
},
|
||||||
|
prismjs_autoloader: {
|
||||||
|
cdn: 'https://cdn.jsdelivr.net/npm/prismjs@1/plugins/autoloader/prism-autoloader.min.js',
|
||||||
|
local: '/js/lib/prismjs/prism-autoloader.min.js'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete null value
|
// delete null value
|
||||||
const deleteNullValue = obj => {
|
const deleteNullValue = obj => {
|
||||||
|
if (!obj) return
|
||||||
for (const i in obj) {
|
for (const i in obj) {
|
||||||
obj[i] === null && delete obj[i]
|
obj[i] === null && delete obj[i]
|
||||||
}
|
}
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
themeConfig.CDN = Object.assign(defaultCDN, deleteNullValue(themeConfig.CDN))
|
const defaultVal = (obj, choose) => {
|
||||||
|
const str = choose === 'local' ? 'local' : 'cdn'
|
||||||
|
|
||||||
|
for (const i in obj) {
|
||||||
|
obj[i] = obj[i][str]
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
themeConfig.asset = Object.assign(defaultVal(internalData, CDN.internal_provider),
|
||||||
|
defaultVal(data, CDN.third_party_provider), deleteNullValue(CDN.option))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Capitalize the first letter of comment name
|
* Capitalize the first letter of comment name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let { use } = themeConfig.comments
|
let { use } = comments
|
||||||
|
|
||||||
if (!use) return
|
if (!use) return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user