diff --git a/index.html b/index.html
index 4843abe..192c909 100644
--- a/index.html
+++ b/index.html
@@ -1,6 +1,6 @@
- OpenFest
+ OpenFest 2020
@@ -24,10 +24,12 @@
-
+
+
@@ -123,7 +125,7 @@
{{/eventCount}}
- #OpenFest2016
+ #OpenFest2020
в Twitter
diff --git a/logo.png b/logo.png
index 549f3c4..cda04c3 100644
Binary files a/logo.png and b/logo.png differ
diff --git a/ractive-init.js b/ractive-init.js
index a2d16ad..c415d4b 100644
--- a/ractive-init.js
+++ b/ractive-init.js
@@ -20,5 +20,7 @@ function refreshEvent() {
currentEvent: schedule.currentEvent(),
nextEvent: schedule.nextEvent(),
futureEvents: schedule.futureEvents(),
- eventCount: schedule.allEvents().length});
+ eventCount: schedule.allEvents().length,
+ now: schedule.now(),
+ room: schedule.room()});
}
diff --git a/schedule.js b/schedule.js
index 00a3946..3c4d4f1 100644
--- a/schedule.js
+++ b/schedule.js
@@ -1,26 +1,53 @@
-function Schedule(hallId, date) {
+function Schedule(hallId, date, setPageTitle) {
var events = [];
- this.update = function() {
- $.getJSON('http://www.openfest.org/2016/wp-content/themes/initfest/schedule/interlude.php', function(data) {
- var scheduleEvents = $.map(data[hallId], function(event) {
- event['startTime'] = moment(event['starts_at'] * 1000);
- event['endTime'] = moment(event['ends_at'] * 1000);
- console.log(event['startTime'].date());
- if (event['startTime'].date() !== date) {
- return null;
- }
-
- return event;
- });
+ var apiEndpointPrefix = 'https://cfp.openfest.org/api/conferences/7';
- events = scheduleEvents;
+ var pageTitle = 'OpenFest';
+ var room = '';
+
+ var nextLectureDelayMinutes = 4; // show the current lecture as next for the first N minutes
+
+ $.getJSON(apiEndpointPrefix + '/halls.json', function(data) {
+ room = data[hallId]['name']['bg'];
+ if (room === undefined) {
+ room = '';
+ }
+ });
+
+ this.update = function() {
+ $.getJSON(apiEndpointPrefix + '/events.json', function(eventsData) {
+ $.getJSON(apiEndpointPrefix + '/slots.json', function(slotsData) {
+ $.each(slotsData, function(slotId, slot) {
+ $.extend(eventsData[slot['event_id'].toString()], slot);
+ $.extend(eventsData[slot['event_id'].toString()], {"slotId": slotId});
+ });
+ var scheduleEvents = $.map(eventsData, function(event, eventId) {
+ event['id'] = eventId;
+ event['startTime'] = moment(event['starts_at']);
+ event['endTime'] = moment(event['ends_at']);
+ event['hallId'] = event['hall_id'];
+
+ if (event['startTime'].date() !== date) {
+ return null;
+ }
+ if (event['hallId'] !== hallId) {
+ return null;
+ }
+
+ return event;
+ });
+
+ events = scheduleEvents.sort(function (a,b) {return a['startTime'].isBefore(b['startTime']) ? -1 : 1});
+ });
});
+ this.setPageTitle();
}
this.upcomingEvents = function() {
+ var now = this.referenceTime();
return _.select(events, function(event) {
- return event.startTime.isAfter(moment());
+ return event.startTime.isAfter(now);
});
}
@@ -30,7 +57,7 @@ function Schedule(hallId, date) {
this.currentEvent = function() {
var latestEvent = _.last(this.pastEvents());
- if (typeof(latestEvent) != 'undefined' && latestEvent.endTime.isAfter(moment())) {
+ if (typeof(latestEvent) != 'undefined' && latestEvent.endTime.isAfter(this.now())) {
return latestEvent;
} else {
return undefined;
@@ -42,14 +69,38 @@ function Schedule(hallId, date) {
}
this.pastEvents = function() {
+ var now = this.referenceTime();
return _.select(events, function(event) {
- return event.startTime.isBefore(moment());
+ return event.startTime.isBefore(now);
});
}
this.allEvents = function() {
return events;
}
+
+ this.now = function() {
+ now = $.urlParam("now");
+ if (now) {
+ return moment(now);
+ } else {
+ return moment();
+ }
+ }
+
+ this.referenceTime = function() {
+ return this.now().subtract(nextLectureDelayMinutes, 'minutes');
+ }
+
+ this.room = function() {
+ return room;
+ }
+
+ this.setPageTitle = function() {
+ if (setPageTitle) {
+ $('title').text(pageTitle + " room=" + room + " date=" + date);
+ }
+ }
}
$.urlParam = function(name){
@@ -62,4 +113,4 @@ $.urlParam = function(name){
}
}
-var schedule = new Schedule(parseInt($.urlParam('roomId')), parseInt($.urlParam('date')));
+var schedule = new Schedule(parseInt($.urlParam('roomId')), parseInt($.urlParam('date')), true);
diff --git a/styles.css b/styles.css
index 66adb32..b0a2550 100644
--- a/styles.css
+++ b/styles.css
@@ -2,6 +2,7 @@ body {
width: 100%;
height: 100%;
overflow: hidden;
+ background-color: #06172A; /* BigBlueButton background */
}
body,
@@ -43,4 +44,4 @@ tr.future_event {
tr td:last-child, tr th:last-child {
text-align: right;
-}
\ No newline at end of file
+}