diff --git a/src/root/job.tt b/src/root/job.tt index 6c8e82fd..79853183 100644 --- a/src/root/job.tt +++ b/src/root/job.tt @@ -15,7 +15,7 @@ removed or had an evaluation error. [% END %] diff --git a/src/root/static/js/common.js b/src/root/static/js/common.js index debda113..4988402e 100644 --- a/src/root/static/js/common.js +++ b/src/root/static/js/common.js @@ -50,25 +50,18 @@ $(document).ready(function() { $(".hydra-popover").popover({}); - $(function() { - if (window.location.hash) { - $(".nav-tabs a[href='" + window.location.hash + "']").tab('show'); - } + /* Activates tab according to URL anchor. */ + if (window.location.hash) { + $('.nav-tabs > .nav-item:not(.dropdown) a[href="' + window.location.hash + '"]').tab('show'); + } - /* If no tab is active, show the first one. */ - $(".nav-tabs").each(function() { - if ($("li.active", this).length > 0) return; - $("a", $(this).children("li:not(.dropdown)").first()).tab('show'); - }); + $('.nav-tabs').each(function() { + if ($('.nav-item:not(.dropdown) a.active',this).length == 0) + $('.nav-item:not(.dropdown) a',this).first().tab('show'); + }); - /* Ensure that pressing the back button on another page - navigates back to the previously selected tab on this - page. */ - $('.nav-tabs').bind('show', function(e) { - var pattern = /#.+/gi; - var id = e.target.toString().match(pattern)[0]; - history.replaceState(null, "", id); - }); + $('.nav-tabs > .nav-item:not(.dropdown) a[href^="#"]').on('click', function() { + history.replaceState(null, null, window.location.href.split("#")[0] + $(this).attr("href")); }); /* Automatically set Bootstrap radio buttons from hidden form controls. */