mirror of
https://gitlab.com/octtspacc/sitoctt
synced 2025-06-05 22:09:20 +02:00
Fixes to search, local-file-tweaks, test ajax-navigation, update Buttons, add offline.zip packaging
This commit is contained in:
@ -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);
|
||||
}));
|
||||
|
||||
})();
|
||||
|
Reference in New Issue
Block a user