@20minutes/hela 2.12.21 → 2.12.23

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.
@@ -11,18 +11,15 @@ const Tt = () => /Android/i.test(navigator.userAgent), Ct = typeof window < "u"
11
11
  });
12
12
  }, Dt = () => {
13
13
  const s = document.querySelector(".c-search-banner");
14
- if (s) {
15
- const t = document.querySelector("#js-search-banner-to-hide"), e = s.querySelector("#js-search-banner-dropdown-btn");
16
- e?.addEventListener("click", () => {
17
- const n = e.querySelector("svg")?.querySelector("use");
18
- switch (n?.getAttribute("xlink:href")) {
19
- case "#chevron-up":
20
- n?.setAttribute("xlink:href", "#chevron-down"), t?.classList.add("u-hidden");
21
- break;
22
- case "#chevron-down":
23
- n?.setAttribute("xlink:href", "#chevron-up"), t?.classList.remove("u-hidden");
24
- break;
25
- }
14
+ if (!s)
15
+ return;
16
+ const t = document.getElementById("js-search-banner-expand-button");
17
+ if (t instanceof HTMLButtonElement) {
18
+ const e = s.querySelector("[aria-expanded]"), i = s.querySelector("[aria-hidden]");
19
+ if (!e || !i)
20
+ return;
21
+ t.addEventListener("click", () => {
22
+ e.getAttribute("aria-expanded") === "true" ? (e.setAttribute("aria-expanded", "false"), i.setAttribute("aria-hidden", "true")) : (e.setAttribute("aria-expanded", "true"), i.setAttribute("aria-hidden", "false"));
26
23
  });
27
24
  }
28
25
  }, Mt = [
@@ -154,7 +151,7 @@ const Tt = () => /Android/i.test(navigator.userAgent), Ct = typeof window < "u"
154
151
  return [t.x - e, t.y - e, t.width + e * 2, t.height + e * 2].join(
155
152
  " "
156
153
  );
157
- }, Nt = () => {
154
+ }, Bt = () => {
158
155
  const s = document.querySelector(".c-map-districts-container"), t = document.querySelector(".c-map-districts");
159
156
  if (!s || !t)
160
157
  return;
@@ -243,7 +240,7 @@ const Tt = () => /Android/i.test(navigator.userAgent), Ct = typeof window < "u"
243
240
  }), s.addEventListener("focusin", () => {
244
241
  t.childElementCount > 0 && t.classList.remove("u-hidden");
245
242
  });
246
- }, Bt = (s, t) => {
243
+ }, Nt = (s, t) => {
247
244
  s.setAttribute("aria-expanded", "true"), s.parentNode?.querySelectorAll(".js-ellipsis-target")?.forEach((n) => n.classList.remove(t));
248
245
  const i = s.querySelector(".js-ellipsis-button__label");
249
246
  i instanceof HTMLSpanElement && (i.innerHTML = "Voir moins");
@@ -255,7 +252,7 @@ const Tt = () => /Android/i.test(navigator.userAgent), Ct = typeof window < "u"
255
252
  const e = s.currentTarget;
256
253
  if (s.preventDefault(), e instanceof HTMLButtonElement) {
257
254
  const i = t ? "u-ellipsis-multiline" : "u-ellipsis";
258
- return e.getAttribute("aria-expanded") === "true" ? Wt(e, i) : Bt(e, i);
255
+ return e.getAttribute("aria-expanded") === "true" ? Wt(e, i) : Nt(e, i);
259
256
  }
260
257
  return null;
261
258
  }, jt = (s = document.querySelector(
@@ -2344,7 +2341,7 @@ class Fe {
2344
2341
  }
2345
2342
  }
2346
2343
  const ke = 12, qe = 0.75;
2347
- class Ne {
2344
+ class Be {
2348
2345
  /**
2349
2346
  * @param {number} initialVelocity Initial velocity, px per ms.
2350
2347
  *
@@ -2401,7 +2398,7 @@ class He {
2401
2398
  naturalFrequency: c
2402
2399
  } = t;
2403
2400
  this.onFinish = a;
2404
- const h = new Ne(n, l, c);
2401
+ const h = new Be(n, l, c);
2405
2402
  let d = Date.now(), p = e - i;
2406
2403
  const m = () => {
2407
2404
  this._raf && (p = h.easeFrame(p, Date.now() - d), Math.abs(p) < 1 && Math.abs(h.velocity) < 50 ? (o(i), r && r(), this.onFinish()) : (d = Date.now(), o(p + i), this._raf = requestAnimationFrame(m)));
@@ -2413,7 +2410,7 @@ class He {
2413
2410
  this._raf >= 0 && cancelAnimationFrame(this._raf), this._raf = 0;
2414
2411
  }
2415
2412
  }
2416
- class Be {
2413
+ class Ne {
2417
2414
  constructor() {
2418
2415
  this.activeAnimations = [];
2419
2416
  }
@@ -3507,7 +3504,7 @@ class pi extends hi {
3507
3504
  }, this.viewportSize = {
3508
3505
  x: 0,
3509
3506
  y: 0
3510
- }, this.bgOpacity = 1, this.currIndex = 0, this.potentialIndex = 0, this.isOpen = !1, this.isDestroying = !1, this.hasMouse = !1, this._initialItemData = {}, this._initialThumbBounds = void 0, this.topBar = void 0, this.element = void 0, this.template = void 0, this.container = void 0, this.scrollWrap = void 0, this.currSlide = void 0, this.events = new _e(), this.animations = new Be(), this.mainScroll = new Me(this), this.gestures = new Oe(this), this.opener = new di(this), this.keyboard = new Re(this), this.contentLoader = new ci(this);
3507
+ }, this.bgOpacity = 1, this.currIndex = 0, this.potentialIndex = 0, this.isOpen = !1, this.isDestroying = !1, this.hasMouse = !1, this._initialItemData = {}, this._initialThumbBounds = void 0, this.topBar = void 0, this.element = void 0, this.template = void 0, this.container = void 0, this.scrollWrap = void 0, this.currSlide = void 0, this.events = new _e(), this.animations = new Ne(), this.mainScroll = new Me(this), this.gestures = new Oe(this), this.opener = new di(this), this.keyboard = new Re(this), this.contentLoader = new ci(this);
3511
3508
  }
3512
3509
  /** @returns {boolean} */
3513
3510
  init() {
@@ -4575,7 +4572,7 @@ const xi = () => {
4575
4572
  });
4576
4573
  };
4577
4574
  window.addEventListener("scroll", r), i.addEventListener("click", a), r();
4578
- }, B = "#page-content", U = "#text-tooltip", zi = ".tooltip-btn", xt = "c-text-tooltip--show", Oi = [
4575
+ }, N = "#page-content", U = "#text-tooltip", zi = ".tooltip-btn", xt = "c-text-tooltip--show", Oi = [
4579
4576
  "#page-content .c-content p",
4580
4577
  "#page-content .c-content h2",
4581
4578
  "#page-content .c-content h3",
@@ -4596,8 +4593,8 @@ const xi = () => {
4596
4593
  const t = s.anchorNode?.compareDocumentPosition(s.focusNode);
4597
4594
  return t ? (t & 4) > 0 : s.anchorOffset < s.focusOffset;
4598
4595
  }, $i = (s, t, e) => {
4599
- const i = document.querySelector(`${B} ${U}`), n = document.querySelector(`${B}`), o = document.querySelectorAll(
4600
- `${B} ${U} ${zi}`
4596
+ const i = document.querySelector(`${N} ${U}`), n = document.querySelector(`${N}`), o = document.querySelectorAll(
4597
+ `${N} ${U} ${zi}`
4601
4598
  );
4602
4599
  if (!i || !n) {
4603
4600
  console.warn("Text tooltip : Tooltip or it's parent are not found in the DOM");
@@ -4609,7 +4606,7 @@ const xi = () => {
4609
4606
  }, dt = () => {
4610
4607
  const s = document.querySelector(`${U}`);
4611
4608
  s && s.classList.remove(xt);
4612
- }, N = ({ type: s }) => {
4609
+ }, B = ({ type: s }) => {
4613
4610
  const t = window.getSelection();
4614
4611
  if (s === "selectionchange") {
4615
4612
  dt();
@@ -4629,7 +4626,7 @@ const xi = () => {
4629
4626
  console.warn("Selection API isn't supported");
4630
4627
  return;
4631
4628
  }
4632
- document.addEventListener("mouseup", N), document.addEventListener("selectionchange", N), document.addEventListener("touchend", N), document.addEventListener("touchcancel", N);
4629
+ document.addEventListener("mouseup", B), document.addEventListener("selectionchange", B), document.addEventListener("touchend", B), document.addEventListener("touchcancel", B);
4633
4630
  }, Zi = (s) => {
4634
4631
  const { target: t } = s;
4635
4632
  if (t instanceof Element) {
@@ -4682,7 +4679,7 @@ const xi = () => {
4682
4679
  }, It = () => {
4683
4680
  const s = /* @__PURE__ */ new Date(), t = s.getHours(), e = s.getMinutes();
4684
4681
  return t * 60 + e;
4685
- }, Ni = (s, t) => {
4682
+ }, Bi = (s, t) => {
4686
4683
  const e = It();
4687
4684
  if (e < s || e > t)
4688
4685
  return 0;
@@ -4697,14 +4694,14 @@ const xi = () => {
4697
4694
  const l = H(o.textContent), c = H(a[r + 1].textContent);
4698
4695
  return t >= l && t < c ? (e = o.textContent, i = a[r + 1].textContent, n = r, !0) : !1;
4699
4696
  }), { currentIntervalStartTime: e, currentIntervalEndTime: i, currentIntervalIndex: n };
4700
- }, Bi = () => {
4697
+ }, Ni = () => {
4701
4698
  const s = document.querySelectorAll(".c-timeline__time");
4702
4699
  if (!s || s.length < 2)
4703
4700
  return;
4704
4701
  const t = document.querySelector(".c-timeline__progress-bar"), { currentIntervalStartTime: e, currentIntervalEndTime: i, currentIntervalIndex: n } = Hi(s);
4705
4702
  if (!e || !i)
4706
4703
  return;
4707
- const o = H(e), r = H(i), a = Ni(o, r);
4704
+ const o = H(e), r = H(i), a = Bi(o, r);
4708
4705
  if (t instanceof HTMLElement) {
4709
4706
  if (t.classList.contains("c-timeline__progress-bar--is-desktop") && s.length >= 5) {
4710
4707
  const l = "172px / 2";
@@ -4762,7 +4759,7 @@ const xi = () => {
4762
4759
  "?searchValue=",
4763
4760
  "text",
4764
4761
  "text"
4765
- ), Nt(), Vi(), Ot(), Dt(), Jt(), de(), ue(), Yt(), zt(), Bi(), Ci();
4762
+ ), Bt(), Vi(), Ot(), Dt(), Jt(), de(), ue(), Yt(), zt(), Ni(), Ci();
4766
4763
  };
4767
4764
  export {
4768
4765
  Qi as initScripts