"use strict"; (function ($, d, w) { var getCurrentPathName = function () { var l = w.location.pathname.substr(0); return l !== '/' ? l : '/home.html'; }, current = getCurrentPathName(), setSelectedMenu = function () { $(d).find('a').each(function () { if (current === $(this).attr('href')) { $(this).addClass('current'); } }); }; $(d).ready(function () { setSelectedMenu(); }); })(jQuery, document, window);