Fixes to search, local-file-tweaks, test ajax-navigation, update Buttons, add offline.zip packaging

This commit is contained in:
2024-08-31 00:58:33 +02:00
parent 745267cf49
commit 89134ffb37
25 changed files with 199 additions and 85 deletions

View File

@ -1,15 +1,28 @@
(function(){
if (location.protocol !== 'file:') {
window.PatchLocalFileAnchor = Void;
return;
}
window.addEventListener('load', (function(){
Array.from(document.querySelectorAll('a[href]')).forEach(function(linkEl){
if (linkEl.href.startsWith('file://') && linkEl.href.endsWith('/')) {
linkEl.href += 'index.html';
window.PatchLocalFileAnchor = (function PatchLocalFileAnchor (anchorEl) {
var href = anchorEl.href;
if (href.startsWith('file://')) {
var tokens = href.split('#');
href = tokens[0];
if (href.endsWith('/')) {
href += 'index.html';
}
});
tokens = tokens.slice(1);
if (tokens.length) {
href += ('#' + tokens.join('#'));
}
anchorEl.href = href;
}
});
window.addEventListener('DOMContentLoaded', (function(){
Array.from(document.querySelectorAll('a[href]')).forEach(PatchLocalFileAnchor);
}));
})();