blob: 789dedbc126f18bb7cfe8fdb37fd8b3bc21c6fd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
const redirects = {
};
let segments = document.location.pathname.split('/');
// Das erste Element ist immer `''`
segments.splice(0, 1);
let file = segments.pop();
if (file === '') { file = "index.html"; }
segments.push(file);
const path = segments.join('/');
const anchor = document.location.hash.substring(1);
const redirect = redirects[path];
if (redirect) {
const target = redirect[anchor];
if (target) {
document.location.href = target;
}
}
|