aboutsummaryrefslogtreecommitdiff
path: root/static/js/fixedsearch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/fixedsearch.ts')
-rw-r--r--static/js/fixedsearch.ts27
1 files changed, 11 insertions, 16 deletions
diff --git a/static/js/fixedsearch.ts b/static/js/fixedsearch.ts
index 938e1f5..b42a620 100644
--- a/static/js/fixedsearch.ts
+++ b/static/js/fixedsearch.ts
@@ -170,7 +170,7 @@
function initialize() {
if (firstRun) {
loadScript(window.location.origin + "/js/fuzzysort.js")
- .then(() => {
+ .then(function () {
firstRun = false;
fetchJson("/index.json", {});
@@ -185,7 +185,7 @@
});
search(query.value, data.items, options);
- }).catch((error) => {
+ }).catch(function (error) {
console.log("Error failed to load fuzzy sort: " + error);
});
}
@@ -204,18 +204,15 @@
if (results.length === 0 && term.length >= 0) {
let separator = "—";
if (term.length === 0) separator = "";
- items = `
- <li>
- <a href="javascript: void(0)" tabindex="0">${
- escape(term)
- } ${separator} No Results Found</a>
- </li>
- `;
+ items = '<li><a href="javascript: void(0)" tabindex="0">'.concat(
+ escape(term),
+ " ",
+ ).concat(separator, " No Results Found</a></li>");
dropdown.removeAttribute("hidden");
container.setAttribute("data-focus", "");
} else {
dropdown.removeAttribute("hidden");
- for (const string in results.slice(0, 10)) {
+ for (var string in results.slice(0, 10)) {
const title = results[string].obj.title;
let highlight = fuzzysort.highlight(
fuzzysort.single(escape(term), escape(title)),
@@ -228,14 +225,12 @@
}
items = items +
- `
- <li>
- <a href="${results[string].obj.url}" tabindex="0">${highlight}</a>
- </li>
- `;
+ '\n<li>\n<a href="'.concat(
+ results[string].obj.url,
+ '" tabindex="0">',
+ ).concat(highlight, "</a>\n</li>\n");
}
}
-
dropdown.innerHTML = items;
}
});