viewer_taskbar.js + viewer.html = BFF

Foundation for never-ending friendship between viewer_taskbar.js and
viewer.html has been established by a slight change in how the book name
is obtained and commenting out the rest of the code.
This commit is contained in:
Veloman Yunkan 2022-03-20 15:55:42 +04:00
parent 58e45711ff
commit f41e71b2d7
1 changed files with 7 additions and 6 deletions

View File

@ -37,11 +37,12 @@ function setupAutoHidingOfTheToolbar() {
} }
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
const root = document.querySelector(`link[type='root']`).getAttribute("href"); const p = location.pathname;
const bookName = (window.location.pathname == `${root}/search`) const root = p.slice(0, p.length - '/viewer'.length);
? (new URLSearchParams(window.location.search)).get('content')
: window.location.pathname.split(`${root}/`)[1].split('/')[0];
const bookName = location.hash.slice(1).split('/')[0];
/*
const autoCompleteJS = new autoComplete( const autoCompleteJS = new autoComplete(
{ {
selector: "#kiwixsearchbox", selector: "#kiwixsearchbox",
@ -68,7 +69,7 @@ document.addEventListener('DOMContentLoaded', function () {
}, },
resultsList: { resultsList: {
noResults: true, noResults: true,
/* We must display 10 results (requested) + 1 potential link to do a full text search. */ // We must display 10 results (requested) + 1 potential link to do a full text search.
maxResults: 11, maxResults: 11,
}, },
resultItem: { resultItem: {
@ -118,5 +119,5 @@ document.addEventListener('DOMContentLoaded', function () {
if (document.body.clientWidth < 520) { if (document.body.clientWidth < 520) {
setupAutoHidingOfTheToolbar(); setupAutoHidingOfTheToolbar();
} }
*/
}); });