mirror of https://github.com/kiwix/libkiwix.git
Extract setNoResultsContent() from checkAndInjectEmptyMessage()
Extracted the code from the un-named function in setTimeout for easier understanding.
This commit is contained in:
parent
596b223a9d
commit
f034018b5c
|
@ -267,6 +267,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
function setNoResultsContent() {
|
||||
const kiwixHomeBody = document.querySelector('.kiwixHomeBody');
|
||||
const divTag = document.createElement('div');
|
||||
divTag.setAttribute('class', 'noResults');
|
||||
divTag.innerHTML = `No result. Would you like to <a href="?lang=">reset filter</a>?`;
|
||||
kiwixHomeBody.append(divTag);
|
||||
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
|
||||
loader.setAttribute('style', 'position: absolute; top: 50%');
|
||||
}
|
||||
|
||||
function checkAndInjectEmptyMessage() {
|
||||
const kiwixHomeBody = document.querySelector('.kiwixHomeBody');
|
||||
if (!bookOrderMap.size) {
|
||||
|
@ -274,14 +284,7 @@
|
|||
noResultInjected = true;
|
||||
iso.remove(document.getElementsByClassName('book__list')[0].getElementsByTagName('div'));
|
||||
iso.layout();
|
||||
setTimeout(() => {
|
||||
const divTag = document.createElement('div');
|
||||
divTag.setAttribute('class', 'noResults');
|
||||
divTag.innerHTML = `No result. Would you like to <a href="?lang=">reset filter</a>?`;
|
||||
kiwixHomeBody.append(divTag);
|
||||
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
|
||||
loader.setAttribute('style', 'position: absolute; top: 50%');
|
||||
}, 300);
|
||||
setTimeout(setNoResultsContent, 300);
|
||||
}
|
||||
return true;
|
||||
} else if (noResultInjected) {
|
||||
|
|
|
@ -184,7 +184,7 @@ R"EXPECTEDRESULT( src="/ROOT/skin/jquery-ui/external/jquery/jquery.js?cache
|
|||
src: url("/ROOT/skin/fonts/Roboto.ttf?cacheid=84d10248") format("truetype");
|
||||
<script src="/ROOT/skin/isotope.pkgd.min.js?cacheid=2e48d392" defer></script>
|
||||
<script src="/ROOT/skin/iso6391To3.js?cacheid=ecde2bb3"></script>
|
||||
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=1c67a5d3" defer></script>
|
||||
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=5f0f7683" defer></script>
|
||||
)EXPECTEDRESULT"
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue