X-Git-Url: http://git.ieval.ro/?p=plack-app-gruntmaster.git;a=blobdiff_plain;f=js%2F90-nav.js;h=4b59af41d86a7d7e1cbbd9cc798f226766235b30;hp=fc91ff1dfb364245c5d315378f5dfff57e07c3c8;hb=7093e9ba00cf7727a52a49d34d4df12e4f865dd4;hpb=d5bf9a1d1fc3583bc058a90ce28efeb34819744b diff --git a/js/90-nav.js b/js/90-nav.js index fc91ff1..4b59af4 100644 --- a/js/90-nav.js +++ b/js/90-nav.js @@ -1,22 +1,16 @@ -(function(){ - 'use strict'; +var NAVS = { + 'home': /^\/$/, + 'pb': /^\/(?:pb|sol)\//, + 'ct': /^\/(?:ct|st|ed)\//, + 'log': /^\/log\//, + 'us': /^\/us\//, + 'account': /^\/account$/, + 'contribute': /^\/contribute$/, +}; - var NAVS = { - 'home': /^\/$/, - 'pb': /^\/(?:pb|sol)\//, - 'ct': /^\/(?:ct|st|ed)\//, - 'log': /^\/log\//, - 'us': /^\/us\//, - 'account': /^\/account$/, - 'contribute': /^\/contribute$/, - }; - - $( document ).ready(function(){ - var path = location.pathname; - for (var nav in NAVS) - if(path.match(NAVS[nav])) { - $('#nav-' + nav).addClass('active'); - break; - } - }); -})(); +$(function(){ + var path = location.pathname; + for (var nav in NAVS) + if(path.match(NAVS[nav])) + $('#nav-' + nav)[0].classList.add('active'); +});