init...
This commit is contained in:
21
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/algolia.pug
vendored
Normal file
21
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/algolia.pug
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
#algolia-search
|
||||
.search-dialog
|
||||
nav.search-nav
|
||||
span.search-dialog-title= _p('search.title')
|
||||
button.search-close-button
|
||||
i.anzhiyufont.anzhiyu-icon-xmark
|
||||
|
||||
.search-wrap
|
||||
#algolia-search-input
|
||||
hr
|
||||
#algolia-search-results
|
||||
#algolia-hits
|
||||
if theme.algolia_search.enable && theme.algolia_search.tags
|
||||
each item, index in theme.algolia_search.tags
|
||||
a.tag-list(href=url_for("/tags/" + item), title=item)=item
|
||||
#algolia-pagination
|
||||
#algolia-info
|
||||
.algolia-stats
|
||||
.algolia-poweredBy
|
||||
|
||||
#search-mask
|
||||
26
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/docsearch.pug
vendored
Normal file
26
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/docsearch.pug
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
- const { appId, apiKey, indexName, option } = theme.docsearch
|
||||
|
||||
.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',
|
||||
}, !{JSON.stringify(option)}))
|
||||
|
||||
const handleClick = () => {
|
||||
document.querySelector('.DocSearch-Button').click()
|
||||
}
|
||||
|
||||
const searchClickFn = () => {
|
||||
anzhiyu.addEventListenerPjax(document.querySelector('#search-button > .search'), 'click', handleClick)
|
||||
}
|
||||
|
||||
searchClickFn()
|
||||
window.addEventListener('pjax:complete', searchClickFn)
|
||||
})()
|
||||
6
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/index.pug
vendored
Normal file
6
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/index.pug
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
if theme.algolia_search.enable
|
||||
include ./algolia.pug
|
||||
else if theme.local_search.enable
|
||||
include ./local-search.pug
|
||||
else if theme.docsearch.enable
|
||||
include ./docsearch.pug
|
||||
20
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/local-search.pug
vendored
Normal file
20
themes/anzhiyu/hexo-theme-anzhiyu-main/layout/includes/third-party/search/local-search.pug
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
#local-search
|
||||
.search-dialog
|
||||
nav.search-nav
|
||||
span.search-dialog-title= _p('search.title')
|
||||
span#loading-status
|
||||
button.search-close-button
|
||||
i.anzhiyufont.anzhiyu-icon-xmark
|
||||
|
||||
#loading-database.is-center
|
||||
i.anzhiyufont.anzhiyu-icon-spinner.anzhiyu-pulse-icon
|
||||
span= ' ' + _p("search.load_data")
|
||||
|
||||
.search-wrap
|
||||
#local-search-input
|
||||
.local-search-box
|
||||
input(placeholder=_p("search.local_search.input_placeholder") type="text").local-search-box--input
|
||||
hr
|
||||
#local-search-results
|
||||
|
||||
#search-mask
|
||||
Reference in New Issue
Block a user