<commit_before>(function($) {
  $.fn.autotabs = function(method) {
    var options,
        active_tab_index,
        processing = false;
    
    var methods = {
      init: function(params) {

        options = $.extend({},
          this.autotabs.defaults, 
          params);

        var ul = '<ul class="' + options.tabs_class  + '">';
        active_tab_index = (options.active_tab == null ? 
                             ($.cookie ? $.cookie(options.cookie_name) : 0) : 
                             options.active_tab) || 0;

        return this.each(function() {
          var $this = $(this);
          var children = $this.children(options.tab_pane_selector);
 
          switch (children.length) {
            case 0 : 
              return;

            case 1 :
              if (!options.tab_orphans) {
                children.show();
                return;
              }

            default :
              children.each(function(index, element) {
                ul += helpers.generate_tab(index, element);
              });
          }

          ul += '</ul>';

          var tabs = (options.tabs_selector != '') ? $(options.tabs_selector) : $this;
          if (!tabs) { tabs = $this; }
          tabs.prepend(ul);
 
          $('ul.' + options.tabs_class + ' li > a', tabs).click(function() {
            if (processing) { return false; }
            processing = true;
            helpers.showLoadingIcon(options);

            var link = $(this);
            
            link.parent().addClass(options.active_class).siblings('li').removeClass(options.active_class);
            $this.children(options.tab_pane_selector).each(function() {
              $(this).slideUp('fast').removeClass(options.active_class);
            });
            
            $this.children(options.tab_pane_selector).each(function(index) { 
              if (link.attr('rel') == this.id) {
                try {
                  helpers.load(this);
                  if ($.cookie) {
                    $.cookie(options.cookie_name, index, { path: options.cookie_path });  
                  }

                }
                catch (e) { console.log(e); }
              }
            }); 
                
            return false;
          });
 
          $this.children(options.tab_pane_selector).each(function(index, elt) { 
            if (index == active_tab_index) { helpers.load(elt); }
            else { $(elt).slideUp('fast').removeClass(options.active_class); } 
          }); 
        }); 
      }
    };
    
    var helpers = {
      generate_tab: function(index, element) {
        var tab = '<li' + (index == active_tab_index ? ' class="' + options.active_class + '"' : '') + 
                  (options.tab_id && $.isFunction(options.tab_id) ? ' id="' + options.tab_id(element.id) + '">' : '>') +
                  '<a href="' + ($(element).attr('rel') || '#' + element.id) + '" rel="' + $(element).attr('id') + '">' + 
                  ($(element).attr('title') || $(options.tab_label_selector, $(element)).get(0).innerHTML) + 
                  '</a></li>';
        return tab;
      },
        
      load: function(pane) {
        var success = helpers.getSuccess(pane.id);
        if ((url = $(pane).attr('rel')) && ($(pane).html().trim() == '' || options.force_refresh)) {
          $(pane).empty();
          $(pane).load(url, function() {
            $(pane).slideDown('fast').addClass(options.active_class);
            if (success && $.isFunction(success)) {
              success.call(pane);
            };
            processing = false;
            helpers.hideLoadingIcon(options);
          });
        }
        else {
          $(pane).slideDown('fast').addClass(options.active_class);
          if (success && $.isFunction(success)) { success.call(pane); }
          processing = false;
          helpers.hideLoadingIcon(options);
        }
      },
      <commit_msg>fixed use of trim<commit_after>(function($) {
  $.fn.autotabs = function(method) {
    var options,
        active_tab_index,
        processing = false;
    
    var methods = {
      init: function(params) {

        options = $.extend({},
          this.autotabs.defaults, 
          params);

        var ul = '<ul class="' + options.tabs_class  + '">';
        active_tab_index = (options.active_tab == null ? 
                             ($.cookie ? $.cookie(options.cookie_name) : 0) : 
                             options.active_tab) || 0;

        return this.each(function() {
          var $this = $(this);
          var children = $this.children(options.tab_pane_selector);
 
          switch (children.length) {
            case 0 : 
              return;

            case 1 :
              if (!options.tab_orphans) {
                children.show();
                return;
              }

            default :
              children.each(function(index, element) {
                ul += helpers.generate_tab(index, element);
              });
          }

          ul += '</ul>';

          var tabs = (options.tabs_selector != '') ? $(options.tabs_selector) : $this;
          if (!tabs) { tabs = $this; }
          tabs.prepend(ul);
 
          $('ul.' + options.tabs_class + ' li > a', tabs).click(function() {
            if (processing) { return false; }
            processing = true;
            helpers.showLoadingIcon(options);

            var link = $(this);
            
            link.parent().addClass(options.active_class).siblings('li').removeClass(options.active_class);
            $this.children(options.tab_pane_selector).each(function() {
              $(this).slideUp('fast').removeClass(options.active_class);
            });
            
            $this.children(options.tab_pane_selector).each(function(index) { 
              if (link.attr('rel') == this.id) {
                try {
                  helpers.load(this);
                  if ($.cookie) {
                    $.cookie(options.cookie_name, index, { path: options.cookie_path });  
                  }

                }
                catch (e) { console.log(e); }
              }
            }); 
                
            return false;
          });
 
          $this.children(options.tab_pane_selector).each(function(index, elt) { 
            if (index == active_tab_index) { helpers.load(elt); }
            else { $(elt).slideUp('fast').removeClass(options.active_class); } 
          }); 
        }); 
      }
    };
    
    var helpers = {
      generate_tab: function(index, element) {
        var tab = '<li' + (index == active_tab_index ? ' class="' + options.active_class + '"' : '') + 
                  (options.tab_id && $.isFunction(options.tab_id) ? ' id="' + options.tab_id(element.id) + '">' : '>') +
                  '<a href="' + ($(element).attr('rel') || '#' + element.id) + '" rel="' + $(element).attr('id') + '">' + 
                  ($(element).attr('title') || $(options.tab_label_selector, $(element)).get(0).innerHTML) + 
                  '</a></li>';
        return tab;
      },
        
      load: function(pane) {
        var success = helpers.getSuccess(pane.id);
        if ((url = $(pane).attr('rel')) && ($.trim($(pane).html()) == '' || options.force_refresh)) {
          $(pane).empty();
          $(pane).load(url, function() {
            $(pane).slideDown('fast').addClass(options.active_class);
            if (success && $.isFunction(success)) {
              success.call(pane);
            };
            processing = false;
            helpers.hideLoadingIcon(options);
          });
        }
        else {
          $(pane).slideDown('fast').addClass(options.active_class);
          if (success && $.isFunction(success)) { success.call(pane); }
          processing = false;
          helpers.hideLoadingIcon(options);
        }
      },
      
{'fraction_non_alphanumeric': 0.1593722087533495, 'fraction_numerical': 0.0012759984688018374, 'mean_word_length': 1.5514322916666667, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '2836249', 'n_tokens_mistral': 2249, 'n_tokens_neox': 2145, 'n_words': 337}