X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2F90-nav.js;h=4412e3a89ff038d92b1ae9f916fd20639dbc9e5d;hb=65ef54654e9694d87b8b10e930201227bb625c2e;hp=7f96eeb320c2aa6f22f3a1d8d1c9810d79e29489;hpb=040bdc724a842533132112d328cc4f396a3cf7d3;p=gruntmaster-page.git diff --git a/js/90-nav.js b/js/90-nav.js index 7f96eeb..4412e3a 100644 --- a/js/90-nav.js +++ b/js/90-nav.js @@ -1,23 +1,17 @@ -(function(){ - 'use strict'; +const NAVS = { + home: /^\/$/, + pb: /^\/(?:pb|sol)\//, + ct: /^\/(?:ct|st|ed)\//, + log: /^\/log\//, + us: /^\/us\//, + account: /^\/account$/, + contribute: /^\/contribute$/, + about: /^\/about$/, +}; - var NAVS = { - 'home': /^\/$/, - 'pb': /^\/(?:pb|sol)\//, - 'ct': /^\/(?:ct|st|ed)\//, - 'log': /^\/log\//, - 'us': /^\/us\//, - 'account': /^\/account$/, - 'contribute': /^\/contribute$/, - 'about': /^\/about$/, - }; - - $( document ).ready(function(){ - var path = location.pathname; - for (var nav in NAVS) - if(path.match(NAVS[nav])) { - $('#nav-' + nav).addClass('active'); - break; - } - }); -})(); +$(function(){ + let path = location.pathname; + for (let nav in NAVS) + if(path.match(NAVS[nav])) + $('#nav-' + nav)[0].classList.add('active'); +});