mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
24 lines
No EOL
819 B
HTML
24 lines
No EOL
819 B
HTML
<script>
|
|
window.onload = function(){
|
|
// open details of option in URL fragment
|
|
document.getElementById(decodeURI(window.location.hash.substring(1)))?.setAttribute("open", "");
|
|
|
|
var options = document.getElementsByTagName('details');
|
|
for(var i = 0; i < options.length; i++) {
|
|
options[i].getElementsByTagName("summary")[0].onclick = function() {
|
|
|
|
// set URL fragment to option id
|
|
window.location.hash = this.parentElement.id;
|
|
|
|
// is current panel open, return immediately as it's just being closed
|
|
if (this.parentElement.hasAttribute("open")) return;
|
|
|
|
// collapse all other options
|
|
for(var j = 0; j < options.length; j++) {
|
|
options[j].removeAttribute("open");
|
|
}
|
|
};
|
|
}
|
|
|
|
};
|
|
</script> |