From b2bc42ac8a62ba89837d46b9c4b97c98956bcf74 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 5 Jun 2019 14:45:29 +0200 Subject: updates --- client/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'client/index.js') diff --git a/client/index.js b/client/index.js index 1a80e74f..59fb5176 100644 --- a/client/index.js +++ b/client/index.js @@ -143,10 +143,21 @@ function main() { // if (paras.length) { // paras[0].classList.add('first_paragraph') // } - toArray(document.querySelectorAll('header .links a')).forEach(tag => { - if (window.location.href.match(tag.href)) { + let active = '' + const { href } = window.location + if (href.match('about/updates')) { + active = 'updates' + } else if (href.match('about')) { + active = 'about' + } else { + active = 'datasets' + } + toArray(document.querySelectorAll('header .links a')).some(tag => { + if (tag.href.match(active)) { tag.classList.add('active') + return true } + return false }) runApplets() buildWaypoints() -- cgit v1.2.3-70-g09d2 From 697a21610f67f6864c766a5378b873f92862858b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 5 Jun 2019 16:13:27 +0200 Subject: headers --- client/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'client/index.js') diff --git a/client/index.js b/client/index.js index 59fb5176..c72fd02c 100644 --- a/client/index.js +++ b/client/index.js @@ -139,18 +139,20 @@ function buildWaypoints() { } function main() { - const paras = document.querySelectorAll('section p') + // const paras = document.querySelectorAll('section p') // if (paras.length) { // paras[0].classList.add('first_paragraph') // } let active = '' const { href } = window.location - if (href.match('about/updates')) { - active = 'updates' + if (href.match('news')) { + active = 'news' } else if (href.match('about')) { active = 'about' - } else { + } else if (href.match('datasets')) { active = 'datasets' + } else { + active = href } toArray(document.querySelectorAll('header .links a')).some(tag => { if (tag.href.match(active)) { -- cgit v1.2.3-70-g09d2