-
Notifications
You must be signed in to change notification settings - Fork 33
/
redir.js
63 lines (59 loc) · 1.85 KB
/
redir.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
let map = {
"add-ons": "addons.md",
"apkg-export": "exporting.md",
"currentnote-preview": "templates/intro.md",
"reviewing-ahead": "filtered-decks.md",
"what-algorithm": "faqs.md",
addingnotes: "editing.md",
backups: "preferences.md",
basics: "getting-started.md",
browser: "browsing.md",
browsermisc: "browsing.md",
cardlist: "browsing.md",
cardtypedefinitions: "stats.md#types-of-cards",
cloze: "editing.md#cloze-deletion",
columntemplates: "templates/styling.md#browser-appearance",
deckoptions: "deck-options.md",
deckoverride: "templates/intro.md",
deckoverview: "studying.md#study-overview",
displayorder: "studying.md#display-order",
editmore: "studying.md",
editor: "editing.md",
exporting: "exporting.md",
fields: "editing.md#customizing-fields",
fieldstyling: "templates/styling.md",
files: "files.md",
filtered: "filtered-decks.md",
findreplace: "browsing.md",
lapses: "deck-options.md",
latex: "math.md",
learning: "studying.md#learning",
manydecks: "editing.md#using-decks-appropriately",
media: "media.md",
mediarefs: "templates/fields.md",
mergingconflicts: "syncing.md#merging-conflicts",
notetypes: "getting-started.md",
preferences: "preferences.md",
profileprefs: "preferences.md",
searching: "searching.md",
siblings: "studying.md#siblings-and-burying",
specialfields: "templates/fields.md#special-fields",
stats: "stats.md",
syncing: "syncing.md",
templates: "templates/intro.md",
templatesrtl: "templates/styling.md",
typinganswers: "templates/fields.md#checking-your-answer"
};
let head = "https://docs.ankiweb.net/#/";
function pathToURL(path) {
return head + path.replace(".md", "");
}
function newURL(hash) {
let key = hash.replace("#", "");
if (map[key]) {
return pathToURL(map[key]);
} else {
return head;
}
}
window.location = newURL(window.location.hash);