mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2025-10-09 10:11:14 +00:00
Updated from upstream https://github.com/koirand/pulp
This commit is contained in:
commit
d63dee8bf4
10 changed files with 61 additions and 29 deletions
|
@ -16,15 +16,6 @@ const bigramTokeniser = (obj, metadata) => {
|
|||
return []
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map((t) => {
|
||||
return new lunr.Token(
|
||||
lunr.utils.asString(t).toLowerCase(),
|
||||
lunr.utils.clone(metadata)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
let str = obj.toString().trim().toLowerCase()
|
||||
let tokens = []
|
||||
|
||||
|
@ -70,6 +61,7 @@ const initLunr = () => {
|
|||
builder.pipeline.reset()
|
||||
builder.ref('ref')
|
||||
builder.field('title', { boost: 10 })
|
||||
builder.field('tags', { boost: 10 })
|
||||
builder.field('body')
|
||||
builder.metadataWhitelist = ['position']
|
||||
for (let page of pagesIndex) {
|
||||
|
@ -112,11 +104,12 @@ const initUI = () => {
|
|||
const query = $(event.currentTarget).val()
|
||||
|
||||
// Icon switching
|
||||
const iconUrl = $('#searchBoxIcon').attr('src')
|
||||
if (query.length) {
|
||||
$('#searchBoxIcon').attr('src', '../img/clear.png')
|
||||
$('#searchBoxIcon').attr('src', iconUrl.replace('search.png', 'clear.png'))
|
||||
$('#searchBoxIcon').css('cursor', 'pointer')
|
||||
} else {
|
||||
$('#searchBoxIcon').attr('src', '../img/search.png')
|
||||
$('#searchBoxIcon').attr('src', iconUrl.replace('clear.png', 'search.png'))
|
||||
$('#searchBoxIcon').css('cursor', 'default')
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue