aboutsummaryrefslogtreecommitdiff
path: root/www/html/redirects.js
blob: a729ac9f4a71a5da4b2e36898b46397fee2a0420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const redirects = {
  "index.html": {
@events-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;
  }
}