aboutsummaryrefslogtreecommitdiff
path: root/static/js/fixedsearch.ts
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-04-08 22:26:43 -0400
committertdro <tdro@noreply.example.com>2023-04-08 22:26:43 -0400
commit787b97a30f788957eb471f2ed3f08b66a405b092 (patch)
tree95f10e86ca44f5bea78c119753a8d09ad675fc0d /static/js/fixedsearch.ts
parentf0cbdec755e91fc3f02e96b03e1fc200b135815e (diff)
downloadcanory-787b97a30f788957eb471f2ed3f08b66a405b092.tar.gz
canory-787b97a30f788957eb471f2ed3f08b66a405b092.tar.bz2
canory-787b97a30f788957eb471f2ed3f08b66a405b092.zip
static/js: Babel fish
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;
}
});