add theme
This commit is contained in:
22
themes/butterfly/layout/includes/third-party/search/algolia.pug
vendored
Normal file
22
themes/butterfly/layout/includes/third-party/search/algolia.pug
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
#algolia-search
|
||||
.search-dialog
|
||||
nav.search-nav
|
||||
span.search-dialog-title= _p('search.title')
|
||||
button.search-close-button
|
||||
i.fas.fa-times
|
||||
|
||||
.search-wrap
|
||||
#algolia-search-input
|
||||
hr
|
||||
#algolia-search-results
|
||||
#algolia-hits
|
||||
#algolia-pagination
|
||||
#algolia-info
|
||||
.algolia-stats
|
||||
.algolia-poweredBy
|
||||
|
||||
#search-mask
|
||||
|
||||
script(src=url_for(theme.asset.algolia_search))
|
||||
script(src=url_for(theme.asset.instantsearch))
|
||||
script(src=url_for(theme.asset.algolia_js))
|
||||
29
themes/butterfly/layout/includes/third-party/search/docsearch.pug
vendored
Normal file
29
themes/butterfly/layout/includes/third-party/search/docsearch.pug
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
- const { placeholder, docsearch: { appId, apiKey, indexName, option } } = theme.search
|
||||
|
||||
.docsearch-wrap
|
||||
#docsearch(style="display:none")
|
||||
link(rel="stylesheet" href=url_for(theme.asset.docsearch_css))
|
||||
script(src=url_for(theme.asset.docsearch_js))
|
||||
script.
|
||||
(() => {
|
||||
docsearch(Object.assign({
|
||||
appId: '!{appId}',
|
||||
apiKey: '!{apiKey}',
|
||||
indexName: '!{indexName}',
|
||||
container: '#docsearch',
|
||||
placeholder: '!{ placeholder || _p("search.input_placeholder")}',
|
||||
}, !{JSON.stringify(option)}))
|
||||
|
||||
const handleClick = () => {
|
||||
document.querySelector('.DocSearch-Button').click()
|
||||
}
|
||||
|
||||
const searchClickFn = () => {
|
||||
btf.addEventListenerPjax(document.querySelector('#search-button > .search'), 'click', handleClick)
|
||||
}
|
||||
|
||||
searchClickFn()
|
||||
window.addEventListener('pjax:complete', searchClickFn)
|
||||
})()
|
||||
|
||||
|
||||
7
themes/butterfly/layout/includes/third-party/search/index.pug
vendored
Normal file
7
themes/butterfly/layout/includes/third-party/search/index.pug
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
case theme.search.use
|
||||
when 'algolia_search'
|
||||
include ./algolia.pug
|
||||
when 'local_search'
|
||||
include ./local-search.pug
|
||||
when 'docsearch'
|
||||
include ./docsearch.pug
|
||||
22
themes/butterfly/layout/includes/third-party/search/local-search.pug
vendored
Normal file
22
themes/butterfly/layout/includes/third-party/search/local-search.pug
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
#local-search
|
||||
.search-dialog
|
||||
nav.search-nav
|
||||
span.search-dialog-title= _p('search.title')
|
||||
span#loading-status
|
||||
button.search-close-button
|
||||
i.fas.fa-times
|
||||
|
||||
#loading-database.text-center
|
||||
i.fas.fa-spinner.fa-pulse
|
||||
span= ' ' + _p("search.load_data")
|
||||
|
||||
.search-wrap
|
||||
#local-search-input
|
||||
.local-search-box
|
||||
input(placeholder=theme.search.placeholder || _p("search.input_placeholder") type="text").local-search-box--input
|
||||
hr
|
||||
#local-search-results
|
||||
#local-search-stats-wrap
|
||||
#search-mask
|
||||
|
||||
script(src=url_for(theme.asset.local_search))
|
||||
Reference in New Issue
Block a user