-
Notifications
You must be signed in to change notification settings - Fork 249
/
index.html
69 lines (61 loc) · 2.77 KB
/
index.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
layout: default
title: Upcoming
---
<ul class="conference-list list-unstyled">
{%- assign sorted_conferences = site.conferences | sort: 'date_start' -%}
{%- assign today = site.time | date: "%s" -%}
{%- for conference in sorted_conferences -%}
{%- assign date_end = conference.date_end | date: "%s" -%}
{%- if today < date_end %}
<li id='{{ forloop.index }}' data-conference-start="{{ conference.date_start | date: "%Y-%m-%d" }}" data-conference-end="{{ conference.date_end | date: "%Y-%m-%d" }}">
{{ conference.date_start | date: "%Y-%m-%d" }}
<a class="post-link" href="{{ conference.website }}">{{ conference.name }}</a>
{%- if conference.location %}
<small>{{ conference.location }}</small>
{%- endif -%}
{%- if conference.cfp.start %}
<a class="conference-cfp hide" data-conference-cfp-start="{{ conference.cfp.start | date: "%Y-%m-%d" }}" data-conference-cfp-end="{{ conference.cfp.end | date: "%Y-%m-%d" }}" href="{% if conference.cfp.site %}{{ conference.cfp.site }}{% else %}{{ conference.website }}{% endif %}">
<span class="label label-info">Call For Papers until {{ conference.cfp.end | date: "%Y-%m-%d" }}</span>
</a>
{%- endif -%}
{%- if conference.status %}
<span class="conference-status label label-danger">{{ conference.status }}</span>
{%- endif -%}
{%- if conference.online %}
<span class="conference-online label label-primary">Online-only event</span>
{%- endif %}
</li>
{%- endif -%}
{%- endfor -%}
</ul>
<script>
function dateTimestamp(date = undefined) {
const day = (date == undefined) ? new Date() : new Date(date);
return day.setHours(0, 0, 0, 0)
}
const today = dateTimestamp();
const conferenceElements = document.querySelectorAll(".conference-list li")
for (const conferenceElement of conferenceElements) {
const conferenceStart = dateTimestamp(conferenceElement.dataset.conferenceStart)
const conferenceEnd = dateTimestamp(conferenceElement.dataset.conferenceEnd)
if (today > conferenceEnd) {
conferenceElement.classList.add("text-muted")
}
const status = conferenceElement.querySelector(".conference-status")
if (!status) {
const cfpElement = conferenceElement.querySelector(".conference-cfp")
if (cfpElement) {
const cfpStart = dateTimestamp(cfpElement.dataset.conferenceCfpStart)
const cfpEnd = dateTimestamp(cfpElement.dataset.conferenceCfpEnd)
const showCfpLink = today >= cfpStart && today <= cfpEnd
if (showCfpLink) {
cfpElement.classList.remove("hide")
}
}
if (today >= conferenceStart && today <= conferenceEnd) {
conferenceElement.innerHTML = conferenceElement.innerHTML + '<span class="label label-success">Happening Now</span>'
}
}
}
</script>