1document.addEventListener('DOMContentLoaded', function () { 2 // Attendre que le script Endorsely charge et définisse window.endorsely_referral 3 const checkEndorselyInterval = setInterval(function() { 4 const referralId = window.endorsely_referral || null; 5 6 if (referralId) { 7 clearInterval(checkEndorselyInterval); 8 9 // Si l'utilisateur est connecté, sauvegarder via AJAX 10 if (typeof ajaxurl !== 'undefined') { 11 // Envoyer le referral_id au serveur via AJAX 12 const formData = new FormData(); 13 formData.append('action', 'save_endorsely_referral_ajax'); 14 formData.append('referral_id', referralId); 15 formData.append('nonce', endorselyData?.nonce || ''); 16 17 fetch(ajaxurl, { 18 method: 'POST', 19 body: formData 20 }) 21 .then(response => response.json()) 22 .then(data => { 23 if (data.success) { 24 console.log('Endorsely referral saved:', referralId); 25 } 26 }) 27 .catch(error => { 28 console.error('Error saving Endorsely referral:', error); 29 }); 30 } 31 32 // Remplir également le champ caché pour les formulaires d'inscription 33 const referralInput = document.getElementById('endorsely_referral'); 34 if (referralInput) { 35 referralInput.value = referralId; 36 } 37 } 38 }, 100); // Vérifier toutes les 100ms 39 40 // Arrêter après 10 secondes max 41 setTimeout(function() { 42 clearInterval(checkEndorselyInterval); 43 }, 10000); 44});
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.