@@ -215,13 +217,24 @@
// check if date has passed, add 'past' class to it
var today = moment();
- if (today.diff(confDate) > 0) {
+ diff = today.diff(confDate)
+ $('#{{conf.id}}').attr("diff", diff)
+ if (diff > 0) {
$('#{{conf.id}}').addClass('past');
$('#{{conf.id}}').appendTo($("#past_confs"))
}
{% endif %}
{% endfor %}
+ // Sort coming_confs and past_confs
+ $("#coming_confs .ConfItem").sort(function (a, b) {
+ return $(b).attr('diff') - $(a).attr('diff');
+ }).appendTo($("#coming_confs"));
+
+ $("#past_confs .ConfItem").sort(function (a, b) {
+ return $(b).attr('diff') - $(a).attr('diff');
+ }).appendTo($("#past_confs"));
+
// Get subjects from URL
var url = new URL(window.location);
var subs = url.searchParams.get('sub');
From 9853e7ae3cd1951d21164071d3377a242a8b8722 Mon Sep 17 00:00:00 2001
From: Hui Li <7204277+Hui-Li@users.noreply.github.com>
Date: Sat, 22 Aug 2020 00:36:11 +0800
Subject: [PATCH 2/3] Support multi-types
---
_layouts/home.html | 36 ++++++++++++++++++++++++------------
static/css/deadlines.css | 1 +
2 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/_layouts/home.html b/_layouts/home.html
index 3a2e211c04..fff8c46e7c 100644
--- a/_layouts/home.html
+++ b/_layouts/home.html
@@ -109,7 +109,9 @@
-
+ {% for sub in conf.sub %}
+
+ {% endfor %}
@@ -171,7 +173,9 @@
}
{% for conf in site.data.conferences %}
- $('#{{conf.id}} .conf-sub').html(sub2name["{{conf.sub}}"].toLocaleLowerCase());
+ {% for sub in conf.sub %}
+ $('#{{conf.id}} #{{sub}}').html(sub2name["{{sub}}"].toLocaleLowerCase());
+ {% endfor %}
{% if conf.deadline == "TBA" %}
$('#{{conf.id}} .timer').html("TBA");
$('#{{conf.id}} .deadline-time').html("TBA");
@@ -243,6 +247,18 @@
} else {
subs = subs.toUpperCase().split(',');
}
+ if (subs != undefined) {
+ // Hide unchecked subs
+ for (var i = 0; i < all_subs.length; i++) {
+ if (subs.indexOf(all_subs[i]) < 0) {
+ $('.' + all_subs[i] + '-conf').hide();
+ }
+ }
+ // In case a conf with multiple types is wrongly hid, show all confs with at least one checked type.
+ for (var i = 0; i < subs.length; i++) {
+ $('.' + subs[i] + '-conf').show();
+ }
+ }
// Get subjects from browser cache
if (subs === undefined) {
subs = all_subs;
@@ -254,12 +270,6 @@
$('#' + subs[i] + '-checkbox').prop('checked', true);
}
}
- // Hide unchecked subs
- for (var i = 0; i < all_subs.length; i++) {
- if (subs.indexOf(all_subs[i]) < 0) {
- $('.' + all_subs[i] + '-conf').hide();
- }
- }
store.set('{{ site.domain }}', subs);
window.history.pushState('', '', '/?sub=' + subs.join());
@@ -278,6 +288,10 @@
var idx = subs.indexOf(csub);
if (idx >= 0)
subs.splice(idx, 1);
+ // In case a conf with multiple types (including this type) is wrongly hid, show all confs with at least one checked type.
+ for (var i = 0; i < subs.length; i++) {
+ $('.' + subs[i] + '-conf').show();
+ }
}
console.log(subs);
store.set('{{ site.domain }}', subs);
@@ -292,11 +306,9 @@
$('#' + subs[i] + '-checkbox').prop('checked', false);
$('.' + subs[i] + '-conf').hide();
}
- else {
- $('#' + subs[i] + '-checkbox').prop('checked', true);
- $('.' + subs[i] + '-conf').show();
- }
}
+ $('#' + csub + '-checkbox').prop('checked', true);
+ $('.' + csub + '-conf').show();
subs = [csub];
console.log(subs);
store.set('{{ site.domain }}', subs);
diff --git a/static/css/deadlines.css b/static/css/deadlines.css
index ea28c168e2..72cbd3a170 100644
--- a/static/css/deadlines.css
+++ b/static/css/deadlines.css
@@ -135,6 +135,7 @@ footer {
background: rgba(236, 240, 241, 0.7);
font-size: 13px;
padding: 3px 5px;
+ margin-right: 8px;
cursor: pointer;
font-weight: 300;
}
From a28aee3c7c026ce6e866e32f2f402c90d6240f8c Mon Sep 17 00:00:00 2001
From: Hui Li <7204277+Hui-Li@users.noreply.github.com>
Date: Sat, 22 Aug 2020 10:24:48 +0800
Subject: [PATCH 3/3] Move the id of tag span to its class
---
_layouts/home.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/_layouts/home.html b/_layouts/home.html
index fff8c46e7c..c5a421c794 100644
--- a/_layouts/home.html
+++ b/_layouts/home.html
@@ -110,7 +110,7 @@
{% for sub in conf.sub %}
-
+
{% endfor %}
@@ -174,7 +174,7 @@
{% for conf in site.data.conferences %}
{% for sub in conf.sub %}
- $('#{{conf.id}} #{{sub}}').html(sub2name["{{sub}}"].toLocaleLowerCase());
+ $('#{{conf.id}} .{{sub}}-tag').html(sub2name["{{sub}}"].toLocaleLowerCase());
{% endfor %}
{% if conf.deadline == "TBA" %}
$('#{{conf.id}} .timer').html("TBA");