summaryrefslogtreecommitdiff
path: root/scripts/concerts.js
blob: bc1f47ee7df5274798784b7913483fc917e6be0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0
// When JS is enabled, hide concert details by default, and allow the
// user to display concerts selectively.
var detailsStyle = document.createElement('style');
document.head.appendChild(detailsStyle);
detailsStyle.sheet.insertRule('.details:not(.active) {display:none}');

var pHint = document.querySelector('p.hint');

var anchor = document.location.hash;
if (anchor.match(/#concert-/)) {
    document.querySelector(anchor).classList.add('active');
    document.querySelector(`a[href="${document.location.hash}"]`).parentNode
        .classList.add('active');
    pHint.style.display = 'none';
}
document.querySelectorAll('.event > a.thumbnail').forEach((link) => {
    link.addEventListener('click', function(click) {
        if (click.ctrlKey || click.shiftKey)
            return;

        var prev = document.querySelector('.details.active');
        if (prev)
            prev.classList.remove('active');
        var id = link.attributes['href'].value;
        document.querySelector(id).classList.add('active');

        prev = document.querySelector('.event.active');
        if (prev)
            prev.classList.remove('active');
        link.parentNode.classList.add('active');

        pHint.style.display = 'none';
    });
});
// @license-end