mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2026-05-07 11:35:26 +08:00
1357
docs/assets/css/search-askai.min.css
vendored
Normal file
1357
docs/assets/css/search-askai.min.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -59,10 +59,36 @@ function getAlgoliaSearchConfig() {
|
||||
placeholder: AlgoliaI18nData[lang].placeholder,
|
||||
attributes: {
|
||||
primaryText: 'title',
|
||||
secondaryText: 'description',
|
||||
tertiaryText: 'itunesAuthor',
|
||||
secondaryText: 'content',
|
||||
url: 'url',
|
||||
image: 'imageUrl',
|
||||
},
|
||||
transformItems: (items) => {
|
||||
let result
|
||||
if (lang === 'zh-Hant') {
|
||||
result = items.filter((item) => item.url.includes('/zh-Hant/'))
|
||||
} else if (lang === 'en') {
|
||||
result = items.filter((item) => item.url.includes('/en/'))
|
||||
} else {
|
||||
result = items.filter((item) => !item.url.includes('/en/') && !item.url.includes('/zh-Hant/'))
|
||||
}
|
||||
return result.map((item) => {
|
||||
const type = item.type
|
||||
const hlEntry = (type && item._highlightResult?.hierarchy?.[type]) || item._highlightResult?.hierarchy?.lvl2 || item._highlightResult?.hierarchy?.lvl1 || item._highlightResult?.hierarchy?.lvl0
|
||||
const plainText = (type && item.hierarchy?.[type]) || item.hierarchy?.lvl2 || item.hierarchy?.lvl1 || item.hierarchy?.lvl0 || ''
|
||||
const aisValue = hlEntry ? hlEntry.value.replace(/<span class="algolia-docsearch-suggestion--highlight">(.*?)<\/span>/g, '__ais-highlight__$1__/ais-highlight__') : plainText
|
||||
return {
|
||||
...item,
|
||||
title: plainText,
|
||||
_highlightResult: {
|
||||
...item._highlightResult,
|
||||
title: {
|
||||
value: aisValue,
|
||||
matchLevel: hlEntry?.matchLevel || 'none',
|
||||
matchedWords: hlEntry?.matchedWords || [],
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
insights: false,
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ extra_javascript:
|
||||
- assets/js/components/mirrors-table/index.js
|
||||
extra_css:
|
||||
- https://unpkg.com/tdesign-vue-next/dist/tdesign.min.css
|
||||
- https://unpkg.com/@algolia/sitesearch@latest/dist/search-askai.min.css
|
||||
- assets/css/search-askai.min.css
|
||||
- stylesheets/extra.css
|
||||
|
||||
theme:
|
||||
|
||||
Reference in New Issue
Block a user