mirror of
https://gitlab.com/octtspacc/sitoctt
synced 2025-06-05 22:09:20 +02:00
Nuova pagina sitoctt internals, Fix misti di pagine, Ristrutturazione file
This commit is contained in:
28
static/res/local-file-tweaks.js
Normal file
28
static/res/local-file-tweaks.js
Normal file
@ -0,0 +1,28 @@
|
||||
(function(){
|
||||
|
||||
if (location.protocol !== 'file:') {
|
||||
window.PatchLocalFileAnchor = Void;
|
||||
return;
|
||||
}
|
||||
|
||||
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