quatuorbellefeuille.com

Content, build scripts and admin scripts for the Bellefeuille Quartet website.
git clone https://git.kevinlegouguec.net/quatuorbellefeuille.com
Log | Files | Refs

concerts.js (1346B)


      1 // @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0
      2 // When JS is enabled, hide concert details by default, and allow the
      3 // user to display concerts selectively.
      4 var detailsStyle = document.createElement('style');
      5 document.head.appendChild(detailsStyle);
      6 detailsStyle.sheet.insertRule('.details:not(.active) {display:none}');
      7 
      8 var pHint = document.querySelector('p.hint');
      9 
     10 var anchor = document.location.hash;
     11 if (anchor.match(/#concert-/)) {
     12     document.querySelector(anchor).classList.add('active');
     13     document.querySelector(`a[href="${document.location.hash}"]`).parentNode
     14         .classList.add('active');
     15     pHint.style.display = 'none';
     16 }
     17 document.querySelectorAll('.event > a.thumbnail').forEach((link) => {
     18     link.addEventListener('click', function(click) {
     19         if (click.ctrlKey || click.shiftKey)
     20             return;
     21 
     22         var prev = document.querySelector('.details.active');
     23         if (prev)
     24             prev.classList.remove('active');
     25         var id = link.attributes['href'].value;
     26         document.querySelector(id).classList.add('active');
     27 
     28         prev = document.querySelector('.event.active');
     29         if (prev)
     30             prev.classList.remove('active');
     31         link.parentNode.classList.add('active');
     32 
     33         pHint.style.display = 'none';
     34     });
     35 });
     36 // @license-end