Skip to content

Commit

Permalink
Try and fix sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperDramsch committed Dec 20, 2023
1 parent 31c85d6 commit 61aa6e6
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ <h1 id="archive-link">Visit the <a href="/archive/">Archive</a></h1>
}

// check if date has passed, add 'past' class to it
cfpDiff = today.diff(cfpDate);
confDiff = today.diff(confDate);
cfpDiff = cfpDate.diffNow("seconds");
confDiff = confDate.diffNow("seconds");

$('#{{conf.title | slugify}}-{{conf.year}}').attr("cfpDiff", cfpDiff.milliseconds);
$('#{{conf.title | slugify}}-{{conf.year}}').attr("confDiff", confDiff.milliseconds);
$('#{{conf.title | slugify}}-{{conf.year}}').attr("cfpDiff", cfpDiff.toMillis());
$('#{{conf.title | slugify}}-{{conf.year}}').attr("confDiff", confDiff.toMillis());

if (cfpDiff > 0) {
if (cfpDiff > 0 && confDiff < 0) {
$('#{{conf.title | slugify}}-{{conf.year}}').addClass('pastcfp');
$('#{{conf.title | slugify}}-{{conf.year}}').appendTo($("#past_cfps"));
$('#{{conf.title | slugify}}-{{conf.year}} .timer').replaceWith($('#{{conf.title | slugify}}-{{conf.year}} .deadline'));
Expand All @@ -273,18 +273,6 @@ <h1 id="archive-link">Visit the <a href="/archive/">Archive</a></h1>
return $(b).attr('cfpDiff') - $(a).attr('cfpDiff');
}).appendTo($("#coming_confs"));

$("#conf-sort-order-checkbox input").on("click", function() {
if ($("#conf-sort-order-checkbox input").is(":checked")) {
$("#past_confs .ConfItem").sort(function (a, b) {
return $(a).attr('confDiff') - $(b).attr('confDiff');
}).appendTo($("#past_confs"));
} else {
$("#past_confs .ConfItem").sort(function (a, b) {
return $(b).attr('confDiff') - $(a).attr('confDiff');
}).appendTo($("#past_confs"));
}
});

{% include handle_url_retrieval.js %}

// Event handler on sub badge click
Expand Down

0 comments on commit 61aa6e6

Please sign in to comment.