diff --git a/_layouts/common.html b/_layouts/common.html index 3f1fd2a..800ad1e 100644 --- a/_layouts/common.html +++ b/_layouts/common.html @@ -49,6 +49,26 @@ link.href = `#${heading.id}`; heading.appendChild(link); }); + + + /* fonction pour importer les param de l'url dans les ul de tri */ + function getForAttributesAndMatch() { + const keysSearched = window.location.hash.substr(1).split('+'); + const items = document.querySelectorAll("#bin-search-filters li"); + items.forEach(item => { + const label = item.querySelector("label"); + if (label) { + const forValue = label.getAttribute("for"); + if (keysSearched.includes(encodeURIComponent(forValue))) { + document.getElementById(item.querySelector("input").id).className = 'match'; + document.getElementById(label.id).textContent = document.getElementById(label.id).textContent + "✓"; + var checkbox = document.getElementById(item.querySelector("input").id); + checkbox.checked = true; + } + } + }); + } + getForAttributesAndMatch();