summaryrefslogtreecommitdiff
path: root/scripts/concerts.js
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2021-03-13 23:19:59 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2021-03-13 23:19:59 +0100
commit67dd63d1a25e19a1623f0303ca77f6078da95265 (patch)
tree2dcd94ccfa88b53e1b2776043a3f71a83f888423 /scripts/concerts.js
parent7bae175d3b0a4aa23d936eabed1368f481ae7821 (diff)
downloadquatuorbellefeuille.com-67dd63d1a25e19a1623f0303ca77f6078da95265.tar.xz
Move credits closer to photos in concerts page
Diffstat (limited to 'scripts/concerts.js')
-rw-r--r--scripts/concerts.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/concerts.js b/scripts/concerts.js
new file mode 100644
index 0000000..fb45819
--- /dev/null
+++ b/scripts/concerts.js
@@ -0,0 +1,34 @@
+// 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('a.event').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('.eventcontainer.active');
+ if (prev)
+ prev.classList.remove('active');
+ link.parentNode.classList.add('active');
+
+ pHint.style.display = 'none';
+ });
+});