diff --git a/static/skin/index.js b/static/skin/index.js index c33c47d9..a6bcdd74 100644 --- a/static/skin/index.js +++ b/static/skin/index.js @@ -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 reset filter?`; + 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 reset filter?`; - 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) { diff --git a/test/server.cpp b/test/server.cpp index a0c22362..145f5922 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -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"); - + )EXPECTEDRESULT" }, {