diff options
| author | Adam Harvey <adam@ahprojects.com> | 2019-06-05 09:51:26 -0500 |
|---|---|---|
| committer | Adam Harvey <adam@ahprojects.com> | 2019-06-05 09:51:26 -0500 |
| commit | 7919ecc1a760f611efbe1283096482a8ec99efef (patch) | |
| tree | 80c3d320926a218aaefe28dbc4043d64f54e6e7d /client/index.js | |
| parent | 11d0839a209342cb6c0d511a4ae6a5a7026c9df9 (diff) | |
| parent | 76c058b87f94fb1ed7b37869a8082c25c7ab37de (diff) | |
fix merge
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/client/index.js b/client/index.js index 1a80e74f..c72fd02c 100644 --- a/client/index.js +++ b/client/index.js @@ -139,14 +139,27 @@ 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') // } - toArray(document.querySelectorAll('header .links a')).forEach(tag => { - if (window.location.href.match(tag.href)) { + let active = '' + const { href } = window.location + if (href.match('news')) { + active = 'news' + } else if (href.match('about')) { + active = 'about' + } else if (href.match('datasets')) { + active = 'datasets' + } else { + active = href + } + toArray(document.querySelectorAll('header .links a')).some(tag => { + if (tag.href.match(active)) { tag.classList.add('active') + return true } + return false }) runApplets() buildWaypoints() |
