update theme
This commit is contained in:
parent
fc43dba964
commit
93fea0ed81
183 changed files with 6015 additions and 6241 deletions
|
@ -13,8 +13,8 @@ var indexed = false;
|
|||
var hasResults = false;
|
||||
|
||||
// Listen for events
|
||||
showButton? showButton.addEventListener("click", displaySearch) : null;
|
||||
showButtonMobile? showButtonMobile.addEventListener("click", displaySearch) : null;
|
||||
showButton ? showButton.addEventListener("click", displaySearch) : null;
|
||||
showButtonMobile ? showButtonMobile.addEventListener("click", displaySearch) : null;
|
||||
hideButton.addEventListener("click", hideSearch);
|
||||
wrapper.addEventListener("click", hideSearch);
|
||||
modal.addEventListener("click", function (event) {
|
||||
|
@ -25,7 +25,11 @@ modal.addEventListener("click", function (event) {
|
|||
document.addEventListener("keydown", function (event) {
|
||||
// Forward slash to open search wrapper
|
||||
if (event.key == "/") {
|
||||
if (!searchVisible) {
|
||||
const active = document.activeElement;
|
||||
const tag = active.tagName;
|
||||
const isInputField = tag === "INPUT" || tag === "TEXTAREA" || active.isContentEditable;
|
||||
|
||||
if (!searchVisible && !isInputField) {
|
||||
event.preventDefault();
|
||||
displaySearch();
|
||||
}
|
||||
|
@ -75,7 +79,6 @@ document.addEventListener("keydown", function (event) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Update search on each keypress
|
||||
|
@ -122,7 +125,7 @@ function fetchJSON(path, callback) {
|
|||
|
||||
function buildIndex() {
|
||||
var baseURL = wrapper.getAttribute("data-url");
|
||||
baseURL = baseURL.replace(/\/?$/, '/');
|
||||
baseURL = baseURL.replace(/\/?$/, "/");
|
||||
fetchJSON(baseURL + "index.json", function (data) {
|
||||
var options = {
|
||||
shouldSort: true,
|
||||
|
@ -153,13 +156,19 @@ function executeQuery(term) {
|
|||
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (value, key) {
|
||||
console.log(value.item.summary);
|
||||
var html = value.item.summary;
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = html;
|
||||
value.item.summary = div.textContent || div.innerText || "";
|
||||
var title = value.item.externalUrl? value.item.title + '<span class="text-xs ml-2 align-center cursor-default text-neutral-400 dark:text-neutral-500">'+value.item.externalUrl+'</span>' : value.item.title;
|
||||
var linkconfig = value.item.externalUrl? 'target="_blank" rel="noopener" href="'+value.item.externalUrl+'"' : 'href="'+value.item.permalink+'"';
|
||||
var title = value.item.externalUrl
|
||||
? value.item.title +
|
||||
'<span class="text-xs ml-2 align-center cursor-default text-neutral-400 dark:text-neutral-500">' +
|
||||
value.item.externalUrl +
|
||||
"</span>"
|
||||
: value.item.title;
|
||||
var linkconfig = value.item.externalUrl
|
||||
? 'target="_blank" rel="noopener" href="' + value.item.externalUrl + '"'
|
||||
: 'href="' + value.item.permalink + '"';
|
||||
resultsHTML =
|
||||
resultsHTML +
|
||||
`<li class="mb-2">
|
||||
|
@ -169,7 +178,7 @@ function executeQuery(term) {
|
|||
<div class="-mb-1 text-lg font-bold">
|
||||
${title}
|
||||
</div>
|
||||
<div class="text-sm text-neutral-500 dark:text-neutral-400">${value.item.section}<span class="px-2 text-primary-500">·</span>${value.item.date? value.item.date : ""}</span></div>
|
||||
<div class="text-sm text-neutral-500 dark:text-neutral-400">${value.item.section}<span class="px-2 text-primary-500">·</span>${value.item.date ? value.item.date : ""}</span></div>
|
||||
<div class="text-sm italic">${value.item.summary}</div>
|
||||
</div>
|
||||
<div class="ml-2 ltr:block rtl:hidden text-neutral-500">→</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue