PageSourceSearch

https://www.camaloon.fr/blog/wp-content/themes/twentytwentyfive-child/connectif.js?ver=1787381521

js camaloon.fr collected 2026-09-28 11:13:41 UTC 4,785 bytes, 176 lines download raw bytes

1/* ---------------------------------------------------------
21. Tag de Connectif - CML FR
3--------------------------------------------------------- */
4!function (document) {
5  function loadConnectif() {
6    var syncId = 'ece1b8fc-9f22-496c-a004-c8914703e885';
7    var scriptId = '__cn_client_script_' + syncId;
8
9    if (document.getElementById(scriptId)) return;
10
11    var script = document.createElement('script');
12    script.src = 'https://cdn.connectif.cloud/eu5/client-script/' + syncId;
13    script.id = scriptId;
14    document.body.appendChild(script);
15  }
16
17  if (document.readyState === 'complete' || document.readyState === 'interactive') {
18    loadConnectif();
19  } else {
20    document.addEventListener('DOMContentLoaded', loadConnectif);
21  }
22}(document);
23
24
25/* ---------------------------------------------------------
262. Formularios de newsletter (.cnf-nl)
27--------------------------------------------------------- */
28(function () {
29  if (window.__cnfNlBound) return;
30  window.__cnfNlBound = true;
31
32  var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,}$/;
33  var CONNECTIF_TIMEOUT = 4000;
34
35  function sendEvents(email, done) {
36    var finished = false;
37
38    function finish(error) {
39      if (finished) return;
40      finished = true;
41      done(error || null);
42    }
43
44    function fire() {
45      if (finished) return;
46
47      try {
48        var result = window.connectif.managed.sendEvents(
49          [
50            {
51              type: 'newsletter-subscribe',
52              email: email
53            },
54            {
55              type: 'custom',
56              eventAlias: 'newsletter-blog-cml-fr',
57              payload: {
58                email: email
59              }
60            }
61          ],
62          {
63            entityInfo: {
64              primaryKey: email,
65              email: email,
66              _newsletterSubscriptionStatus: 'subscribed'
67            }
68          }
69        );
70
71        if (result && typeof result.then === 'function') {
72          result.then(function () { finish(); }, finish);
73        } else {
74          finish();
75        }
76      } catch (error) {
77        finish(error);
78      }
79    }
80
81    var ready =
82      window.connectif &&
83      window.connectif.managed &&
84      typeof window.connectif.managed.isInitialized === 'function' &&
85      window.connectif.managed.isInitialized();
86
87    if (ready) {
88      fire();
89    } else {
90      document.addEventListener('connectif.initialized', fire, { once: true });
91
92      window.setTimeout(function () {
93        finish(new Error('Connectif ne s\'est pas initialisé à temps.'));
94      }, CONNECTIF_TIMEOUT);
95    }
96  }
97
98  document.addEventListener('submit', function (event) {
99    var form = event.target && event.target.closest
100      ? event.target.closest('.cnf-nl__form')
101      : null;
102
103    if (!form) return;
104
105    event.preventDefault();
106
107    var wrapper = form.closest('.cnf-nl');
108    var input = form.querySelector('.cnf-nl__email');
109    var button = form.querySelector('.cnf-nl__submit');
110
111    if (!wrapper || !input || !button) return;
112
113    var email = (input.value || '').trim();
114
115    if (!EMAIL_RE.test(email)) {
116      input.setCustomValidity(
117        input.dataset.cnfMsg || 'Saisissez une adresse e-mail valide.'
118      );
119      input.reportValidity();
120      return;
121    }
122
123    input.setCustomValidity('');
124    button.disabled = true;
125
126    sendEvents(email, function (error) {
127      button.disabled = false;
128
129      if (error) {
130        console.error('Erreur lors de l\'envoi des événements à Connectif :', error);
131        input.setCustomValidity(
132          input.dataset.cnfError || 'Nous n\'avons pas pu finaliser votre inscription. Veuillez réessayer.'
133        );
134        input.reportValidity();
135        return;
136      }
137
138      input.value = '';
139
140      var popup = wrapper.querySelector('.cnf-nl__popup');
141      if (!popup) return;
142
143      popup.classList.add('is-open');
144
145      var closeButton = popup.querySelector('.cnf-nl__popup-close');
146      if (closeButton) closeButton.focus();
147    });
148  });
149
150  document.addEventListener('input', function (event) {
151    if (event.target.classList.contains('cnf-nl__email')) {
152      event.target.setCustomValidity('');
153    }
154  });
155
156  document.addEventListener('click', function (event) {
157    if (!event.target.closest) return;
158
159    var closeButton = event.target.closest('.cnf-nl__popup-close');
160    if (closeButton) {
161      closeButton.closest('.cnf-nl__popup').classList.remove('is-open');
162      return;
163    }
164
165    if (event.target.classList.contains('cnf-nl__popup')) {
166      event.target.classList.remove('is-open');
167    }
168  });
169
170  document.addEventListener('keydown', function (event) {
171    if (event.key !== 'Escape') return;
172
173    var popup = document.querySelector('.cnf-nl__popup.is-open');
174    if (popup) popup.classList.remove('is-open');
175  });
176}());

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.