Change function results and relative locations of JavaScript files

This commit is contained in:
Ethan Yoo 2022-12-29 10:28:20 -05:00
parent 0ee02bbe37
commit 0fe00bf114
Signed by: ethan
GPG Key ID: 70596474C5D20F85
1 changed files with 7 additions and 11 deletions

View File

@ -1,4 +1,4 @@
// static/scripts/fixedsearch/fixedsearch.js
// js/fixedsearch.js
/*--------------------------------------------------------------
fixedsearch Super fast, client side search for Hugo.io with Fusejs.io
based on https://gist.github.com/cmod/5410eae147e4318164258742dd053993
@ -173,10 +173,10 @@ fixedsearch = function(){
--------------------------------------------------------------*/
function search_init() {
if (first_run) {
load_script(window.location.origin + '/scripts/fixedsearch/fuse.js').then(() => {
load_script(window.location.origin + '/js/fuse.js').then(() => {
search_input.value = ""; // reset default value
first_run = false; // let's never do this again
fetch_JSON(search_form.getAttribute('data-language-prefix') + '/index.json', function(data){
fetch_JSON('/index.json', function(data){
var options = { // fuse.js options; check fuse.js website for details
shouldSort: true,
location: 0,
@ -187,9 +187,7 @@ fixedsearch = function(){
'permalink',
'title',
'date',
'summary',
'section',
'categories',
'description',
'tags'
]
};
@ -223,9 +221,7 @@ fixedsearch = function(){
`<li><a href="${results[item].item.permalink}" tabindex="0">
<span class="title">${results[item].item.title}</span>
<span class="date">${results[item].item.date}</span>
<span class="summary">${results[item].item.summary}</span>
<span class="section">${results[item].item.section}</span>
<span class="categories">${results[item].item.categories.join(', ')}</span>
<span class="description">${results[item].item.description}</span>
<span class="tags">${results[item].item.tags.join(', ')}</span>
</a></li>`;
}