/** * * This script search for span.counter elements like * Il y a 4 notifications * and return * Il y a 4 notifications * */ const isNum = (v) => !isNaN(v); const parseCounter = () => { document.querySelectorAll('span.counter') .forEach(el => { let r = []; el.innerText .trim() .split(' ') .forEach(w => { if (isNum(w)) { r.push(`${w}`); } else { r.push(w); } }) ; el.innerHTML = r.join(' '); }) ; }; window.addEventListener('DOMContentLoaded', function (e) { parseCounter(); }); export { parseCounter };