jQuery(document).ready(function($) { $(function() { $("a.anchor-link, ul.menu li ul.menu li a, .alert-submenu a, a#mainScrollUp").click(function(a) { var e = $(a.currentTarget), n = [60, 60], r = e.parent().parent(), h = e.parent().parent().parent(); "browseLettersWrapper" == h[0].id && (n = [160, 220], r = h); var i = r.hasClass("affix"); var hash = this.hash; if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) { var $target = $(hash), target = $(this.hash); $('a.anchor-link, ul.menu li ul.menu li a, .alert-submenu a').removeClass('sidebar__active'); $(this).addClass('sidebar__active'); if (target = target.length ? target : $("[name=" + this.hash.slice(1) + "]"), target.length) return $("html,body").animate({ scrollTop: target.offset().top - (i ? n[0] : n[1]) }, 1000, function() { $target.focus(); history.pushState ? history.pushState(null, null, e.attr("href")) : location.hash = e.attr("href") if ($target.is(":focus")) { return false; } else { $target.attr('tabindex', '0'); $target.focus(); } }), !1 } }) }) });