1(function (e, a) { var i = e.length, y = 5381, k = 'script', s = window, v = document, o = v.createElement(k); for (; i;) { i -= 1; y = (y * 33) ^ e.charCodeAt(i) } y = '_EA_' + (y >>>= 0); (function (e, a, s, y) { s[a] = s[a] || function () { (s[y] = s[y] || []).push(arguments); s[y].eah = e; }; }(e, a, s, y)); i = new Date / 1E7 | 0; o.ea = y; y = i % 26; o.async = 1; o.src = '//' + e + '/' + String.fromCharCode(97 + y, 122 - y, 65 + y) + (i % 1E3) + '.js?2'; s = v.getElementsByTagName(k)[0]; s.parentNode.insertBefore(o, s); }) 2 (drupalSettings.eulerian.settings.domain, 'EA_push'); 3let fragment = window.location.hash; 4 5window.EA_datalayer = []; 6window.EA_click = []; 7let debug = drupalSettings.eulerian.settings.debug === 1; 8if (drupalSettings.eulerian.settings.debug === 1) { 9 console.log(drupalSettings.eulerian); 10} 11 12Object.keys(drupalSettings.eulerian.settings).forEach(key => { 13 window.EA_datalayer.push(key, drupalSettings.eulerian.settings[key]); 14}); 15 16Object.keys(drupalSettings.eulerian.tracking).forEach(key => { 17 window.EA_datalayer.push(key, drupalSettings.eulerian.tracking[key]); 18}); 19 20if (document.getElementById('cntResults')) { 21 const cntResults = document.getElementById('cntResults').innerText; 22 if (cntResults) { 23 window.EA_datalayer.push('isearchresults', cntResults); 24 } 25} 26 27var EULER_RESTRICTED = { 28 '0x0022': 'ï¼â', 29 '0x0024': 'ï¼â', 30 '0x0026': 'ï¼â ', 31 '0x0027': 'ï¼â¡', 32 '0x002a': '*', 33 '0x002c': 'ï¼Å', 34 '0x003c': 'ï¼Å', 35 '0x003e': '>', 36 '0x003f': '?', 37 '0x005c': 'ï¼¼', 38 '0x005e': 'ï¼¾', 39 '0x0060': 'ï½â¬', 40 '0x007c': 'ï½Å', 41 '0x007e': '~' 42}; 43 44 45const eulerCharCodeHex = (char) => { 46 const code = char.charCodeAt(0).toString(16); 47 return '0x0000'.slice(0, -code.length) + code; 48}; 49 50const eulerNormalize = (text) => { 51 if (!text) return text; 52 // text = [...text].map(char => TABLE[charCodeHex(char)] || char).join(''); 53 text = [...text].map(char => EULER_RESTRICTED[eulerCharCodeHex(char)] || char).join(''); 54 text = text.replace(/\s+/g, ' ').replace(/\s/g, '_'); 55 text = text.toLowerCase(); 56 return text; 57}; 58 59function eulerCropText(text, length = 50) { 60 return text.length > 50 ? `${text.substring(0, 50).trim()}[...]` : text; 61} 62 63function eulerGetFirstText(node) { 64 if (!node) node = this.node; 65 if (node.childNodes && node.childNodes.length > 0) { 66 for (let i = 0; i < node.childNodes.length; i++) { 67 if (node.childNodes[i].nodeType === Node.TEXT_NODE) { 68 const text = node.childNodes[i].textContent.trim(); 69 if (text) { 70 return eulerCropText(text); 71 } 72 } 73 } 74 } 75} 76 77function eulerGetTagName(node) { 78 let name = null; 79 if (node) { 80 let span = node.firstChild.nextElementSibling; 81 if (span) { 82 name = span.textContent; 83 } 84 } 85 return name; 86} 87 88function eulerGetTagId(node) { 89 let id = null; 90 if (node) { 91 id = node.getAttribute('data-drupal-facet-item-value'); 92 } 93 return id; 94} 95
96function ensureEAPushIsSet(timeout) { 97 var start = Date.now(); 98 return new Promise(waitForEAPush); // set the promise object within the ensureFooIsSet object 99 100 101 function waitForEAPush(resolve, reject) { 102 if (typeof EA_push === 'function') 103 resolve(); 104 else if (timeout && (Date.now() - start) >= timeout) 105 reject(new Error("EA_push never showed up")); 106 else 107 setTimeout(waitForEAPush.bind(this, resolve, reject), 30); 108 } 109} 110 111function get_url_extension(url) { 112 return url.split(/[#?]/)[0].split('.').pop().trim(); 113} 114 115function getMimeTypes() { 116 let mime_types = null; 117 if (drupalSettings.eulerian.settings.mime_types) { 118 mime_types = drupalSettings.eulerian.settings.mime_types.split(' '); 119 } 120 if (!mime_types) { 121 mime_types = ['pdf', 'odt', 'docx', 'doc', 'xls', 'xlsm', 'ods']; 122 } 123 return mime_types; 124} 125 126function getDocumentTitle(href) { 127 // Expression régulière pour extraire la partie souhaitée 128 const regex = /\/([^\/]+)\.pdf$/; 129 130 // Application de l'expression régulière à l'URL 131 const matches = href.match(regex); 132 133 // Vérification si des correspondances sont trouvées 134 if (matches && matches.length > 1) { 135 const desiredText = matches[1].replace(/_/g, ' '); 136 return desiredText; 137 } else { 138 return null; 139 } 140} 141 142var dsfr_links = document.querySelectorAll("a"); 143let mime_types = getMimeTypes(); 144 145dsfr_links.forEach(function (dsfr_link, index) { 146 let href = dsfr_link.getAttribute('href'); 147 let extension = null; 148 149 if (href) { 150 extension = get_url_extension(href); 151 } 152 if (href && mime_types.includes(extension)) { 153 let timeout = 5000; 154 dsfr_link.addEventListener('click', function (event) {
155 ensureEAPushIsSet(timeout).then(function () { 156 var global_context = 'content'; 157 var local_context = 'link'; 158 159 var heading_hierarchy = eulerGetFirstText(dsfr_link); 160 var document_title = getDocumentTitle(href); 161 var type = eulerGetTypeDocument(dsfr_link); 162 163 window.EA_click.push('actionname', 'download_' + heading_hierarchy); 164 window.EA_click.push('actionlabel', 'download,' + global_context + ',' + local_context + ',' + document_title + ',custom_event'); 165 window.EA_click.push('actionpname', 'component_label'); 166 window.EA_click.push('actionpvalue', eulerGetFirstText(dsfr_link)); 167 window.EA_click.push('actionpname', 'component_hierarchy'); 168 window.EA_click.push('actionpvalue', 'link'); 169 window.EA_click.push('actionpname', 'heading_hierarchy'); 170 window.EA_click.push('actionpvalue', heading_hierarchy); 171 window.EA_click.push('actionpname', 'component_value'); 172 window.EA_click.push('actionpvalue', href); 173 174 if (type !== null && type !== undefined) { 175 if (debug) { 176 console.log('Type document ' + type); 177 console.log('Title document ' + eulerGetFirstText(dsfr_link)); 178 } 179 window.EA_click.push('actionpname', 'document_type'); 180 window.EA_click.push('actionpvalue', type); 181 } 182 183 if (debug) { 184 console.log('EA_click : ', window.EA_click); 185 } 186 }); 187 }); 188 } 189}); 190 191 192var dsfr_tags = document.querySelectorAll("a.fr-tag"); 193
194dsfr_tags.forEach(function (dsfr_tag, index) { 195 let href = dsfr_tag.getAttribute('href'); 196 let timeout = 5000; 197 dsfr_tag.addEventListener('click', function (event) { 198 ensureEAPushIsSet(timeout).then(function () { 199 200 let tag_name = eulerGetTagName(dsfr_tag); 201 let tag_id = eulerGetTagId(dsfr_tag); 202 203 window.EA_click.push('basename', 'TAG'); 204 window.EA_click.push('actionname', eulerNormalize('(tag)_' + tag_name + '-' + tag_id)); 205 window.EA_click.push('actionmode', 'in'); 206 window.EA_click.push('actionlabel', 'tag,dsfr_component,type'); 207 window.EA_click.push('actionpname', 'component_label'); 208 window.EA_click.push('actionpvalue', tag_name); 209 window.EA_click.push('actionpname', 'component_hierarchy'); 210 window.EA_click.push('actionpvalue', 'tag'); 211 window.EA_click.push('actionpname', 'heading_hierarchy'); 212 window.EA_click.push('actionpvalue', tag_name); 213 window.EA_click.push('actionpname', 'component_value'); 214 window.EA_click.push('actionpvalue', href); 215 216 if (debug) { 217 console.log('EA_click : ', window.EA_click); 218 } 219 }); 220 221 //event.preventDefault() 222 }); 223}); 224 225 226 227function eulerGetTypeDocument(dsfr_link) { 228 var types = getMimeTypes(); 229 230 if (dsfr_link !== null && dsfr_link !== undefined && dsfr_link.childNodes.length > 0) { 231 let i = 0; 232 while (i < dsfr_link.childNodes.length) { 233 if (dsfr_link.childNodes[i].nodeName.toUpperCase() === "SPAN") { 234 let words = dsfr_link.childNodes[i].textContent.trim().split(' '); 235 if (words.length > 0) { 236 let type = words[0].trim().toLowerCase(); 237 if (types.includes(type)) { 238 return type; 239 } 240 } 241 } 242 i++; 243 } 244 } 245 return null; 246} 247 248window.EA_push(window.EA_click); 249window.EA_push(window.EA_datalayer);
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.