PageSourceSearch

https://coeurfibre.fr/core/views/c-ur-fibre-tech/assets/js/main.js?rnd=19030

js coeurfibre.fr collected 2026-09-25 11:12:35 UTC 3,781 bytes, 97 lines download raw bytes

1(function () {
2  'use strict';
3
4  var nav = document.querySelector('[class*="-nav-mobile"]') || document.querySelector('[id*="-nav-mobile"]') || document.querySelector('[class*="-drawer"]') || document.querySelector('.b2c-nav');
5
6  if (nav) {
7    var headerCta = document.querySelector('.b2c-header .b2c-btn--cta, .b2c-header__cta a');
8    if (headerCta && !nav.querySelector('.b2c-btn--cta')) {
9      var ctaClone = headerCta.cloneNode(true);
10      ctaClone.classList.add('b2c-nav-cta-clone');
11      nav.appendChild(ctaClone);
12    }
13  }
14
15  function openCTO() {
16    var existing = document.querySelector('.b2c-cto-modal');
17    if (existing) {
18      existing.classList.add('is-open');
19      return;
20    }
21    var html = '<div class="b2c-cto-modal is-open" role="dialog" aria-modal="true">'
22             + '  <div class="b2c-cto-card">'
23             + '    <button class="b2c-cto-close" aria-label="Fermer">&times;</button>'
24             + '    <h3>Notre lettre éditoriale</h3>'
25             + '    <p>Un email par mois pour aller au-delà des manchettes.</p>'
26             + '    <form class="b2c-cto-form" method="post">'
27             + '      <button type="submit" class="b2c-btn b2c-btn--cto">S’abonner</button>'
28             + '    </form>'
29             + '  </div>'
30             + '</div>';
31    document.body.insertAdjacentHTML('beforeend', html);
32    var modal = document.querySelector('.b2c-cto-modal');
33    var close = modal.querySelector('.b2c-cto-close');
34    close.addEventListener('click', function () { modal.classList.remove('is-open'); });
35    modal.addEventListener('click', function (e) {
36      if (e.target === modal) { modal.classList.remove('is-open'); }
37    });
38    var email = modal.querySelector('input[type="email"]');
39    setTimeout(function () { if (email) email.focus(); }, 200);
40  }
41  document.querySelectorAll('[data-b2c-cto]').forEach(function (trigger) {
42    trigger.addEventListener('click', function (e) {
43      e.preventDefault();
44      openCTO();
45    });
46  });
47
48  window.B2C_helpers = {
49    countTo: function (el, target, duration) {
50      duration = duration || 800;
51      var start = 0, startTime = null;
52      function step(ts) {
53        if (!startTime) startTime = ts;
54        var p = Math.min((ts - startTime) / duration, 1);
55        el.textContent = Math.floor(p * target);
56        if (p < 1) requestAnimationFrame(step);
57      }
58      requestAnimationFrame(step);
59    },
60    quizResult: function (scores, results) {
61      var max = 0, winner = null;
62      Object.keys(scores).forEach(function (k) {
63        if (scores[k] > max) { max = scores[k]; winner = k; }
64      });
65      return results[winner] || { title: '—', body: 'Aucun résultat.' };
66    },
67    formatNumber: function (n, decimals) {
68      return Number(n).toLocaleString('fr-FR', {
69        minimumFractionDigits: decimals || 0,
70        maximumFractionDigits: decimals || 0,
71      });
72    },
73  };
74})();
75
76
77(function(){
78  if (!('IntersectionObserver' in window)) return;
79  var zoomHero = document.querySelector('[class*="hero--zoom-on-scroll"]');
80  if (zoomHero) {
81    var ioZoom = new IntersectionObserver(function(entries){
82      entries.forEach(function(e){
83        if (e.isIntersecting) { zoomHero.classList.add('is-zoomed'); ioZoom.disconnect(); }
84      });
85    }, {threshold: .1});
86    ioZoom.observe(zoomHero);
87  }
88  var fadeHero = document.querySelector('[class*="hero--fade-reveal"]');
89  if (fadeHero) {
90    var ioFade = new IntersectionObserver(function(entries){
91      entries.forEach(function(e){
92        if (e.isIntersecting) { fadeHero.classList.add('is-revealed'); ioFade.disconnect(); }
93      });
94    }, {threshold: .05});
95    ioFade.observe(fadeHero);
96  }
97})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.