mirror of
https://github.com/simon987/sist2.git
synced 2025-04-10 14:06:45 +00:00
Add preloader (UI Tweak)
This commit is contained in:
parent
85ab2858f6
commit
7be6234f0d
File diff suppressed because one or more lines are too long
@ -1,4 +1,9 @@
|
||||
body {overflow-y:scroll;}
|
||||
|
||||
.progress {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
@ -242,6 +242,17 @@ function createDocCard(hit) {
|
||||
return docCard;
|
||||
}
|
||||
|
||||
function makePreloader() {
|
||||
const elem = document.createElement("div");
|
||||
elem.setAttribute("class", "progress");
|
||||
const bar = document.createElement("div");
|
||||
bar.setAttribute("class", "progress-bar progress-bar-striped progress-bar-animated");
|
||||
bar.setAttribute("style", "width: 100%");
|
||||
elem.appendChild(bar);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function makePageIndicator(searchResult) {
|
||||
let pageIndicator = document.createElement("div");
|
||||
pageIndicator.setAttribute("class", "page-indicator shadow-sm bg-light font-weight-light");
|
||||
|
@ -193,12 +193,16 @@ function search() {
|
||||
return;
|
||||
}
|
||||
searchBusy = true;
|
||||
|
||||
//Clear old search results
|
||||
let searchResults = document.getElementById("searchResults");
|
||||
while (searchResults.firstChild) {
|
||||
searchResults.removeChild(searchResults.firstChild);
|
||||
}
|
||||
|
||||
const preload = makePreloader();
|
||||
searchResults.appendChild(preload);
|
||||
|
||||
let query = searchBar.value;
|
||||
let condition = $("#barToggle").prop("checked") ? "must" : "should";
|
||||
let filters = [
|
||||
@ -257,6 +261,7 @@ function search() {
|
||||
}).then(searchResult => {
|
||||
scroll_id = searchResult["_scroll_id"];
|
||||
|
||||
preload.remove();
|
||||
//Search stats
|
||||
searchResults.appendChild(makeStatsCard(searchResult));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user