Skip to content

Commit

Permalink
Update common.html
Browse files Browse the repository at this point in the history
Update pour la correction du bug de recherche/url
  • Loading branch information
Dacodhack authored Nov 27, 2024
1 parent ecb3e18 commit f16f515
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions _layouts/common.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
</script>
</body>
</html>

0 comments on commit f16f515

Please sign in to comment.