Skip to content

Commit

Permalink
Fix auto-redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperDramsch committed Oct 11, 2023
1 parent b80d7ea commit dddb386
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 30 deletions.
15 changes: 8 additions & 7 deletions _includes/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
content +=
'<div class="event-tooltip-content">' +
'<div class="event-name ' + headline_color + '">' +
'<b>' + e.events[i].name + '</b>' +
'<b>' + e.events[i].name + '</b>' +
'</div>' +
'<div class="event-location">' +
location_html +
Expand Down Expand Up @@ -162,9 +162,10 @@ function update_filtering(data) {
calendar_data['dataSource'] = conf_list; // need to update only this
calendar = new Calendar("#calendar-page", calendar_data);

if (subs.length == 0) {
window.history.pushState('', '', page_url);
} else {
window.history.pushState('', '', page_url + '/?sub=' + data.subs.join());
}
}
if (data.subs.length === 0 || data.subs[0] === 'all') {
window.history.pushState('', '', page_url);
} else {
// Join the selected values into a query parameter
window.history.pushState('', '', page_url + '?sub=' + data.subs.join());
}
}
30 changes: 15 additions & 15 deletions _includes/utils.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
function update_filtering(data) {
var page_url = window.location.pathname;
store.set("{{site.domain}}-subs", data.subs);
var page_url = window.location.pathname;
store.set('{{site.domain}}-subs', data.subs);

$(".confItem").hide();
for (const j in data.all_subs) {
const s = data.all_subs[j];
const identifier = "." + s + "-conf";
if (data.subs.includes(s)) {
$(identifier).show();
}
}
$('.confItem').hide();

if (subs.length == 0) {
window.history.pushState("", "", page_url);
} else {
window.history.pushState("", "", page_url + "?sub=" + data.subs.join());
}
// Loop through selected values in data.subs
for (const s of data.subs) {
// Show elements with class .s-conf (where s is the selected value)
$('.' + s + '-conf').show();
}

if (data.subs.length === 0 || data.subs[0] === 'all') {
window.history.pushState('', '', page_url);
} else {
// Join the selected values into a query parameter
window.history.pushState('', '', page_url + '?sub=' + data.subs.join());
}
}

function createCalendarFromObject(data) {
Expand Down
16 changes: 8 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="row">
<div class="col-12 col-sm-12">
<h1>
{{ site.title }}
{{ site.title }}
</h1>
</div>
<div class="meta col-12">
Expand All @@ -22,7 +22,7 @@ <h1>
</div>
<br>
<div class="row">
<div class="meta col-8">This community tool serves as a central repository for deadlines of calls for participitation, proposals, workshops, and tutorials at Python conferences.
<div class="meta col-8">This community tool serves as a central repository for deadlines of calls for participitation, proposals, workshops, and tutorials at Python conferences.
The dates are made available as countdowns, in local timezones and even as a Google calendar below! <br>
Deadlines are shown in <span class="local-timezone">your local</span> time.
To view them in conference website timezones, click on the conference.<br>
Expand Down Expand Up @@ -137,7 +137,7 @@ <h1>
<span class="deadline-time"></span>
</div>
</div>

</div>
</div>
<div class="row">
Expand Down Expand Up @@ -175,20 +175,20 @@ <h1 id="archive-link">Visit the <a href="/archive/">Archive</a></h1>

var DateTime = luxon.DateTime;
var today = DateTime.now();

// Make sure this is >= no. of subs
// Currently not used
var colors = ['#341f97', '#ee5253', '#2e86de',
'#ff9f43', '#10ac84', '#222f3e']


{% include load_data.js %}
{% include utils.js %}
{% include multiselect_handler.js %}

// Set time zone to local timezone on web copy
$('.local-timezone').text(today.toFormat('z'));

{% for conf in site.data.conferences %}
{% assign subs = conf.sub | split: "," %}
{% for sub in subs %}
Expand All @@ -199,7 +199,7 @@ <h1 id="archive-link">Visit the <a href="/archive/">Archive</a></h1>
$('#{{conf.title | slugify}}-{{conf.year}} .deadline-time').html("TBA");
$('#{{conf.title | slugify}}-{{conf.year}}').attr("cfpDiff", -Infinity);
{% else %}

// Use specified timezone for deadlines if available else use AoE timezone
{% if conf.timezone %}
var cfpDate = DateTime.fromSQL("{{conf.cfp}}", {zone: "{{conf.timezone}}"});
Expand Down Expand Up @@ -257,7 +257,7 @@ <h1 id="archive-link">Visit the <a href="/archive/">Archive</a></h1>
$('#{{conf.title | slugify}}-{{conf.year}} .timer-small').replaceWith($('#{{conf.title | slugify}}-{{conf.year}} .deadline'));
$('#{{conf.title | slugify}}-{{conf.year}} .calendar').remove();
}

if (confDiff > 0) {
$('#{{conf.title | slugify}}-{{conf.year}}').addClass('pastconf');
$('#{{conf.title | slugify}}-{{conf.year}}').appendTo($("#past_confs"));
Expand Down

0 comments on commit dddb386

Please sign in to comment.