mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
67 lines
1.9 KiB
Plaintext
67 lines
1.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){
|
|
var defaultEncoding;
|
|
translate = JSON.stringify({
|
|
defaultEncoding: theme.translate.defaultEncoding,
|
|
translateDelay: theme.translate.translateDelay,
|
|
cookieDomain: theme.translate.cookieDomain,
|
|
msgToTraditionalChinese: theme.translate.msgToTraditionalChinese,
|
|
msgToSimplifiedChinese: theme.translate.msgToSimplifiedChinese
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
script.
|
|
var GLOBAL_CONFIG = {
|
|
root: '!{config.root}',
|
|
algolia: !{algolia},
|
|
localSearch: !{localSearch},
|
|
translate: !{translate},
|
|
highlight_copy: '!{theme.highlight_copy}',
|
|
copy: {
|
|
success: '!{_p("copy.success")}',
|
|
error: '!{_p("copy.error")}',
|
|
noSupport: '!{_p("copy.noSupport")}'
|
|
},
|
|
bookmark: {
|
|
title: '!{_p("bookmark.title")}',
|
|
message_prev: '!{_p("bookmark.message_prev")}',
|
|
message_next: '!{_p("bookmark.message_next")}'
|
|
},
|
|
runtime_unit: '!{_p("runtime_unit")}'
|
|
|
|
|
|
}
|
|
|