@20minutes/hela 1.8.4 → 1.8.5
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.
package/dist/js/scripts.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var D = Object.defineProperty;
|
|
2
2
|
var W = (e, t, o) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
3
|
var b = (e, t, o) => (W(e, typeof t != "symbol" ? t + "" : t, o), o);
|
|
4
|
-
const j =
|
|
5
|
-
const t = document.querySelector(".c-close-article-btn");
|
|
6
|
-
t && (t.style.visibility = e.isIntersecting || e.boundingClientRect.top < 0 ? "hidden" : "visible");
|
|
7
|
-
}), F = () => {
|
|
4
|
+
const j = () => {
|
|
8
5
|
const e = document.querySelector(".js-limit-scroll-close-article-btn");
|
|
9
|
-
e &&
|
|
10
|
-
|
|
6
|
+
e && new IntersectionObserver(([o]) => {
|
|
7
|
+
const n = document.querySelector(".c-close-article-btn");
|
|
8
|
+
n && (n.style.visibility = o.isIntersecting || o.boundingClientRect.top < 0 ? "hidden" : "visible");
|
|
9
|
+
}).observe(e);
|
|
10
|
+
}, F = (e) => {
|
|
11
11
|
e.stopImmediatePropagation(), e.preventDefault();
|
|
12
12
|
const t = e.currentTarget;
|
|
13
13
|
if (t instanceof HTMLButtonElement) {
|
|
@@ -16,15 +16,15 @@ const j = new IntersectionObserver(([e]) => {
|
|
|
16
16
|
);
|
|
17
17
|
t.getAttribute("aria-expanded") === "true" ? (t.setAttribute("aria-expanded", "false"), n == null || n.setAttribute("aria-hidden", "true")) : (t.setAttribute("aria-expanded", "true"), n == null || n.setAttribute("aria-hidden", "false"));
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, O = (e = document.querySelector(
|
|
20
20
|
".js-collapse__button"
|
|
21
21
|
)) => {
|
|
22
22
|
e && document.querySelectorAll(".c-collapse__button").forEach((o) => {
|
|
23
23
|
o.addEventListener("click", (n) => {
|
|
24
|
-
|
|
24
|
+
F(n);
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
},
|
|
27
|
+
}, N = (e, t) => {
|
|
28
28
|
const o = document.querySelector(
|
|
29
29
|
`#${t}`
|
|
30
30
|
);
|
|
@@ -45,32 +45,32 @@ const j = new IntersectionObserver(([e]) => {
|
|
|
45
45
|
}
|
|
46
46
|
}, 1e3);
|
|
47
47
|
}
|
|
48
|
-
},
|
|
48
|
+
}, B = (e) => {
|
|
49
49
|
var n;
|
|
50
50
|
e.setAttribute("aria-expanded", "true");
|
|
51
51
|
const t = (n = e.parentNode) == null ? void 0 : n.querySelectorAll(".js-expand-target");
|
|
52
52
|
t == null || t.forEach((s) => s.setAttribute("aria-hidden", "false"));
|
|
53
53
|
const o = e.querySelector(".js-expand-button__label");
|
|
54
54
|
o instanceof HTMLSpanElement && (o.innerHTML = "Voir moins");
|
|
55
|
-
},
|
|
55
|
+
}, K = (e) => {
|
|
56
56
|
var n;
|
|
57
57
|
const t = (n = e.parentNode) == null ? void 0 : n.querySelectorAll(".js-expand-target");
|
|
58
58
|
t == null || t.forEach((s) => s.setAttribute("aria-hidden", "true")), e.setAttribute("aria-expanded", "false");
|
|
59
59
|
const o = e.querySelector(".js-expand-button__label");
|
|
60
60
|
o instanceof HTMLSpanElement && (o.innerHTML = "Voir plus");
|
|
61
|
-
},
|
|
61
|
+
}, P = (e) => {
|
|
62
62
|
const t = e.currentTarget;
|
|
63
|
-
return e.preventDefault(), t instanceof HTMLButtonElement ? t.getAttribute("aria-expanded") === "true" ?
|
|
64
|
-
},
|
|
63
|
+
return e.preventDefault(), t instanceof HTMLButtonElement ? t.getAttribute("aria-expanded") === "true" ? K(t) : B(t) : null;
|
|
64
|
+
}, z = (e = document.querySelector(
|
|
65
65
|
".js-expand-button"
|
|
66
66
|
)) => {
|
|
67
|
-
e && document.querySelectorAll(".js-expand-button").forEach((o) => o.addEventListener("click",
|
|
67
|
+
e && document.querySelectorAll(".js-expand-button").forEach((o) => o.addEventListener("click", P));
|
|
68
68
|
}, c = {
|
|
69
69
|
inert: ":not([inert]):not([inert] *)",
|
|
70
70
|
negTabIndex: ':not([tabindex^="-"])',
|
|
71
71
|
disabled: ":not(:disabled)"
|
|
72
72
|
};
|
|
73
|
-
var
|
|
73
|
+
var V = [
|
|
74
74
|
`a[href]${c.inert}${c.negTabIndex}`,
|
|
75
75
|
`area[href]${c.inert}${c.negTabIndex}`,
|
|
76
76
|
`input:not([type="hidden"]):not([type="radio"])${c.inert}${c.negTabIndex}${c.disabled}`,
|
|
@@ -91,14 +91,14 @@ var Y = [
|
|
|
91
91
|
function T(e) {
|
|
92
92
|
(e.querySelector("[autofocus]") || e).focus();
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Y(e) {
|
|
95
95
|
const t = g(e, !0), o = t ? g(e, !1) || t : null;
|
|
96
96
|
return [t, o];
|
|
97
97
|
}
|
|
98
98
|
function g(e, t) {
|
|
99
99
|
if (t && x(e))
|
|
100
100
|
return e;
|
|
101
|
-
if (
|
|
101
|
+
if (X(e))
|
|
102
102
|
if (e.shadowRoot) {
|
|
103
103
|
let o = _(e.shadowRoot, t);
|
|
104
104
|
for (; o; ) {
|
|
@@ -134,19 +134,19 @@ function _(e, t) {
|
|
|
134
134
|
function $(e, t) {
|
|
135
135
|
return t ? e.nextElementSibling : e.previousElementSibling;
|
|
136
136
|
}
|
|
137
|
-
const
|
|
137
|
+
const G = (e) => e.matches("details:not([open]) *") && !e.matches("details>summary:first-of-type") ? !0 : !(e.offsetWidth || e.offsetHeight || e.getClientRects().length), x = (e) => {
|
|
138
138
|
var t;
|
|
139
|
-
return (t = e.shadowRoot) != null && t.delegatesFocus ? !1 : e.matches(
|
|
139
|
+
return (t = e.shadowRoot) != null && t.delegatesFocus ? !1 : e.matches(V.join(",")) && !G(e);
|
|
140
140
|
};
|
|
141
|
-
function
|
|
141
|
+
function X(e) {
|
|
142
142
|
return e.shadowRoot && e.getAttribute("tabindex") === "-1" ? !1 : !e.matches(":disabled,[hidden],[inert]");
|
|
143
143
|
}
|
|
144
144
|
function L(e = document) {
|
|
145
145
|
const t = e.activeElement;
|
|
146
146
|
return t ? t.shadowRoot ? L(t.shadowRoot) || document.activeElement : t : null;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
const [o, n] =
|
|
148
|
+
function J(e, t) {
|
|
149
|
+
const [o, n] = Y(e);
|
|
150
150
|
if (!o)
|
|
151
151
|
return t.preventDefault();
|
|
152
152
|
const s = L();
|
|
@@ -228,7 +228,7 @@ class M {
|
|
|
228
228
|
o = !!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open');
|
|
229
229
|
} catch {
|
|
230
230
|
}
|
|
231
|
-
t.key === "Escape" && this.$el.getAttribute("role") !== "alertdialog" && !o && (t.preventDefault(), this.hide(t)), t.key === "Tab" &&
|
|
231
|
+
t.key === "Escape" && this.$el.getAttribute("role") !== "alertdialog" && !o && (t.preventDefault(), this.hide(t)), t.key === "Tab" && J(this.$el, t);
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* If the dialog is shown and the focus is not within a dialog element (either
|
|
@@ -245,7 +245,7 @@ function A() {
|
|
|
245
245
|
new M(e);
|
|
246
246
|
}
|
|
247
247
|
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", A) : A());
|
|
248
|
-
const
|
|
248
|
+
const Q = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
249
249
|
if (!(e instanceof HTMLElement))
|
|
250
250
|
return;
|
|
251
251
|
const t = new M(e), o = {
|
|
@@ -257,11 +257,11 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
257
257
|
}).on("hide", () => {
|
|
258
258
|
document.body.classList.remove("noscroll"), document.body.style.top = "", (window.scrollY !== o.y || window.scrollX !== o.x) && window.scroll(o.x, o.y);
|
|
259
259
|
});
|
|
260
|
-
}),
|
|
260
|
+
}), U = ({ navigatedList: e, nextBtn: t, prevBtn: o }) => {
|
|
261
261
|
var r, a, i, l, d, u, f, m;
|
|
262
262
|
const n = e.scrollLeft > 0, s = e.scrollLeft + e.clientWidth < e.scrollWidth;
|
|
263
263
|
n && s ? ((r = t.classList) == null || r.add("o-nav-button--visible"), (a = o.classList) == null || a.add("o-nav-button--visible")) : n ? ((i = t.classList) == null || i.remove("o-nav-button--visible"), (l = o.classList) == null || l.add("o-nav-button--visible")) : s ? ((d = t.classList) == null || d.add("o-nav-button--visible"), (u = o.classList) == null || u.remove("o-nav-button--visible")) : ((f = t.classList) == null || f.remove("o-nav-button--visible"), (m = o.classList) == null || m.remove("o-nav-button--visible"));
|
|
264
|
-
},
|
|
264
|
+
}, Z = ({
|
|
265
265
|
navigatedList: e,
|
|
266
266
|
nextBtn: t,
|
|
267
267
|
prevBtn: o,
|
|
@@ -306,7 +306,7 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
306
306
|
}), t.classList.remove("o-nav-button--visible"), o.classList.add("o-nav-button--visible");
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
},
|
|
309
|
+
}, ee = ({
|
|
310
310
|
navigatedList: e,
|
|
311
311
|
nextBtn: t,
|
|
312
312
|
prevBtn: o,
|
|
@@ -347,13 +347,13 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
347
347
|
behavior: "smooth"
|
|
348
348
|
}), o.classList.remove("o-nav-button--visible"), e.clientWidth < e.scrollWidth && t.classList.add("o-nav-button--visible");
|
|
349
349
|
}
|
|
350
|
-
},
|
|
351
|
-
|
|
350
|
+
}, te = ({ navigatedList: e, nextBtn: t, prevBtn: o }) => {
|
|
351
|
+
U({
|
|
352
352
|
navigatedList: e,
|
|
353
353
|
nextBtn: t,
|
|
354
354
|
prevBtn: o
|
|
355
355
|
});
|
|
356
|
-
},
|
|
356
|
+
}, oe = () => {
|
|
357
357
|
const e = document.querySelectorAll(".js-navigation-container");
|
|
358
358
|
for (const t of Array.from(e)) {
|
|
359
359
|
const { sliderVariant: o } = t.dataset, { sliderAuto: n } = t.dataset, { sliderDelay: s } = t.dataset, r = s ? parseInt(s, 10) : 3e3, a = t.closest(".js-overview-bar-container"), i = a == null ? void 0 : a.querySelector(".c-stepper"), l = i == null ? void 0 : i.querySelectorAll(".c-stepper__item");
|
|
@@ -367,7 +367,7 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
367
367
|
);
|
|
368
368
|
if (d && d.clientWidth < d.scrollWidth && (u == null || u.classList.add("o-nav-button--visible")), d && u && f && (u == null || u.addEventListener(
|
|
369
369
|
"click",
|
|
370
|
-
|
|
370
|
+
Z.bind(!1, {
|
|
371
371
|
navigatedList: d,
|
|
372
372
|
nextBtn: u,
|
|
373
373
|
prevBtn: f,
|
|
@@ -375,7 +375,7 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
375
375
|
})
|
|
376
376
|
), f == null || f.addEventListener(
|
|
377
377
|
"click",
|
|
378
|
-
|
|
378
|
+
ee.bind(!1, {
|
|
379
379
|
navigatedList: d,
|
|
380
380
|
nextBtn: u,
|
|
381
381
|
prevBtn: f,
|
|
@@ -400,7 +400,7 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
},
|
|
403
|
+
}, ne = () => {
|
|
404
404
|
const e = document.querySelectorAll(".js-navigation-container");
|
|
405
405
|
for (const t of Array.from(e))
|
|
406
406
|
if (t) {
|
|
@@ -413,14 +413,14 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
413
413
|
);
|
|
414
414
|
o && n && s && window.addEventListener(
|
|
415
415
|
"resize",
|
|
416
|
-
|
|
416
|
+
te.bind(!1, {
|
|
417
417
|
navigatedList: o,
|
|
418
418
|
nextBtn: n,
|
|
419
419
|
prevBtn: s
|
|
420
420
|
})
|
|
421
421
|
);
|
|
422
422
|
}
|
|
423
|
-
},
|
|
423
|
+
}, se = () => {
|
|
424
424
|
const e = document.querySelector(".js-limit-scroll-progress-bar"), t = document.querySelector(".c-progress__bar");
|
|
425
425
|
if (!t)
|
|
426
426
|
return;
|
|
@@ -432,27 +432,27 @@ const U = () => document.querySelectorAll(".js-modal").forEach((e) => {
|
|
|
432
432
|
e && (n = e.scrollHeight - o.clientHeight + (window.pageYOffset + e.getBoundingClientRect().top));
|
|
433
433
|
const r = Math.round(s / n * 100);
|
|
434
434
|
t.style.width = `${r}%`, r >= 100 && (t.style.width = "100%");
|
|
435
|
-
},
|
|
436
|
-
document.querySelector(".c-progress") && window.addEventListener("scroll",
|
|
435
|
+
}, ie = () => {
|
|
436
|
+
document.querySelector(".c-progress") && window.addEventListener("scroll", se);
|
|
437
437
|
};
|
|
438
438
|
let y, v = 0;
|
|
439
|
-
const
|
|
439
|
+
const re = () => {
|
|
440
440
|
y = null, document.body.getBoundingClientRect().top > v + 2 && (y = "up"), document.body.getBoundingClientRect().top < v - 2 && (y = "down"), v = document.body.getBoundingClientRect().top;
|
|
441
441
|
const e = document.querySelector(".c-read-also-banner");
|
|
442
442
|
if (e) {
|
|
443
443
|
const t = e.dataset.bannerLimitTop || "0";
|
|
444
444
|
y === "up" && -document.body.getBoundingClientRect().top >= parseInt(t, 10) && (e.classList.remove("c-read-also-banner__scrolldirection--down"), e.style.paddingTop = "0.75em", e.style.paddingBottom = "0.75em", e.style.borderWidth = "1px", e.classList.contains("c-read-also-banner__scrolldirection--up") || e.classList.add("c-read-also-banner__scrolldirection--up")), (y === "down" || -document.body.getBoundingClientRect().top <= parseInt(t, 10)) && (e.classList.remove("c-read-also-banner__scrolldirection--up"), e.style.paddingTop = "0", e.style.paddingBottom = "0", e.style.borderWidth = "0", e.classList.contains("c-read-also-banner__scrolldirection--down") || e.classList.add("c-read-also-banner__scrolldirection--down"));
|
|
445
445
|
}
|
|
446
|
-
},
|
|
446
|
+
}, le = (e = document.querySelector(
|
|
447
447
|
".c-read-also-banner"
|
|
448
448
|
)) => {
|
|
449
449
|
if (e) {
|
|
450
450
|
let t;
|
|
451
451
|
window.addEventListener("scroll", () => {
|
|
452
|
-
clearTimeout(t), t = setTimeout(
|
|
452
|
+
clearTimeout(t), t = setTimeout(re, 100);
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
|
-
}, S = "#page-content", w = "#text-tooltip",
|
|
455
|
+
}, S = "#page-content", w = "#text-tooltip", ce = ".tooltip-btn", H = "c-text-tooltip--show", ae = [
|
|
456
456
|
"#page-content .c-content p",
|
|
457
457
|
"#page-content .c-content h2",
|
|
458
458
|
"#page-content .c-content h3",
|
|
@@ -464,18 +464,18 @@ const le = () => {
|
|
|
464
464
|
"#page-content header span",
|
|
465
465
|
"#page-content header h1",
|
|
466
466
|
"#page-content header h2"
|
|
467
|
-
], q = (e, t) => e instanceof Element ? t.some((o) => e.matches(o)) : !1,
|
|
467
|
+
], q = (e, t) => e instanceof Element ? t.some((o) => e.matches(o)) : !1, de = (e, t) => {
|
|
468
468
|
const o = e.startContainer.nodeType === Node.ELEMENT_NODE ? e.startContainer : e.startContainer.parentElement, n = e.endContainer.nodeType === Node.ELEMENT_NODE ? e.endContainer : e.endContainer.parentElement;
|
|
469
469
|
return !!o && q(o, t) || !!n && q(n, t);
|
|
470
|
-
},
|
|
470
|
+
}, ue = (e) => {
|
|
471
471
|
var o;
|
|
472
472
|
if (!e.focusNode)
|
|
473
473
|
return null;
|
|
474
474
|
const t = (o = e.anchorNode) == null ? void 0 : o.compareDocumentPosition(e.focusNode);
|
|
475
475
|
return t ? (t & 4) > 0 : e.anchorOffset < e.focusOffset;
|
|
476
|
-
},
|
|
476
|
+
}, fe = (e, t, o) => {
|
|
477
477
|
const n = document.querySelector(`${S} ${w}`), s = document.querySelector(`${S}`), r = document.querySelectorAll(
|
|
478
|
-
`${S} ${w} ${
|
|
478
|
+
`${S} ${w} ${ce}`
|
|
479
479
|
);
|
|
480
480
|
if (!n || !s) {
|
|
481
481
|
console.warn("Text tooltip : Tooltip or it's parent are not found in the DOM");
|
|
@@ -497,30 +497,30 @@ const le = () => {
|
|
|
497
497
|
return;
|
|
498
498
|
const o = t.getRangeAt(0), n = t.toString().trim();
|
|
499
499
|
if (n.length) {
|
|
500
|
-
const s =
|
|
501
|
-
s &&
|
|
500
|
+
const s = de(o, ae), r = ue(t) || !1;
|
|
501
|
+
s && fe(o, r, n);
|
|
502
502
|
return;
|
|
503
503
|
}
|
|
504
504
|
C();
|
|
505
|
-
},
|
|
505
|
+
}, he = () => {
|
|
506
506
|
if (!(window != null && window.getSelection)) {
|
|
507
507
|
console.warn("Selection API isn't supported");
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
510
|
document.addEventListener("mouseup", E), document.addEventListener("selectionchange", E), document.addEventListener("touchend", E), document.addEventListener("touchcancel", E);
|
|
511
|
-
},
|
|
511
|
+
}, pe = (e) => {
|
|
512
512
|
const { target: t } = e;
|
|
513
513
|
if (t instanceof Element) {
|
|
514
514
|
const o = t.closest(".c-search-form--button");
|
|
515
515
|
o && (e.preventDefault(), o.classList.remove("c-search-form--button"));
|
|
516
516
|
}
|
|
517
|
-
},
|
|
517
|
+
}, me = (e = document.querySelector(
|
|
518
518
|
".c-search-form--button"
|
|
519
519
|
)) => {
|
|
520
520
|
e && e.addEventListener("click", (t) => {
|
|
521
|
-
|
|
521
|
+
pe(t);
|
|
522
522
|
});
|
|
523
|
-
},
|
|
523
|
+
}, be = ({
|
|
524
524
|
tabsContainerElement: e,
|
|
525
525
|
event: t
|
|
526
526
|
}) => {
|
|
@@ -536,14 +536,14 @@ const le = () => {
|
|
|
536
536
|
}), s.forEach((i) => {
|
|
537
537
|
i.setAttribute("aria-hidden", "true");
|
|
538
538
|
}), o.setAttribute("aria-selected", "true"), a && a.removeAttribute("aria-hidden");
|
|
539
|
-
}, I = (e) => e.code === "ArrowLeft" || e.keyCode === 39, k = (e) => e.code === "ArrowRight" || e.keyCode === 37,
|
|
539
|
+
}, I = (e) => e.code === "ArrowLeft" || e.keyCode === 39, k = (e) => e.code === "ArrowRight" || e.keyCode === 37, ye = (e = document.querySelectorAll(
|
|
540
540
|
".js-tabs"
|
|
541
541
|
)) => {
|
|
542
542
|
e.length > 0 && e.forEach((t) => {
|
|
543
543
|
const o = t.querySelectorAll('[role="tab"]');
|
|
544
544
|
o.forEach((s) => {
|
|
545
545
|
s.addEventListener("click", (r) => {
|
|
546
|
-
|
|
546
|
+
be({ tabsContainerElement: t, event: r });
|
|
547
547
|
});
|
|
548
548
|
});
|
|
549
549
|
const n = t.querySelector('[role="tablist"]');
|
|
@@ -554,9 +554,9 @@ const le = () => {
|
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
556
|
});
|
|
557
|
-
},
|
|
558
|
-
|
|
557
|
+
}, Ee = () => {
|
|
558
|
+
z(), ye(), O(), ie(), Q(), le(), me(), N("olympicsGames", "countdown-olympics-games"), he(), j(), oe(), ne();
|
|
559
559
|
};
|
|
560
560
|
export {
|
|
561
|
-
|
|
561
|
+
Ee as initScripts
|
|
562
562
|
};
|
package/dist/js/scripts.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(p,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(p=typeof globalThis<"u"?globalThis:p||self,h(p.scripts={}))})(this,function(p){"use strict";var Ee=Object.defineProperty;var Se=(p,h,b)=>h in p?Ee(p,h,{enumerable:!0,configurable:!0,writable:!0,value:b}):p[h]=b;var v=(p,h,b)=>(Se(p,typeof h!="symbol"?h+"":h,b),b);const h=new IntersectionObserver(([e])=>{const t=document.querySelector(".c-close-article-btn");t&&(t.style.visibility=e.isIntersecting||e.boundingClientRect.top<0?"hidden":"visible")}),b=()=>{const e=document.querySelector(".js-limit-scroll-close-article-btn");e&&h.observe(e)},j=e=>{e.stopImmediatePropagation(),e.preventDefault();const t=e.currentTarget;if(t instanceof HTMLButtonElement){const o=t.parentElement,n=o==null?void 0:o.querySelector(`#${t.getAttribute("aria-controls")}`);t.getAttribute("aria-expanded")==="true"?(t.setAttribute("aria-expanded","false"),n==null||n.setAttribute("aria-hidden","true")):(t.setAttribute("aria-expanded","true"),n==null||n.setAttribute("aria-hidden","false"))}},F=(e=document.querySelector(".js-collapse__button"))=>{e&&document.querySelectorAll(".c-collapse__button").forEach(o=>{o.addEventListener("click",n=>{j(n)})})},O=(e,t)=>{const o=document.querySelector(`#${t}`);if(o){const n=o.querySelector(".js-countdown-days"),s=o.querySelector(".js-countdown-hours"),r=o.querySelector(".js-countdown-minutes"),a=o.querySelector(".js-countdown-seconds");if(!n||!s||!r||!a)return;window.counters={olympicsGames:"2024-07-26 20:00:00"};const i=window.counters[e],l=new Date(i).getTime(),d=setInterval(()=>{const u=new Date().getTime(),f=l-u;if(f<=0)clearInterval(d);else{const g=Math.floor(f/864e5),y=Math.floor(f%(1e3*60*60*24)/(1e3*60*60)),m=Math.floor(f%(1e3*60*60)/(1e3*60)),ge=Math.floor(f%(1e3*60)/1e3);n.innerHTML=g.toString(),s.innerHTML=y.toString(),r.innerHTML=m.toString(),a.innerHTML=ge.toString()}},1e3)}},N=e=>{var n;e.setAttribute("aria-expanded","true");const t=(n=e.parentNode)==null?void 0:n.querySelectorAll(".js-expand-target");t==null||t.forEach(s=>s.setAttribute("aria-hidden","false"));const o=e.querySelector(".js-expand-button__label");o instanceof HTMLSpanElement&&(o.innerHTML="Voir moins")},B=e=>{var n;const t=(n=e.parentNode)==null?void 0:n.querySelectorAll(".js-expand-target");t==null||t.forEach(s=>s.setAttribute("aria-hidden","true")),e.setAttribute("aria-expanded","false");const o=e.querySelector(".js-expand-button__label");o instanceof HTMLSpanElement&&(o.innerHTML="Voir plus")},P=e=>{const t=e.currentTarget;return e.preventDefault(),t instanceof HTMLButtonElement?t.getAttribute("aria-expanded")==="true"?B(t):N(t):null},K=(e=document.querySelector(".js-expand-button"))=>{e&&document.querySelectorAll(".js-expand-button").forEach(o=>o.addEventListener("click",P))},c={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"};var z=[`a[href]${c.inert}${c.negTabIndex}`,`area[href]${c.inert}${c.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${c.inert}${c.negTabIndex}${c.disabled}`,`input[type="radio"]${c.inert}${c.negTabIndex}${c.disabled}`,`select${c.inert}${c.negTabIndex}${c.disabled}`,`textarea${c.inert}${c.negTabIndex}${c.disabled}`,`button${c.inert}${c.negTabIndex}${c.disabled}`,`details${c.inert} > summary:first-of-type${c.negTabIndex}`,`iframe${c.inert}${c.negTabIndex}`,`audio[controls]${c.inert}${c.negTabIndex}`,`video[controls]${c.inert}${c.negTabIndex}`,`[contenteditable]${c.inert}${c.negTabIndex}`,`[tabindex]${c.inert}${c.negTabIndex}`];function x(e){(e.querySelector("[autofocus]")||e).focus()}function V(e){const t=E(e,!0),o=t?E(e,!1)||t:null;return[t,o]}function E(e,t){if(t&&C(e))return e;if(G(e))if(e.shadowRoot){let o=A(e.shadowRoot,t);for(;o;){const n=E(o,t);if(n)return n;o=q(o,t)}}else if(e.localName==="slot"){const o=e.assignedElements({flatten:!0});t||o.reverse();for(const n of o){const s=E(n,t);if(s)return s}}else{let o=A(e,t);for(;o;){const n=E(o,t);if(n)return n;o=q(o,t)}}return!t&&C(e)?e:null}function A(e,t){return t?e.firstElementChild:e.lastElementChild}function q(e,t){return t?e.nextElementSibling:e.previousElementSibling}const Y=e=>e.matches("details:not([open]) *")&&!e.matches("details>summary:first-of-type")?!0:!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),C=e=>{var t;return(t=e.shadowRoot)!=null&&t.delegatesFocus?!1:e.matches(z.join(","))&&!Y(e)};function G(e){return e.shadowRoot&&e.getAttribute("tabindex")==="-1"?!1:!e.matches(":disabled,[hidden],[inert]")}function L(e=document){const t=e.activeElement;return t?t.shadowRoot?L(t.shadowRoot)||document.activeElement:t:null}function X(e,t){const[o,n]=V(e);if(!o)return t.preventDefault();const s=L();t.shiftKey&&s===o?(n.focus(),t.preventDefault()):!t.shiftKey&&s===n&&(o.focus(),t.preventDefault())}class I{constructor(t){v(this,"$el");v(this,"id");v(this,"previouslyFocused");v(this,"shown");this.$el=t,this.id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0)),this.fire("destroy"),this}show(t){var o;return this.shown?this:(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=L(),((o=this.previouslyFocused)==null?void 0:o.tagName)==="BODY"&&(t!=null&&t.target)&&(this.previouslyFocused=t.target),(t==null?void 0:t.type)==="focus"?this.maintainFocus(t):x(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0),this.fire("show",t),this)}hide(t){var o,n;return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),(n=(o=this.previouslyFocused)==null?void 0:o.focus)==null||n.call(o),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0),this.fire("hide",t),this):this}on(t,o,n){return this.$el.addEventListener(t,o,n),this}off(t,o,n){return this.$el.removeEventListener(t,o,n),this}fire(t,o){this.$el.dispatchEvent(new CustomEvent(t,{detail:o,cancelable:!0}))}handleTriggerClicks(t){const o=t.target;o.closest(`[data-a11y-dialog-show="${this.id}"]`)&&this.show(t),(o.closest(`[data-a11y-dialog-hide="${this.id}"]`)||o.closest("[data-a11y-dialog-hide]")&&o.closest('[aria-modal="true"]')===this.$el)&&this.hide(t)}bindKeypress(t){var n;if(((n=document.activeElement)==null?void 0:n.closest('[aria-modal="true"]'))!==this.$el)return;let o=!1;try{o=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}t.key==="Escape"&&this.$el.getAttribute("role")!=="alertdialog"&&!o&&(t.preventDefault(),this.hide(t)),t.key==="Tab"&&X(this.$el,t)}maintainFocus(t){t.target.closest('[aria-modal="true"], [data-a11y-dialog-ignore-focus-trap]')||x(this.$el)}}function k(){for(const e of document.querySelectorAll("[data-a11y-dialog]"))new I(e)}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k());const J=()=>document.querySelectorAll(".js-modal").forEach(e=>{if(!(e instanceof HTMLElement))return;const t=new I(e),o={x:0,y:0};t.on("show",()=>{o.x=window.scrollX,o.y=window.scrollY,document.body.classList.add("noscroll"),document.body.style.top=`-${o.y}px`}).on("hide",()=>{document.body.classList.remove("noscroll"),document.body.style.top="",(window.scrollY!==o.y||window.scrollX!==o.x)&&window.scroll(o.x,o.y)})}),Q=({navigatedList:e,nextBtn:t,prevBtn:o})=>{var r,a,i,l,d,u,f,g;const n=e.scrollLeft>0,s=e.scrollLeft+e.clientWidth<e.scrollWidth;n&&s?((r=t.classList)==null||r.add("o-nav-button--visible"),(a=o.classList)==null||a.add("o-nav-button--visible")):n?((i=t.classList)==null||i.remove("o-nav-button--visible"),(l=o.classList)==null||l.add("o-nav-button--visible")):s?((d=t.classList)==null||d.add("o-nav-button--visible"),(u=o.classList)==null||u.remove("o-nav-button--visible")):((f=t.classList)==null||f.remove("o-nav-button--visible"),(g=o.classList)==null||g.remove("o-nav-button--visible"))},U=({navigatedList:e,nextBtn:t,prevBtn:o,sliderVariant:n})=>{if(e){const s=e.closest(".js-overview-bar-container"),r=s==null?void 0:s.querySelector(".c-stepper"),a=r==null?void 0:r.querySelectorAll(".c-stepper__item");if(a){const i=Array.from(a).findIndex(l=>l.classList.contains("c-stepper__item--loading"));if(i<0)a[0].classList.add("c-stepper__item--loading");else{a[i].classList.remove("c-stepper__item--loading"),a[i].classList.add("c-stepper__item--loaded");const l=a[i].querySelector(".c-stepper__loader");l&&l instanceof HTMLElement&&(l.style.transition="width 0s linear"),i+1<a.length&&a[i+1].classList.add("c-stepper__item--loading")}}if(e.scrollWidth-e.clientWidth>e.clientWidth){let i=e.scrollLeft;switch(n){case"three-columns-articles":i+=e.clientWidth+32;break;case"rubrics":i+=e.clientWidth-36;break;default:i+=Math.ceil(e.clientWidth*.6);break}e.scrollTo({left:i,behavior:"smooth"}),o.classList.add("o-nav-button--visible"),i+e.clientWidth>=e.scrollWidth&&t.classList.remove("o-nav-button--visible")}else{const i=e.scrollWidth-e.clientWidth;e.scrollTo({left:i,behavior:"smooth"}),t.classList.remove("o-nav-button--visible"),o.classList.add("o-nav-button--visible")}}},Z=({navigatedList:e,nextBtn:t,prevBtn:o,sliderVariant:n,delay:s})=>{if(e){const r=e.closest(".js-overview-bar-container"),a=r==null?void 0:r.querySelector(".c-stepper"),i=a==null?void 0:a.querySelectorAll(".c-stepper__item");if(i){const l=Array.from(i).findIndex(d=>d.classList.contains("c-stepper__item--loading"));l<0?i[0].classList.add("c-stepper__item--loading"):(i[l].classList.remove("c-stepper__item--loading"),i[l].classList.remove("c-stepper__item--loaded"),l-1>0&&(i[l-1].classList.remove("c-stepper__item--loading"),i[l-1].classList.remove("c-stepper__item--loaded"),setTimeout(()=>{const d=i[l-1].querySelector(".c-stepper__loader");i[l-1].classList.add("c-stepper__item--loading"),d&&d instanceof HTMLElement&&(d.style.transition=`width ${s/1e3}s linear`)},0)))}if(e.clientWidth<e.scrollLeft){let l=e.scrollLeft;switch(n){case"three-columns-articles":l-=e.clientWidth+32;break;case"rubrics":l-=e.clientWidth-36;break;default:l-=Math.ceil(e.clientWidth*.6);break}e.scrollTo({left:l,behavior:"smooth"}),t.classList.add("o-nav-button--visible"),l===0&&o.classList.remove("o-nav-button--visible")}else e.scrollTo({left:0,behavior:"smooth"}),o.classList.remove("o-nav-button--visible"),e.clientWidth<e.scrollWidth&&t.classList.add("o-nav-button--visible")}},ee=({navigatedList:e,nextBtn:t,prevBtn:o})=>{Q({navigatedList:e,nextBtn:t,prevBtn:o})},te=()=>{const e=document.querySelectorAll(".js-navigation-container");for(const t of Array.from(e)){const{sliderVariant:o}=t.dataset,{sliderAuto:n}=t.dataset,{sliderDelay:s}=t.dataset,r=s?parseInt(s,10):3e3,a=t.closest(".js-overview-bar-container"),i=a==null?void 0:a.querySelector(".c-stepper"),l=i==null?void 0:i.querySelectorAll(".c-stepper__item");if(t){const d=t.querySelector(".js-navigation-container__list"),u=t.querySelector(".o-nav-button--next-button"),f=t.querySelector(".o-nav-button--previous-button");if(d&&d.clientWidth<d.scrollWidth&&(u==null||u.classList.add("o-nav-button--visible")),d&&u&&f&&(u==null||u.addEventListener("click",U.bind(!1,{navigatedList:d,nextBtn:u,prevBtn:f,sliderVariant:o})),f==null||f.addEventListener("click",Z.bind(!1,{navigatedList:d,nextBtn:u,prevBtn:f,sliderVariant:o,delay:r}))),n==="true"&&u){const g=i?i.querySelector(".c-stepper__item--loading"):null;l&&(l.forEach(y=>{const m=y.querySelector(".c-stepper__loader");m&&m instanceof HTMLElement&&(m.style.transition=`width ${r/1e3}s linear`)}),g||l[0].classList.add("c-stepper__item--loading")),setInterval(()=>{u.classList.contains("o-nav-button--visible")?u.click():d&&f&&(d.scrollLeft=0,l&&(l.forEach(y=>{const m=y.querySelector(".c-stepper__loader");m&&m instanceof HTMLElement&&(m.style.transition="width 0s linear"),y.classList.remove("c-stepper__item--loading"),y.classList.remove("c-stepper__item--loaded"),setTimeout(()=>{m&&m instanceof HTMLElement&&(m.style.transition=`width ${r/1e3}s linear`)},0)}),setTimeout(()=>{l[0].classList.add("c-stepper__item--loading")},0)),f.click())},r)}}}},oe=()=>{const e=document.querySelectorAll(".js-navigation-container");for(const t of Array.from(e))if(t){const o=t.querySelector(".js-navigation-container__list"),n=t.querySelector(".o-nav-button--next-button"),s=t.querySelector(".o-nav-button--previous-button");o&&n&&s&&window.addEventListener("resize",ee.bind(!1,{navigatedList:o,nextBtn:n,prevBtn:s}))}},ne=()=>{const e=document.querySelector(".js-limit-scroll-progress-bar"),t=document.querySelector(".c-progress__bar");if(!t)return;const{documentElement:o}=document;let n=o.scrollHeight-o.clientHeight;if(!n)return;const s=o.scrollTop;e&&(n=e.scrollHeight-o.clientHeight+(window.pageYOffset+e.getBoundingClientRect().top));const r=Math.round(s/n*100);t.style.width=`${r}%`,r>=100&&(t.style.width="100%")},se=()=>{document.querySelector(".c-progress")&&window.addEventListener("scroll",ne)};let S,T=0;const ie=()=>{S=null,document.body.getBoundingClientRect().top>T+2&&(S="up"),document.body.getBoundingClientRect().top<T-2&&(S="down"),T=document.body.getBoundingClientRect().top;const e=document.querySelector(".c-read-also-banner");if(e){const t=e.dataset.bannerLimitTop||"0";S==="up"&&-document.body.getBoundingClientRect().top>=parseInt(t,10)&&(e.classList.remove("c-read-also-banner__scrolldirection--down"),e.style.paddingTop="0.75em",e.style.paddingBottom="0.75em",e.style.borderWidth="1px",e.classList.contains("c-read-also-banner__scrolldirection--up")||e.classList.add("c-read-also-banner__scrolldirection--up")),(S==="down"||-document.body.getBoundingClientRect().top<=parseInt(t,10))&&(e.classList.remove("c-read-also-banner__scrolldirection--up"),e.style.paddingTop="0",e.style.paddingBottom="0",e.style.borderWidth="0",e.classList.contains("c-read-also-banner__scrolldirection--down")||e.classList.add("c-read-also-banner__scrolldirection--down"))}},re=(e=document.querySelector(".c-read-also-banner"))=>{if(e){let t;window.addEventListener("scroll",()=>{clearTimeout(t),t=setTimeout(ie,100)})}},_="#page-content",$="#text-tooltip",le=".tooltip-btn",M="c-text-tooltip--show",ce=["#page-content .c-content p","#page-content .c-content h2","#page-content .c-content h3","#page-content .c-content h4","#page-content .c-content h5","#page-content .c-content h6","#page-content .c-content li","#page-content .c-content span","#page-content header span","#page-content header h1","#page-content header h2"],H=(e,t)=>e instanceof Element?t.some(o=>e.matches(o)):!1,ae=(e,t)=>{const o=e.startContainer.nodeType===Node.ELEMENT_NODE?e.startContainer:e.startContainer.parentElement,n=e.endContainer.nodeType===Node.ELEMENT_NODE?e.endContainer:e.endContainer.parentElement;return!!o&&H(o,t)||!!n&&H(n,t)},de=e=>{var o;if(!e.focusNode)return null;const t=(o=e.anchorNode)==null?void 0:o.compareDocumentPosition(e.focusNode);return t?(t&4)>0:e.anchorOffset<e.focusOffset},ue=(e,t,o)=>{const n=document.querySelector(`${_} ${$}`),s=document.querySelector(`${_}`),r=document.querySelectorAll(`${_} ${$} ${le}`);if(!n||!s){console.warn("Text tooltip : Tooltip or it's parent are not found in the DOM");return}Array.from(r).forEach(l=>l.setAttribute("data-selected-text",o));const a=e.getClientRects(),i=a[t?a.length-1:0];n.style.top=`${i.top-s.getBoundingClientRect().top-(n.offsetHeight+10)}px`,i.width<n.offsetWidth?n.style.left=`${i.left-s.getBoundingClientRect().left+i.width/2-n.offsetWidth/2}px`:t?n.style.left=`${i.left-s.getBoundingClientRect().left+i.width-n.offsetWidth}px`:n.style.left=`${i.left-s.getBoundingClientRect().left}px`,n.classList.add(M)},R=()=>{const e=document.querySelector(`${$}`);e&&e.classList.remove(M)},w=({type:e})=>{const t=window.getSelection();if(e==="selectionchange"){R();return}if(!t||!t.rangeCount)return;const o=t.getRangeAt(0),n=t.toString().trim();if(n.length){const s=ae(o,ce),r=de(t)||!1;s&&ue(o,r,n);return}R()},fe=()=>{if(!(window!=null&&window.getSelection)){console.warn("Selection API isn't supported");return}document.addEventListener("mouseup",w),document.addEventListener("selectionchange",w),document.addEventListener("touchend",w),document.addEventListener("touchcancel",w)},he=e=>{const{target:t}=e;if(t instanceof Element){const o=t.closest(".c-search-form--button");o&&(e.preventDefault(),o.classList.remove("c-search-form--button"))}},pe=(e=document.querySelector(".c-search-form--button"))=>{e&&e.addEventListener("click",t=>{he(t)})},me=({tabsContainerElement:e,event:t})=>{t.preventDefault();const o=t.target;if(!(o instanceof HTMLButtonElement))return;const n=e.querySelectorAll('[role="tab"]'),s=e.querySelectorAll('[role="tabpanel"]'),r=o.getAttribute("aria-controls"),a=Object.values(s).find(i=>i.id===r);n.forEach(i=>{i.setAttribute("aria-selected","false")}),s.forEach(i=>{i.setAttribute("aria-hidden","true")}),o.setAttribute("aria-selected","true"),a&&a.removeAttribute("aria-hidden")},D=e=>e.code==="ArrowLeft"||e.keyCode===39,W=e=>e.code==="ArrowRight"||e.keyCode===37,be=(e=document.querySelectorAll(".js-tabs"))=>{e.length>0&&e.forEach(t=>{const o=t.querySelectorAll('[role="tab"]');o.forEach(s=>{s.addEventListener("click",r=>{me({tabsContainerElement:t,event:r})})});const n=t.querySelector('[role="tablist"]');if(n&&o.length>0){let s=0;n.addEventListener("keydown",r=>{r instanceof KeyboardEvent&&(D(r)||W(r))&&(o[s].setAttribute("tabindex","-1"),D(r)?(s+=1,s>=o.length&&(s=0)):W(r)&&(s-=1,s<0&&(s=o.length-1)),o[s].setAttribute("tabindex","0"),o[s].focus())})}})},ye=()=>{K(),be(),F(),se(),J(),re(),pe(),O("olympicsGames","countdown-olympics-games"),fe(),b(),te(),oe()};p.initScripts=ye,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(p,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(p=typeof globalThis<"u"?globalThis:p||self,h(p.scripts={}))})(this,function(p){"use strict";var ge=Object.defineProperty;var Ee=(p,h,b)=>h in p?ge(p,h,{enumerable:!0,configurable:!0,writable:!0,value:b}):p[h]=b;var S=(p,h,b)=>(Ee(p,typeof h!="symbol"?h+"":h,b),b);const h=()=>{const e=document.querySelector(".js-limit-scroll-close-article-btn");e&&new IntersectionObserver(([o])=>{const n=document.querySelector(".c-close-article-btn");n&&(n.style.visibility=o.isIntersecting||o.boundingClientRect.top<0?"hidden":"visible")}).observe(e)},b=e=>{e.stopImmediatePropagation(),e.preventDefault();const t=e.currentTarget;if(t instanceof HTMLButtonElement){const o=t.parentElement,n=o==null?void 0:o.querySelector(`#${t.getAttribute("aria-controls")}`);t.getAttribute("aria-expanded")==="true"?(t.setAttribute("aria-expanded","false"),n==null||n.setAttribute("aria-hidden","true")):(t.setAttribute("aria-expanded","true"),n==null||n.setAttribute("aria-hidden","false"))}},j=(e=document.querySelector(".js-collapse__button"))=>{e&&document.querySelectorAll(".c-collapse__button").forEach(o=>{o.addEventListener("click",n=>{b(n)})})},F=(e,t)=>{const o=document.querySelector(`#${t}`);if(o){const n=o.querySelector(".js-countdown-days"),s=o.querySelector(".js-countdown-hours"),r=o.querySelector(".js-countdown-minutes"),a=o.querySelector(".js-countdown-seconds");if(!n||!s||!r||!a)return;window.counters={olympicsGames:"2024-07-26 20:00:00"};const i=window.counters[e],l=new Date(i).getTime(),d=setInterval(()=>{const u=new Date().getTime(),f=l-u;if(f<=0)clearInterval(d);else{const g=Math.floor(f/864e5),y=Math.floor(f%(1e3*60*60*24)/(1e3*60*60)),m=Math.floor(f%(1e3*60*60)/(1e3*60)),ye=Math.floor(f%(1e3*60)/1e3);n.innerHTML=g.toString(),s.innerHTML=y.toString(),r.innerHTML=m.toString(),a.innerHTML=ye.toString()}},1e3)}},O=e=>{var n;e.setAttribute("aria-expanded","true");const t=(n=e.parentNode)==null?void 0:n.querySelectorAll(".js-expand-target");t==null||t.forEach(s=>s.setAttribute("aria-hidden","false"));const o=e.querySelector(".js-expand-button__label");o instanceof HTMLSpanElement&&(o.innerHTML="Voir moins")},N=e=>{var n;const t=(n=e.parentNode)==null?void 0:n.querySelectorAll(".js-expand-target");t==null||t.forEach(s=>s.setAttribute("aria-hidden","true")),e.setAttribute("aria-expanded","false");const o=e.querySelector(".js-expand-button__label");o instanceof HTMLSpanElement&&(o.innerHTML="Voir plus")},B=e=>{const t=e.currentTarget;return e.preventDefault(),t instanceof HTMLButtonElement?t.getAttribute("aria-expanded")==="true"?N(t):O(t):null},P=(e=document.querySelector(".js-expand-button"))=>{e&&document.querySelectorAll(".js-expand-button").forEach(o=>o.addEventListener("click",B))},c={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"};var K=[`a[href]${c.inert}${c.negTabIndex}`,`area[href]${c.inert}${c.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${c.inert}${c.negTabIndex}${c.disabled}`,`input[type="radio"]${c.inert}${c.negTabIndex}${c.disabled}`,`select${c.inert}${c.negTabIndex}${c.disabled}`,`textarea${c.inert}${c.negTabIndex}${c.disabled}`,`button${c.inert}${c.negTabIndex}${c.disabled}`,`details${c.inert} > summary:first-of-type${c.negTabIndex}`,`iframe${c.inert}${c.negTabIndex}`,`audio[controls]${c.inert}${c.negTabIndex}`,`video[controls]${c.inert}${c.negTabIndex}`,`[contenteditable]${c.inert}${c.negTabIndex}`,`[tabindex]${c.inert}${c.negTabIndex}`];function x(e){(e.querySelector("[autofocus]")||e).focus()}function z(e){const t=E(e,!0),o=t?E(e,!1)||t:null;return[t,o]}function E(e,t){if(t&&C(e))return e;if(Y(e))if(e.shadowRoot){let o=A(e.shadowRoot,t);for(;o;){const n=E(o,t);if(n)return n;o=q(o,t)}}else if(e.localName==="slot"){const o=e.assignedElements({flatten:!0});t||o.reverse();for(const n of o){const s=E(n,t);if(s)return s}}else{let o=A(e,t);for(;o;){const n=E(o,t);if(n)return n;o=q(o,t)}}return!t&&C(e)?e:null}function A(e,t){return t?e.firstElementChild:e.lastElementChild}function q(e,t){return t?e.nextElementSibling:e.previousElementSibling}const V=e=>e.matches("details:not([open]) *")&&!e.matches("details>summary:first-of-type")?!0:!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),C=e=>{var t;return(t=e.shadowRoot)!=null&&t.delegatesFocus?!1:e.matches(K.join(","))&&!V(e)};function Y(e){return e.shadowRoot&&e.getAttribute("tabindex")==="-1"?!1:!e.matches(":disabled,[hidden],[inert]")}function L(e=document){const t=e.activeElement;return t?t.shadowRoot?L(t.shadowRoot)||document.activeElement:t:null}function G(e,t){const[o,n]=z(e);if(!o)return t.preventDefault();const s=L();t.shiftKey&&s===o?(n.focus(),t.preventDefault()):!t.shiftKey&&s===n&&(o.focus(),t.preventDefault())}class I{constructor(t){S(this,"$el");S(this,"id");S(this,"previouslyFocused");S(this,"shown");this.$el=t,this.id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0)),this.fire("destroy"),this}show(t){var o;return this.shown?this:(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=L(),((o=this.previouslyFocused)==null?void 0:o.tagName)==="BODY"&&(t!=null&&t.target)&&(this.previouslyFocused=t.target),(t==null?void 0:t.type)==="focus"?this.maintainFocus(t):x(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0),this.fire("show",t),this)}hide(t){var o,n;return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),(n=(o=this.previouslyFocused)==null?void 0:o.focus)==null||n.call(o),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0),this.fire("hide",t),this):this}on(t,o,n){return this.$el.addEventListener(t,o,n),this}off(t,o,n){return this.$el.removeEventListener(t,o,n),this}fire(t,o){this.$el.dispatchEvent(new CustomEvent(t,{detail:o,cancelable:!0}))}handleTriggerClicks(t){const o=t.target;o.closest(`[data-a11y-dialog-show="${this.id}"]`)&&this.show(t),(o.closest(`[data-a11y-dialog-hide="${this.id}"]`)||o.closest("[data-a11y-dialog-hide]")&&o.closest('[aria-modal="true"]')===this.$el)&&this.hide(t)}bindKeypress(t){var n;if(((n=document.activeElement)==null?void 0:n.closest('[aria-modal="true"]'))!==this.$el)return;let o=!1;try{o=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}t.key==="Escape"&&this.$el.getAttribute("role")!=="alertdialog"&&!o&&(t.preventDefault(),this.hide(t)),t.key==="Tab"&&G(this.$el,t)}maintainFocus(t){t.target.closest('[aria-modal="true"], [data-a11y-dialog-ignore-focus-trap]')||x(this.$el)}}function k(){for(const e of document.querySelectorAll("[data-a11y-dialog]"))new I(e)}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k());const X=()=>document.querySelectorAll(".js-modal").forEach(e=>{if(!(e instanceof HTMLElement))return;const t=new I(e),o={x:0,y:0};t.on("show",()=>{o.x=window.scrollX,o.y=window.scrollY,document.body.classList.add("noscroll"),document.body.style.top=`-${o.y}px`}).on("hide",()=>{document.body.classList.remove("noscroll"),document.body.style.top="",(window.scrollY!==o.y||window.scrollX!==o.x)&&window.scroll(o.x,o.y)})}),J=({navigatedList:e,nextBtn:t,prevBtn:o})=>{var r,a,i,l,d,u,f,g;const n=e.scrollLeft>0,s=e.scrollLeft+e.clientWidth<e.scrollWidth;n&&s?((r=t.classList)==null||r.add("o-nav-button--visible"),(a=o.classList)==null||a.add("o-nav-button--visible")):n?((i=t.classList)==null||i.remove("o-nav-button--visible"),(l=o.classList)==null||l.add("o-nav-button--visible")):s?((d=t.classList)==null||d.add("o-nav-button--visible"),(u=o.classList)==null||u.remove("o-nav-button--visible")):((f=t.classList)==null||f.remove("o-nav-button--visible"),(g=o.classList)==null||g.remove("o-nav-button--visible"))},Q=({navigatedList:e,nextBtn:t,prevBtn:o,sliderVariant:n})=>{if(e){const s=e.closest(".js-overview-bar-container"),r=s==null?void 0:s.querySelector(".c-stepper"),a=r==null?void 0:r.querySelectorAll(".c-stepper__item");if(a){const i=Array.from(a).findIndex(l=>l.classList.contains("c-stepper__item--loading"));if(i<0)a[0].classList.add("c-stepper__item--loading");else{a[i].classList.remove("c-stepper__item--loading"),a[i].classList.add("c-stepper__item--loaded");const l=a[i].querySelector(".c-stepper__loader");l&&l instanceof HTMLElement&&(l.style.transition="width 0s linear"),i+1<a.length&&a[i+1].classList.add("c-stepper__item--loading")}}if(e.scrollWidth-e.clientWidth>e.clientWidth){let i=e.scrollLeft;switch(n){case"three-columns-articles":i+=e.clientWidth+32;break;case"rubrics":i+=e.clientWidth-36;break;default:i+=Math.ceil(e.clientWidth*.6);break}e.scrollTo({left:i,behavior:"smooth"}),o.classList.add("o-nav-button--visible"),i+e.clientWidth>=e.scrollWidth&&t.classList.remove("o-nav-button--visible")}else{const i=e.scrollWidth-e.clientWidth;e.scrollTo({left:i,behavior:"smooth"}),t.classList.remove("o-nav-button--visible"),o.classList.add("o-nav-button--visible")}}},U=({navigatedList:e,nextBtn:t,prevBtn:o,sliderVariant:n,delay:s})=>{if(e){const r=e.closest(".js-overview-bar-container"),a=r==null?void 0:r.querySelector(".c-stepper"),i=a==null?void 0:a.querySelectorAll(".c-stepper__item");if(i){const l=Array.from(i).findIndex(d=>d.classList.contains("c-stepper__item--loading"));l<0?i[0].classList.add("c-stepper__item--loading"):(i[l].classList.remove("c-stepper__item--loading"),i[l].classList.remove("c-stepper__item--loaded"),l-1>0&&(i[l-1].classList.remove("c-stepper__item--loading"),i[l-1].classList.remove("c-stepper__item--loaded"),setTimeout(()=>{const d=i[l-1].querySelector(".c-stepper__loader");i[l-1].classList.add("c-stepper__item--loading"),d&&d instanceof HTMLElement&&(d.style.transition=`width ${s/1e3}s linear`)},0)))}if(e.clientWidth<e.scrollLeft){let l=e.scrollLeft;switch(n){case"three-columns-articles":l-=e.clientWidth+32;break;case"rubrics":l-=e.clientWidth-36;break;default:l-=Math.ceil(e.clientWidth*.6);break}e.scrollTo({left:l,behavior:"smooth"}),t.classList.add("o-nav-button--visible"),l===0&&o.classList.remove("o-nav-button--visible")}else e.scrollTo({left:0,behavior:"smooth"}),o.classList.remove("o-nav-button--visible"),e.clientWidth<e.scrollWidth&&t.classList.add("o-nav-button--visible")}},Z=({navigatedList:e,nextBtn:t,prevBtn:o})=>{J({navigatedList:e,nextBtn:t,prevBtn:o})},ee=()=>{const e=document.querySelectorAll(".js-navigation-container");for(const t of Array.from(e)){const{sliderVariant:o}=t.dataset,{sliderAuto:n}=t.dataset,{sliderDelay:s}=t.dataset,r=s?parseInt(s,10):3e3,a=t.closest(".js-overview-bar-container"),i=a==null?void 0:a.querySelector(".c-stepper"),l=i==null?void 0:i.querySelectorAll(".c-stepper__item");if(t){const d=t.querySelector(".js-navigation-container__list"),u=t.querySelector(".o-nav-button--next-button"),f=t.querySelector(".o-nav-button--previous-button");if(d&&d.clientWidth<d.scrollWidth&&(u==null||u.classList.add("o-nav-button--visible")),d&&u&&f&&(u==null||u.addEventListener("click",Q.bind(!1,{navigatedList:d,nextBtn:u,prevBtn:f,sliderVariant:o})),f==null||f.addEventListener("click",U.bind(!1,{navigatedList:d,nextBtn:u,prevBtn:f,sliderVariant:o,delay:r}))),n==="true"&&u){const g=i?i.querySelector(".c-stepper__item--loading"):null;l&&(l.forEach(y=>{const m=y.querySelector(".c-stepper__loader");m&&m instanceof HTMLElement&&(m.style.transition=`width ${r/1e3}s linear`)}),g||l[0].classList.add("c-stepper__item--loading")),setInterval(()=>{u.classList.contains("o-nav-button--visible")?u.click():d&&f&&(d.scrollLeft=0,l&&(l.forEach(y=>{const m=y.querySelector(".c-stepper__loader");m&&m instanceof HTMLElement&&(m.style.transition="width 0s linear"),y.classList.remove("c-stepper__item--loading"),y.classList.remove("c-stepper__item--loaded"),setTimeout(()=>{m&&m instanceof HTMLElement&&(m.style.transition=`width ${r/1e3}s linear`)},0)}),setTimeout(()=>{l[0].classList.add("c-stepper__item--loading")},0)),f.click())},r)}}}},te=()=>{const e=document.querySelectorAll(".js-navigation-container");for(const t of Array.from(e))if(t){const o=t.querySelector(".js-navigation-container__list"),n=t.querySelector(".o-nav-button--next-button"),s=t.querySelector(".o-nav-button--previous-button");o&&n&&s&&window.addEventListener("resize",Z.bind(!1,{navigatedList:o,nextBtn:n,prevBtn:s}))}},oe=()=>{const e=document.querySelector(".js-limit-scroll-progress-bar"),t=document.querySelector(".c-progress__bar");if(!t)return;const{documentElement:o}=document;let n=o.scrollHeight-o.clientHeight;if(!n)return;const s=o.scrollTop;e&&(n=e.scrollHeight-o.clientHeight+(window.pageYOffset+e.getBoundingClientRect().top));const r=Math.round(s/n*100);t.style.width=`${r}%`,r>=100&&(t.style.width="100%")},ne=()=>{document.querySelector(".c-progress")&&window.addEventListener("scroll",oe)};let v,T=0;const se=()=>{v=null,document.body.getBoundingClientRect().top>T+2&&(v="up"),document.body.getBoundingClientRect().top<T-2&&(v="down"),T=document.body.getBoundingClientRect().top;const e=document.querySelector(".c-read-also-banner");if(e){const t=e.dataset.bannerLimitTop||"0";v==="up"&&-document.body.getBoundingClientRect().top>=parseInt(t,10)&&(e.classList.remove("c-read-also-banner__scrolldirection--down"),e.style.paddingTop="0.75em",e.style.paddingBottom="0.75em",e.style.borderWidth="1px",e.classList.contains("c-read-also-banner__scrolldirection--up")||e.classList.add("c-read-also-banner__scrolldirection--up")),(v==="down"||-document.body.getBoundingClientRect().top<=parseInt(t,10))&&(e.classList.remove("c-read-also-banner__scrolldirection--up"),e.style.paddingTop="0",e.style.paddingBottom="0",e.style.borderWidth="0",e.classList.contains("c-read-also-banner__scrolldirection--down")||e.classList.add("c-read-also-banner__scrolldirection--down"))}},ie=(e=document.querySelector(".c-read-also-banner"))=>{if(e){let t;window.addEventListener("scroll",()=>{clearTimeout(t),t=setTimeout(se,100)})}},_="#page-content",$="#text-tooltip",re=".tooltip-btn",M="c-text-tooltip--show",le=["#page-content .c-content p","#page-content .c-content h2","#page-content .c-content h3","#page-content .c-content h4","#page-content .c-content h5","#page-content .c-content h6","#page-content .c-content li","#page-content .c-content span","#page-content header span","#page-content header h1","#page-content header h2"],H=(e,t)=>e instanceof Element?t.some(o=>e.matches(o)):!1,ce=(e,t)=>{const o=e.startContainer.nodeType===Node.ELEMENT_NODE?e.startContainer:e.startContainer.parentElement,n=e.endContainer.nodeType===Node.ELEMENT_NODE?e.endContainer:e.endContainer.parentElement;return!!o&&H(o,t)||!!n&&H(n,t)},ae=e=>{var o;if(!e.focusNode)return null;const t=(o=e.anchorNode)==null?void 0:o.compareDocumentPosition(e.focusNode);return t?(t&4)>0:e.anchorOffset<e.focusOffset},de=(e,t,o)=>{const n=document.querySelector(`${_} ${$}`),s=document.querySelector(`${_}`),r=document.querySelectorAll(`${_} ${$} ${re}`);if(!n||!s){console.warn("Text tooltip : Tooltip or it's parent are not found in the DOM");return}Array.from(r).forEach(l=>l.setAttribute("data-selected-text",o));const a=e.getClientRects(),i=a[t?a.length-1:0];n.style.top=`${i.top-s.getBoundingClientRect().top-(n.offsetHeight+10)}px`,i.width<n.offsetWidth?n.style.left=`${i.left-s.getBoundingClientRect().left+i.width/2-n.offsetWidth/2}px`:t?n.style.left=`${i.left-s.getBoundingClientRect().left+i.width-n.offsetWidth}px`:n.style.left=`${i.left-s.getBoundingClientRect().left}px`,n.classList.add(M)},R=()=>{const e=document.querySelector(`${$}`);e&&e.classList.remove(M)},w=({type:e})=>{const t=window.getSelection();if(e==="selectionchange"){R();return}if(!t||!t.rangeCount)return;const o=t.getRangeAt(0),n=t.toString().trim();if(n.length){const s=ce(o,le),r=ae(t)||!1;s&&de(o,r,n);return}R()},ue=()=>{if(!(window!=null&&window.getSelection)){console.warn("Selection API isn't supported");return}document.addEventListener("mouseup",w),document.addEventListener("selectionchange",w),document.addEventListener("touchend",w),document.addEventListener("touchcancel",w)},fe=e=>{const{target:t}=e;if(t instanceof Element){const o=t.closest(".c-search-form--button");o&&(e.preventDefault(),o.classList.remove("c-search-form--button"))}},he=(e=document.querySelector(".c-search-form--button"))=>{e&&e.addEventListener("click",t=>{fe(t)})},pe=({tabsContainerElement:e,event:t})=>{t.preventDefault();const o=t.target;if(!(o instanceof HTMLButtonElement))return;const n=e.querySelectorAll('[role="tab"]'),s=e.querySelectorAll('[role="tabpanel"]'),r=o.getAttribute("aria-controls"),a=Object.values(s).find(i=>i.id===r);n.forEach(i=>{i.setAttribute("aria-selected","false")}),s.forEach(i=>{i.setAttribute("aria-hidden","true")}),o.setAttribute("aria-selected","true"),a&&a.removeAttribute("aria-hidden")},D=e=>e.code==="ArrowLeft"||e.keyCode===39,W=e=>e.code==="ArrowRight"||e.keyCode===37,me=(e=document.querySelectorAll(".js-tabs"))=>{e.length>0&&e.forEach(t=>{const o=t.querySelectorAll('[role="tab"]');o.forEach(s=>{s.addEventListener("click",r=>{pe({tabsContainerElement:t,event:r})})});const n=t.querySelector('[role="tablist"]');if(n&&o.length>0){let s=0;n.addEventListener("keydown",r=>{r instanceof KeyboardEvent&&(D(r)||W(r))&&(o[s].setAttribute("tabindex","-1"),D(r)?(s+=1,s>=o.length&&(s=0)):W(r)&&(s-=1,s<0&&(s=o.length-1)),o[s].setAttribute("tabindex","0"),o[s].focus())})}})},be=()=>{P(),me(),j(),ne(),X(),ie(),he(),F("olympicsGames","countdown-olympics-games"),ue(),h(),ee(),te()};p.initScripts=be,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@20minutes/hela",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"repository": "git@github.com:20minutes/hela.git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "20 Minutes",
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
"@storybook/react": "^8.0.6",
|
|
83
83
|
"@storybook/react-vite": "^8.0.6",
|
|
84
84
|
"@svgr/cli": "^8.1.0",
|
|
85
|
-
"@testing-library/react": "^14.
|
|
85
|
+
"@testing-library/react": "^14.3.0",
|
|
86
86
|
"@types/merge-stream": "^1.1.5",
|
|
87
87
|
"@types/node": "^20.12.5",
|
|
88
|
-
"@types/react": "^18.2.
|
|
88
|
+
"@types/react": "^18.2.75",
|
|
89
89
|
"@types/react-dom": "^18.2.24",
|
|
90
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
91
|
-
"@typescript-eslint/parser": "^7.
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
91
|
+
"@typescript-eslint/parser": "^7.6.0",
|
|
92
92
|
"@vitejs/plugin-react": "^4.2.1",
|
|
93
93
|
"autoprefixer": "^10.4.19",
|
|
94
94
|
"dotenv": "^16.4.5",
|