ublo-lib 1.10.23 → 1.10.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
function getFiltrableSections() {
|
|
2
|
+
return Array.from(document.querySelectorAll("section[data-weeks]"));
|
|
3
|
+
}
|
|
4
|
+
export function removeFilter() {
|
|
3
5
|
const filtrables = getFiltrableSections();
|
|
4
6
|
filtrables.forEach(section => {
|
|
5
7
|
if (section.originalDisplayStyle !== undefined) {
|
|
6
8
|
section.style.display = section.originalDisplayStyle;
|
|
9
|
+
section.removeAttribute("data-full");
|
|
7
10
|
}
|
|
8
11
|
});
|
|
9
|
-
}
|
|
10
|
-
export
|
|
12
|
+
}
|
|
13
|
+
export function filter(week) {
|
|
11
14
|
const search = String(week);
|
|
12
15
|
const filtrables = getFiltrableSections();
|
|
13
16
|
filtrables.forEach(section => {
|
|
14
17
|
const weeks = section.dataset.weeks.split(",").filter(week => week !== "");
|
|
15
|
-
const
|
|
18
|
+
const hasFullWeeks = section.hasAttribute("data-full-weeks");
|
|
19
|
+
const visible = weeks.length === 0 || weeks.includes(search);
|
|
16
20
|
if (section.originalDisplayStyle === undefined) {
|
|
17
21
|
section.originalDisplayStyle = section.style.display;
|
|
18
22
|
}
|
|
23
|
+
if (hasFullWeeks && visible) {
|
|
24
|
+
const fullWeeks = section.dataset.fullWeeks.split(",").filter(week => week !== "");
|
|
25
|
+
const isFull = fullWeeks.includes(search) && fullWeeks.every(week => weeks.includes(week));
|
|
26
|
+
if (isFull) {
|
|
27
|
+
section.setAttribute("data-full", "true");
|
|
28
|
+
} else {
|
|
29
|
+
section.removeAttribute("data-full");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
19
32
|
section.style.display = visible ? section.originalDisplayStyle : "none";
|
|
20
33
|
});
|
|
21
|
-
}
|
|
34
|
+
}
|
|
@@ -24,18 +24,29 @@ const removeSectionFilters = () => {
|
|
|
24
24
|
Array.prototype.forEach.call(filtrables, section => {
|
|
25
25
|
if (section.originalDisplayStyle !== undefined) {
|
|
26
26
|
section.style.display = section.originalDisplayStyle;
|
|
27
|
+
section.removeAttribute("data-full");
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
};
|
|
30
31
|
const filterSections = week => {
|
|
31
32
|
const search = String(week);
|
|
32
33
|
const filtrables = getFiltrableSections();
|
|
33
|
-
|
|
34
|
+
filtrables.forEach(section => {
|
|
34
35
|
const weeks = section.dataset.weeks.split(",").filter(week => week !== "");
|
|
35
|
-
const
|
|
36
|
+
const hasFullWeeks = section.hasAttribute("data-full-weeks");
|
|
37
|
+
const visible = weeks.length === 0 || weeks.includes(search);
|
|
36
38
|
if (section.originalDisplayStyle === undefined) {
|
|
37
39
|
section.originalDisplayStyle = section.style.display;
|
|
38
40
|
}
|
|
41
|
+
if (hasFullWeeks && visible) {
|
|
42
|
+
const fullWeeks = section.dataset.fullWeeks.split(",").filter(week => week !== "");
|
|
43
|
+
const isFull = fullWeeks.includes(search) && fullWeeks.every(week => weeks.includes(week));
|
|
44
|
+
if (isFull) {
|
|
45
|
+
section.setAttribute("data-full", "true");
|
|
46
|
+
} else {
|
|
47
|
+
section.removeAttribute("data-full");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
39
50
|
section.style.display = visible ? section.originalDisplayStyle : "none";
|
|
40
51
|
});
|
|
41
52
|
};
|