mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-08-03 10:16:03 -04:00

The greenish taskbar placeholder is gone. The appearance of the old taskbar is restored. However the taskbar currently contains only the library button (but the latter leads to the currently blank welcome page).
106 lines
4.3 KiB
HTML
106 lines
4.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>ZIM Viewer</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link type="text/css" href="./skin/taskbar.css?KIWIXCACHEID" rel="Stylesheet" />
|
|
<link type="text/css" href="./skin/css/autoComplete.css?KIWIXCACHEID" rel="Stylesheet" />
|
|
<script type="text/javascript" src="./skin/viewer_taskbar.js?KIWIXCACHEID" defer></script>
|
|
<script type="text/javascript" src="./skin/autoComplete.min.js?KIWIXCACHEID"></script>
|
|
</head>
|
|
|
|
<body style="margin:0" onload="handle_visual_viewport_change()">
|
|
<span class="kiwix">
|
|
<span id="kiwixtoolbar" class="ui-widget-header">
|
|
<div class="kiwix_centered">
|
|
<!--
|
|
<div class="kiwix_searchform">
|
|
<form class="kiwixsearch" method="GET" action="{{root}}/search" id="kiwixsearchform">
|
|
{{#hascontent}}<input type="hidden" name="content" value="{{content}}" />{{/hascontent}}
|
|
<label for="kiwixsearchbox">🔍</label>
|
|
<input autocomplete="off" class="ui-autocomplete-input" id="kiwixsearchbox" name="pattern" type="text" title="Search '{{title}}'" aria-label="Search '{{title}}'">
|
|
</form>
|
|
</div>
|
|
-->
|
|
<input type="checkbox" id="kiwix_button_show_toggle">
|
|
<label for="kiwix_button_show_toggle"><img src="./skin/caret.png?KIWIXCACHEID" alt=""></label>
|
|
<div class="kiwix_button_cont">
|
|
<a id="kiwix_serve_taskbar_library_button" title="Go to welcome page" aria-label="Go to welcome page" href="#"><button>🏠</button></a>
|
|
<!--
|
|
{{#hascontent}}
|
|
<a id="kiwix_serve_taskbar_home_button" title="Go to the main page of '{{title}}'" aria-label="Go to the main page of '{{title}}'" href="{{root}}/{{content}}/"><button>{{title}}</button></a>
|
|
<a id="kiwix_serve_taskbar_random_button" title="Go to a randomly selected page" aria-label="Go to a randomly selected page"
|
|
href="{{root}}/random?content={{#urlencoded}}{{{content}}}{{/urlencoded}}"><button>🎲</button></a>
|
|
{{/hascontent}}
|
|
-->
|
|
</div>
|
|
</div>
|
|
</span>
|
|
</span>
|
|
|
|
<iframe id="content_iframe"
|
|
referrerpolicy="same-origin"
|
|
onload="handle_content_url_change()"
|
|
src="skin/blank.html" title="ZIM content" width="100%"
|
|
style="border:0px">
|
|
</iframe>
|
|
|
|
<script>
|
|
|
|
// Terminology
|
|
//
|
|
// user url: identifier of the page that has to be displayed in the viewer
|
|
// and that is used as the hash component of the viewer URL. For
|
|
// book resources the address url is {book}/{resource} .
|
|
//
|
|
// iframe url: the URL to be loaded in the viewer iframe.
|
|
|
|
function userUrl2IframeUrl(url) {
|
|
if ( url == '' ) {
|
|
return '/skin/blank.html';
|
|
}
|
|
|
|
return `/content/${url}`;
|
|
}
|
|
|
|
function iframeUrl2UserUrl(url) {
|
|
if ( url == '/skin/blank.html' ) {
|
|
return '';
|
|
}
|
|
|
|
return url.split('/').slice(2).join('/');
|
|
}
|
|
|
|
const cf = document.getElementById('content_iframe');
|
|
|
|
function handle_visual_viewport_change() {
|
|
cf.height = window.visualViewport.height - cf.offsetTop - 4;
|
|
}
|
|
window.onresize = handle_visual_viewport_change;
|
|
|
|
function handle_location_hash_change() {
|
|
const hash = window.location.hash;
|
|
const iframeContentUrl = userUrl2IframeUrl(hash.slice(1));
|
|
console.log("handle_location_hash_change: " + hash);
|
|
if ( iframeContentUrl != cf.contentWindow.location.pathname ) {
|
|
cf.contentWindow.location.replace(iframeContentUrl);
|
|
}
|
|
}
|
|
|
|
window.onhashchange = handle_location_hash_change;
|
|
handle_location_hash_change();
|
|
|
|
function handle_content_url_change() {
|
|
document.title = cf.contentDocument.title;
|
|
const iframeContentUrl = cf.contentWindow.location.pathname;
|
|
console.log('handle_content_url_change: ' + iframeContentUrl);
|
|
const newHash = '#' + iframeUrl2UserUrl(iframeContentUrl);
|
|
const viewerURL = location.origin + location.pathname + location.search;
|
|
window.location.replace(viewerURL + newHash);
|
|
};
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|