-
Notifications
You must be signed in to change notification settings - Fork 39
/
timetable.html
executable file
·37 lines (29 loc) · 1.14 KB
/
timetable.html
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
---
layout: default
title: Zeitplan
---
<section class="section">
<div class="container" data-starting-date="date-{{site.data['dates-web-technologien']['week-1']['day-1']['datum']}}">
<h2 class="title is-1" style="display: inline-block; margin-right: 5px">Zeitplan</h2> <button class="button is-1" href="#" onclick="javascript:cal.download('Web-Technologien')">iCal</button>
<script>
var cal = ics()
</script>
{% include /functions/zeitplan.html modul="web-technologien" %}
</div>
</section>
<script>
Date.prototype.getWeek = function () {
var onejan = new Date(this.getFullYear(), 0, 1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7);
};
let startingDateData = document.querySelector("[data-starting-date]").dataset.startingDate.replace("date-", "");
let startingDate = new Date(startingDateData);
let startingWeek = startingDate.getWeek();
let today = new Date();
let thisWeek = today.getWeek();
let diffWeek = thisWeek - startingWeek;
let scrollTarget = `#week-${diffWeek}`;
document.querySelector(scrollTarget).scrollIntoView({
behavior: 'smooth'
});
</script>