Merge pull request #36 from c-base/calendarJson

Remove calendar script workaround
This commit is contained in:
Henri Bergius 2019-01-29 20:27:54 +01:00 committed by GitHub
commit 169759264f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 64 deletions

View file

@ -3,7 +3,12 @@ import '../elements/time';
function getEvents(number, callback) {
const now = new Date();
const allEvents = window.c_base_events.concat(window.c_base_regulars, window.c_base_seminars);
fetch('/../calendar')
.then(res => res.json())
.then((calendars) => {
const allEvents = calendars.c_base_events.concat(
calendars.c_base_regulars, calendars.c_base_seminars,
);
const current = allEvents.filter((event) => {
if (event.id === 45) {
return false;
@ -72,6 +77,7 @@ function getEvents(number, callback) {
});
return callback(events.slice(0, number));
});
});
}
let prevDate = new Date();

View file

@ -5,7 +5,6 @@
<title>c-base event calendar</title>
<script src="../vendor/webcomponentsjs/webcomponents-lite.js"></script>
<script src="../vendor/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="https://www.c-base.org/calendar/exported/events.js"></script>
<script src="../lib/calendar.js"></script>
<link rel="stylesheet" href="../theme/c-base.css">
<style>