mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Handling of manual hash component change
This commit is contained in:
@ -35,9 +35,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cf = document.getElementById('content_iframe');
|
const cf = document.getElementById('content_iframe');
|
||||||
cf.src = userUrl2IframeUrl(window.location.hash.slice(1));
|
|
||||||
cf.height = window.visualViewport.height - cf.offsetTop - 4;
|
cf.height = window.visualViewport.height - cf.offsetTop - 4;
|
||||||
|
|
||||||
|
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.src = iframeContentUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onhashchange = handle_location_hash_change;
|
||||||
|
handle_location_hash_change();
|
||||||
|
|
||||||
function handle_content_url_change() {
|
function handle_content_url_change() {
|
||||||
document.title = cf.contentDocument.title;
|
document.title = cf.contentDocument.title;
|
||||||
const iframeContentUrl = cf.contentWindow.location.pathname;
|
const iframeContentUrl = cf.contentWindow.location.pathname;
|
||||||
|
Reference in New Issue
Block a user