mirror of https://github.com/kiwix/libkiwix.git
Respecting the --nosearchbar option of kiwix-serve
If `kiwix-serve` is run with the `--nosearchbar` option the toolbar is disabled (hidden) in its viewer. Note however that certain actions performed by the viewer merely with the purpose of keeping the toolbar up-to-date are still carried out.
This commit is contained in:
parent
4e06bb6a08
commit
cac2d212c6
|
@ -723,6 +723,7 @@ std::unique_ptr<Response> InternalServer::handle_viewer_settings(const RequestCo
|
||||||
}
|
}
|
||||||
|
|
||||||
const kainjow::mustache::object data{
|
const kainjow::mustache::object data{
|
||||||
|
{"enable_toolbar", m_withTaskbar ? "true" : "false" },
|
||||||
{"enable_link_blocking", m_blockExternalLinks ? "true" : "false" },
|
{"enable_link_blocking", m_blockExternalLinks ? "true" : "false" },
|
||||||
{"enable_library_button", m_withLibraryButton ? "true" : "false" }
|
{"enable_library_button", m_withLibraryButton ? "true" : "false" }
|
||||||
};
|
};
|
||||||
|
|
|
@ -384,12 +384,18 @@ function setupSuggestions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupViewer() {
|
function setupViewer() {
|
||||||
|
setInterval(handle_visual_viewport_change, 0);
|
||||||
|
|
||||||
|
const kiwixToolBarWrapper = document.getElementById('kiwixtoolbarwrapper');
|
||||||
|
if ( ! viewerSettings.toolbarEnabled ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kiwixToolBarWrapper.style.display = 'block';
|
||||||
if ( ! viewerSettings.libraryButtonEnabled ) {
|
if ( ! viewerSettings.libraryButtonEnabled ) {
|
||||||
document.getElementById("kiwix_serve_taskbar_library_button").remove();
|
document.getElementById("kiwix_serve_taskbar_library_button").remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_visual_viewport_change();
|
|
||||||
|
|
||||||
setupSuggestions();
|
setupSuggestions();
|
||||||
|
|
||||||
// cybook hack
|
// cybook hack
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const viewerSettings = {
|
const viewerSettings = {
|
||||||
|
toolbarEnabled: {{enable_toolbar}},
|
||||||
linkBlockingEnabled: {{enable_link_blocking}},
|
linkBlockingEnabled: {{enable_link_blocking}},
|
||||||
libraryButtonEnabled: {{enable_library_button}}
|
libraryButtonEnabled: {{enable_library_button}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="margin:0" onload="setupViewer()">
|
<body style="margin:0" onload="setupViewer()">
|
||||||
<div class="kiwix">
|
<div class="kiwix" style="display:none" id="kiwixtoolbarwrapper">
|
||||||
<div id="kiwixtoolbar" class="ui-widget-header">
|
<div id="kiwixtoolbar" class="ui-widget-header">
|
||||||
<div class="kiwix_centered">
|
<div class="kiwix_centered">
|
||||||
<div class="kiwix_searchform">
|
<div class="kiwix_searchform">
|
||||||
|
|
Loading…
Reference in New Issue