-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtitlefix.js
121 lines (91 loc) · 2.18 KB
/
titlefix.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
function vak_prefix(page) {
switch (page) {
case "news":
return "Vaknieuws"
case "course":
return "Online les"
case "documents":
return "Documenten"
case "uploadzone":
return "Uploadzone"
case "exercises":
return "Oefeningen"
case "lpaths":
return "Leerpaden"
case "weblinks":
return "Weblinks"
case "tasks":
return "Taken"
case "cooperate":
return "Samenwerken"
case "classmates":
return "Studiegenoten"
case "forum":
return "Forum"
case "survey":
return "Enquêtes"
case "wiki":
return "Wiki"
default:
break;
}
}
function title_prefix() {
let subdomain = location.host.split(".")[0].charAt(0).toUpperCase() + location.host.split(".")[0].slice(1)
let url = location.pathname;
let qstr = new URLSearchParams(location.search)
let module = qstr.get("module");
let page = url.split("/")[1].toLowerCase();
if (module !== null) {
page = module.toLowerCase();
}
switch (page) {
case "planner":
return "Planner"
case "photos":
return "Photos"
case "agenda":
return "Agenda"
case "results":
return "Resultaten"
case "messages":
return "Berichten"
case "mydoc":
return "Mijn documenten"
case "forms":
return "Formulieren"
case "studentcard":
return "Mijn leerlingfiche"
case "manual":
return "Handleiding"
case "timetable":
return "Lesrooster"
case "intradesk":
return "Intradesk"
case "online-session":
return "Online sessies"
case "lvs":
return "Leerlingvolgsysteem"
case "":
return "Start - " + subdomain
default:
break;
}
let topnav_title = document.querySelector(".topnav__title");
if (topnav_title) {
topnav_title = topnav_title.innerText;
}
let prefix = vak_prefix(page);
if (prefix != undefined) {
if (topnav_title) {
return prefix + " - " + topnav_title;
} else {
return prefix;
}
}
}
let prepend = title_prefix()
if (prepend != undefined) {
let title = document.querySelector("head > title");
title.innerText = prepend + " - Smartschool"
}