forked from JesperDramsch/python-deadlines
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
84 lines (69 loc) · 2.35 KB
/
Copy pathutils.js
File metadata and controls
84 lines (69 loc) · 2.35 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
function update_filtering(data) {
// Delegate to consolidated ConferenceFilter module
if (window.ConferenceFilter && window.ConferenceFilter.updateFromMultiselect) {
window.ConferenceFilter.updateFromMultiselect(data.subs);
} else {
// Fallback for legacy support
console.warn('ConferenceFilter module not loaded, using legacy filtering');
// Defensive check for data parameter
if (!data || typeof data !== 'object') {
console.error('update_filtering called with invalid data:', data);
return;
}
// Ensure required properties exist
if (!data.subs || !Array.isArray(data.subs)) {
console.error('update_filtering: data.subs is not an array:', data.subs);
return;
}
var page_url = window.location.pathname;
store.set('{{site.domain}}-subs', { subs: data.subs, timestamp: new Date().getTime() });
$('.ConfItem').hide();
// 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();
}
// Notify CountdownManager about filter changes for lazy loading optimization
if (window.CountdownManager && window.CountdownManager.onFilterUpdate) {
window.CountdownManager.onFilterUpdate();
}
if (data.subs.length === 0 || data.subs.length == data.all_subs.length) {
window.history.pushState('', '', page_url);
} else {
// Join the selected values into a query parameter
window.history.pushState('', '', page_url + '?sub=' + data.subs.join());
}
}
}
function isDataExpired(data) {
const EXPIRATION_PERIOD = 1 * 17 * 60 * 60 * 1000; // 1 day in milliseconds
const now = new Date().getTime();
if (data.timestamp && now - data.timestamp > EXPIRATION_PERIOD) {
return true;
}
return false;
}
function createCalendarFromObject(data) {
return createCalendar({
options: {
class: 'calendar-obj',
// You can pass an ID. If you don't, one will be generated for you
id: data.id,
},
data: {
// Event title
title: data.title,
// Event start date
start: data.start_date,
// Event duration (minutes)
duration: 60,
// You can also choose to set an end time
// If an end time is set, this will take precedence over duration
end: data.end_date,
// Event Address
address: data.place,
// Event Description
description: '<a href=' + data.link + '>' + data.title + '</a>',
},
});
}