1/** 2 * Génère un slug à partir d'un texte 3 * @param {String} text 4 * @returns {String} 5 */ 6export function slugify(text) { 7 return text 8 .normalize("NFD") 9 .replace(/[\u0300-\u036f]/g, "") // supprime les diacritiques 10 .toLowerCase() 11 .replace(/ /g, "-") // remplace les espaces par des tirets 12 .replace(/[^\w-]+/g, ""); // supprime les caractères non alphabétiques 13} 14 15export function replaceFirstLevelMenuByButton(firstUlMenuSelector) { 16 const firstLevelMenu = document.querySelectorAll(firstUlMenuSelector + " > li > a"); 17 18 if (firstLevelMenu) { 19 Array.from(firstLevelMenu).forEach((link) => { 20 const parent = link.parentNode; 21 const text = link.innerText; 22 23 const button = document.createElement("button"); 24 button.innerText = text; 25 button.ariaExpanded = false; 26 button.ariaHaspopup = false; 27 28 link.remove(); 29 if (parent.firstChild) { 30 parent.insertBefore(button, parent.firstChild); 31 } 32 }) 33 } 34}
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.