-
Notifications
You must be signed in to change notification settings - Fork 0
/
yearchange.html.template
51 lines (46 loc) · 1.8 KB
/
yearchange.html.template
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title><%= title %></title>
</head>
<body>
<button onClick=toggleEduvwr() >Pois ja takaisin</button>
<button onClick=increaseYear() >Lisää vuosi</button>
<span id="selectedYear"></span>
<div id="outer">
</div>
<script>
let active = false;
let year = 68
const toggleEduvwr = () => {
active = !active;
if (!active) {
document.getElementById('eduviewer-root').remove();
}
if (active) {
lv = 'hy-lv-' + year;
const edvwr = document.createElement('div');
edvwr.id = 'eduviewer-root';
edvwr.setAttribute('academic-year', lv);
edvwr.setAttribute('module-code', 'KH80_004');
edvwr.setAttribute('selected-academic-year-only', true);
edvwr.setAttribute('hide-selections', true);
edvwr.lang = 'fi';
document.getElementById("outer").appendChild(edvwr);
document.getElementById('selectedYear').textContent = lv;
eduviewer_var.render();
}
console.log('active: ', active);
}
const increaseYear = () => {
year++;
lv = 'hy-lv-' + year;
document.getElementById('eduviewer-root').setAttribute('academic-year', lv);
eduviewer_var.render();
document.getElementById('selectedYear').textContent = lv;
}
toggleEduvwr();
</script>
</body>
</html>