mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
124 lines
3.9 KiB
Plaintext
124 lines
3.9 KiB
Plaintext
-
|
|
var algolia = 'undefined';
|
|
var env = process.env;
|
|
if (theme.algolia_search.enable) {
|
|
algolia = JSON.stringify({
|
|
appId: env.ALGOLIA_APP_ID || config.algolia.appId || config.algolia.applicationID,
|
|
apiKey: env.ALGOLIA_API_KEY || config.algolia.apiKey,
|
|
indexName: env.ALGOLIA_INDEX_NAME || config.algolia.indexName,
|
|
hits: theme.algolia_search.hits,
|
|
// search languages
|
|
languages: {
|
|
input_placeholder: _p("algolia_search.input_placeholder"),
|
|
hits_empty: _p("algolia_search.hits_empty"),
|
|
hits_stats: _p("algolia_search.hits_stats")
|
|
}
|
|
})
|
|
}
|
|
|
|
var localSearch = 'undefined';
|
|
if (theme.local_search && theme.local_search.enable) {
|
|
localSearch = JSON.stringify({
|
|
path: config.search.path,
|
|
languages: {
|
|
// search languages
|
|
hits_empty: _p("local_search.hits_empty")
|
|
}
|
|
})
|
|
}
|
|
var translate = 'undefined';
|
|
if (theme.translate && theme.translate.enable){
|
|
translate = JSON.stringify({
|
|
defaultEncoding: theme.translate.defaultEncoding,
|
|
translateDelay: theme.translate.translateDelay,
|
|
msgToTraditionalChinese: theme.translate.msgToTraditionalChinese,
|
|
msgToSimplifiedChinese: theme.translate.msgToSimplifiedChinese
|
|
})
|
|
}
|
|
|
|
var copyright = 'undefined';
|
|
if (theme.copy.enable && theme.copy.copyright.enable){
|
|
copyright = JSON.stringify({
|
|
limitCount: theme.copy.copyright.limit_count,
|
|
languages: {
|
|
author: _p("copy_copyright.author") + ': ' + config.author,
|
|
link: _p("copy_copyright.link") + ': ',
|
|
source: _p("copy_copyright.source") + ': ' + config.title,
|
|
info: _p("copy_copyright.info")
|
|
}
|
|
})
|
|
}
|
|
|
|
var ClickShowText = 'undefined';
|
|
if (theme.ClickShowText && theme.ClickShowText.enable) {
|
|
ClickShowText = JSON.stringify({
|
|
text: theme.ClickShowText.text.join(","),
|
|
fontSize: theme.ClickShowText.fontSize
|
|
})
|
|
}
|
|
|
|
|
|
var Snackbar = 'undefined';
|
|
if (theme.snackbar && theme.snackbar.enable) {
|
|
Snackbar = JSON.stringify({
|
|
bookmark: {
|
|
message_prev: _p("Snackbar.bookmark.message_prev"),
|
|
message_next: _p("Snackbar.bookmark.message_next")
|
|
},
|
|
chs_to_cht: _p("Snackbar.chs_to_cht"),
|
|
cht_to_chs: _p("Snackbar.cht_to_chs"),
|
|
day_to_night: _p("Snackbar.day_to_night"),
|
|
night_to_day: _p("Snackbar.night_to_day"),
|
|
bgLight: theme.snackbar.bg_light,
|
|
bgDark: theme.snackbar.bg_dark,
|
|
position: theme.snackbar.position,
|
|
})
|
|
}
|
|
|
|
var noticeOutdate = 'undefined';
|
|
if (theme.noticeOutdate && theme.noticeOutdate.enable) {
|
|
noticeOutdate = JSON.stringify({
|
|
limitDay: theme.noticeOutdate.limit_day,
|
|
position: theme.noticeOutdate.position,
|
|
messagePrev: theme.noticeOutdate.message_prev,
|
|
messageNext: theme.noticeOutdate.message_next,
|
|
})
|
|
}
|
|
|
|
script.
|
|
var GLOBAL_CONFIG = {
|
|
root: '!{config.root}',
|
|
hexoversion: '!{get_hexo_version()}',
|
|
algolia: !{algolia},
|
|
localSearch: !{localSearch},
|
|
translate: !{translate},
|
|
noticeOutdate: !{noticeOutdate},
|
|
copy: {
|
|
success: '!{_p("copy.success")}',
|
|
error: '!{_p("copy.error")}',
|
|
noSupport: '!{_p("copy.noSupport")}'
|
|
},
|
|
bookmark: {
|
|
message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
|
|
message_next: '!{_p("Snackbar.bookmark.message_next")}'
|
|
},
|
|
runtime_unit: '!{_p("runtime_unit")}',
|
|
runtime: !{theme.runtimeshow.enable},
|
|
copyright: !{copyright},
|
|
ClickShowText: !{ClickShowText},
|
|
medium_zoom: !{theme.medium_zoom},
|
|
fancybox: !{theme.fancybox},
|
|
Snackbar: !{Snackbar},
|
|
justifiedGallery: {
|
|
js: '!{theme.CDN.justifiedGallery_js}',
|
|
css: '!{theme.CDN.justifiedGallery_css}'
|
|
},
|
|
baiduPush: !{theme.baidu_push},
|
|
highlightCopy: !{theme.highlight_copy},
|
|
highlightLang: !{theme.highlight_lang},
|
|
isPhotoFigcaption: !{theme.photofigcaption},
|
|
islazyload: !{theme.lazyload.enable},
|
|
isanchor: !{theme.anchor}
|
|
}
|
|
|