forked from th-koeln/mi-bachelor-praxisprojektseminar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timetable.html
executable file
·42 lines (34 loc) · 1.22 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
38
39
40
41
42
---
layout: default
---
{% assign lehrveranstaltungen=site.lehrveranstaltungen|sort: 'title' %}
{% assign cards = "" | split: "" %} {% for lehrveranstaltung in lehrveranstaltungen %}
{% if lehrveranstaltung.typ != "other" %}
{% capture card %}
{% include veranstaltungsinfo-klein.html lehrveranstaltung=lehrveranstaltung %}
{% endcapture %}
{% assign cards=cards|push:card %}
{% endif %}
{% endfor %}
<section class="section">
<div class="container" data-starting-date="date-{{site.data.dates["week-1"]["day-1"]["datum"]}}">
<h2 class="title is-1">Zeitplan</h2>
{% include /functions/zeitplan.html %}
</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>