1/* public/alertcount.js â pone el número de personas suscriptas debajo del formulario de alertas. 2 * 3 * â ï¸ EL TEXTO VIVE EN EL HTML, NO ACÃ. Cada idioma trae su frase con un <strong> vacÃo adentro; este 4 * script solo escribe el número. Asà no hay que mantener traducciones en JS ni el texto depende de 5 * que el script llegue. 6 * 7 * â ï¸ EL ELEMENTO NACE hidden Y SOLO SE MUESTRA SI HAY NÃMERO. Un contador que se cae en silencio y 8 * deja "â personas ya reciben estas alertas" es peor que no tener contador: da la impresión de que 9 * el sitio está roto justo donde se le pide el email a alguien. 10 * 11 * No bloquea nada: si el endpoint no responde, el formulario funciona exactamente igual. 12 */ 13(function () { 14 var els = document.querySelectorAll('[data-alert-count]'); 15 if (!els.length || typeof fetch !== 'function') return; 16 17 var MIN = 100; // mismo piso que el endpoint: por debajo, mejor no decir nada 18 19 fetch('/news/alerts/count.php', { credentials: 'omit' }) 20 .then(function (r) { return r.ok ? r.json() : null; }) 21 .then(function (d) { 22 if (!d || typeof d.people !== 'number' || d.people < MIN) return; 23 var lang = (document.documentElement.lang || 'en').toLowerCase(); 24 // El separador de miles cambia por idioma: 2.140 en español, 2,140 en inglés. 25 var txt; 26 try { txt = d.people.toLocaleString(lang.indexOf('es') === 0 ? 'es-ES' : 'en-US'); } 27 catch (e) { txt = String(d.people); } 28 for (var i = 0; i < els.length; i++) { 29 var s = els[i].querySelector('strong'); 30 if (!s) continue; // sin el hueco no se toca nada: el HTML manda 31 s.textContent = txt; 32 els[i].hidden = false; 33 } 34 }) 35 .catch(function () { /* en silencio: el formulario tiene que seguir andando */ }); 36})();
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.