1function idcc(siren) 2{ 3 const info = { "siren": siren, "source": "IDCC (Conventions Collectives)", "sourcelink": "https://travail-emploi.gouv.fr/", "retry": () => idcc(siren) } 4 add_source(info.source, info.sourcelink, 80) 5 6 fetch('https://siret2idcc.fabrique.social.gouv.fr/api/v2/' + siren) 7 .then(function (response) 8 { 9 if (response.ok) 10 return response.json() 11 else 12 throw response 13 }) 14 .then(function (response) 15 { 16 response = Object.assign(response, info) 17 18 if (!response[0].conventions[0]) 19 return update_source(response.source, 'validate') 20 21 document.getElementById('menu_unite_legale').style.display = '' 22 document.getElementById('unite_legale').style.display = '' 23 24 conventions = new Array() 25 for (convention of response[0].conventions) 26 conventions.push('<a href="javascript:window.open(\'' + convention.url + '\')">' + convention.nature + ' ' + convention.num + ' : ' + convention.shortTitle + '</a>') 27 unite_legale_addrow('Convention Collective', conventions.join('<br/>'), response.source, 110) 28 29 update_source(response.source, 'validate', response) 30 }) 31 .catch(function (response) 32 { 33 response = Object.assign(response, info) 34 if (response.toString().substring(0, 9) == 'TypeError') 35 return update_source(response.source, 'refresh', '502', response, response.retry) 36 else if (response.status == 400) 37 return update_source(response.source, 'refresh', '400', "Requête mal formatée", response.retry) 38 else if (response.status == 401) 39 return update_source(response.source, 'refresh', '401', "Accès non autorisé", response.retry) 40 else if (response.status == 404) 41 return update_source(response.source, 'refresh', '404', "Chemin non trouvé", response.retry) 42 else if (response.status == 403) 43 return update_source(response.source, 'refresh', '403', "Accès refusé", response.retry) 44 else if (response.status) 45 return update_source(response.source, 'refresh', response.status, response.status + " " + response.statusText, response.retry) 46 else 47 return update_source(response.source, 'refresh', '???', response, response.retry) 48 }) 49}
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.