29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
document.querySelectorAll('.panel-small')?.forEach(el => {
|
|
el.addEventListener('click', (event) => {
|
|
let self = event.target;
|
|
if (self.classList.contains('panel-small') || self.closest('.panel-small')){
|
|
if (!self.classList.contains('panel-small')){
|
|
self = self.closest('.panel-small');
|
|
}
|
|
|
|
if (self.classList.contains('source_code')) {
|
|
window.open('https://github.com/clarinsi/STARK', '_blank');
|
|
return; // Skip further handling
|
|
}
|
|
|
|
const id = self?.id;
|
|
if (id){
|
|
document.querySelectorAll('.panel-content-section')?.forEach(section => {
|
|
section.hidden = true;
|
|
});
|
|
document.querySelectorAll('.panel-small')?.forEach(el => el.classList.remove('active'))
|
|
self.classList.add('active');
|
|
const targetSection = document.querySelector(`[data-content-for="${id}"]`);
|
|
if (targetSection) {
|
|
targetSection.hidden = false;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|