Merge pull request #528 from kiwix/fix_suggestion_search_result_page

Check if bookName is available in url parameters
This commit is contained in:
Veloman Yunkan 2021-05-19 00:36:15 +04:00 committed by GitHub
commit fc7484ac86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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({