From c236f3a32be45c0f0aa0decbf2a1d6aac99e5d52 Mon Sep 17 00:00:00 2001 From: Maneesh P M Date: Mon, 17 May 2021 12:10:46 +0530 Subject: [PATCH] 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. --- static/skin/taskbar.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/skin/taskbar.js b/static/skin/taskbar.js index 448b6faf8..df91cfadf 100644 --- a/static/skin/taskbar.js +++ b/static/skin/taskbar.js @@ -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({ @@ -85,4 +88,4 @@ jq(document).ready(() => { } }); })(jq); -}) \ No newline at end of file +})