<commit_before>define(['./module.js'], function(module) {
  return module.directive('showtab', ['$location', '$route',
    function($location, $route) {
      var linkSelector = 'a',
        firstLink = 'li:first a',
        lastRoute = $location.path();

      function highlightCurrentTab(el, selectedTab, scope) {
        if (!selectedTab) el.find(firstLink).tab('show');
        else el.find(linkSelector + '[href="#' + selectedTab + '"]').tab('show');
        scope.onClick()(selectedTab);
      }

      function getSelectedTab() {
        var searchParams = $location.search();
        return angular.isString(searchParams.tab) && searchParams.tab || null;
      }

      return {
        scope: {
          onClick: '&'
        },
        restrict: 'A',
        link: function(scope, element, attrs) {

          element.find(linkSelector).click(function(event) {
            event.preventDefault();
            var $a = angular.element(event.target);

            // push the new route onto history but don't reload. the locationChangeSuccess
            // event will handle the rest. This covers both cases where we load fresh
            // or a change is triggered by user click.
            // PLEASE DON'T BE CLEVER AND SWITCH THIS TO USING HASHES. THIS WILL FAIL BECAUSE
            // OF Html5Mode(true) IN app_routes.js.
            scope.$apply(function() {
              $location.search({
                'tab': $a.attr('href').slice(1)<commit_msg>comments<commit_after>define(['./module.js'], function(module) {
  return module.directive('showtab', ['$location', '$route',
    function($location, $route) {
      var linkSelector = 'a',
        firstLink = 'li:first a',
        lastRoute = $location.path();

      function highlightCurrentTab(el, selectedTab, scope) {
        if (!selectedTab) el.find(firstLink).tab('show');
        else el.find(linkSelector + '[href="#' + selectedTab + '"]').tab('show');
        scope.onClick()(selectedTab);
      }

      function getSelectedTab() {
        var searchParams = $location.search();
        // we check for isString because if the someone input blah?tab= and no value
        // $location.search will return {tab: true}, so instead we force a null
        // to show there's no tab selected.
        return angular.isString(searchParams.tab) && searchParams.tab || null;
      }

      return {
        scope: {
          onClick: '&'
        },
        restrict: 'A',
        link: function(scope, element, attrs) {

          element.find(linkSelector).click(function(event) {
            event.preventDefault();
            var $a = angular.element(event.target);

            // push the new route onto history but don't reload. the locationChangeSuccess
            // event will handle the rest. This covers both cases where we load fresh
            // or a change is triggered by user click.
            // PLEASE DON'T BE CLEVER AND SWITCH THIS TO USING HASHES. THIS WILL FAIL BECAUSE
            // OF Html5Mode(true) IN app_routes.js.
            scope.$apply(function() {
              $location.search({
                'tab': $a.attr('href').slice(1)
{'fraction_non_alphanumeric': 0.12985359643539146, 'fraction_numerical': 0.001273074474856779, 'mean_word_length': 2.233539094650206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4502213', 'n_tokens_mistral': 868, 'n_tokens_neox': 846, 'n_words': 241}