mirror of https://github.com/kiwix/libkiwix.git
Check if bookName is available in url parameters
In certain pages like the search result page, bookName is not of the form `/bookName/endpoint?parameters`. Rather it is available as a query parameter. From these pages bookName should be assigned from parameters.
This commit is contained in:
parent
3c7faddb6e
commit
c236f3a32b
|
@ -7,7 +7,10 @@ const jq = jQuery.noConflict(true);
|
|||
jq(document).ready(() => {
|
||||
(function ($) {
|
||||
const root = $( `link[type='root']` ).attr("href");
|
||||
const bookName = window.location.pathname.split(`${root}/`)[1].split('/')[0];
|
||||
|
||||
const bookName = (window.location.pathname == `${root}/search`)
|
||||
? (new URLSearchParams(window.location.search)).get('content')
|
||||
: window.location.pathname.split(`${root}/`)[1].split('/')[0];
|
||||
|
||||
$( "#kiwixsearchbox" ).autocomplete({
|
||||
|
||||
|
|
Loading…
Reference in New Issue