<commit_before>define([ './team', './toast', './strings', './tab_ranking', './storage',
    './autocomplete', './options', './tab_new', './opts', './tabshandle' ], function (Team, Toast, Strings, Tab_Ranking, Storage, Autocomplete, Options, Tab_New, Opts, Tabshandle) {

  // TODO combine $anchors, $fileload and $teamsize
  var Tab_Teams, $tab, template, newteam, $anchor, options, $fileload, $teamsize;

  $tab = undefined;

  function trimName (name) {
    return name.replace(/^\s*|\s*$/g, '').replace(/\s\s*/g, ' ');
  }

  function updateTeamCounts () {
    $tab.find('.numteams').text(Team.count());
  }

  function initTeamSize () {
    $teamsize = $tab.find('.teamsize');
    $teamsize.find('button').on('click', function (e) {
      var teamsize, $button;

      $button = $(this);

      if ($button.prop('tagName') !== 'BUTTON') {
        $button = $button.parents('button');
      }

      teamsize = Number($button.val());

      Options.teamsize = teamsize;

      Tabshandle.updateOpts();
      require('./alltabs').reset();
      require('./alltabs').update();

      e.preventDefault();
      return false;
    });
  }

  function updateTeamSize () {
    $teamsize.find('button').removeClass('selected');
    $teamsize.find('button[value=' + Options.teamsize + ']').addClass('selected');
    $teamsize.show();
  }

  function initTemplate () {
    var tmp, $tpl, $teamno, $names, $chname, i;

    if (template) {
      console.error('tab_teams: template already exists: ');
      console.error(template);
      return;
    }

    $tpl = $tab.find('.team.tpl');

    $tpl.detach();
    $tpl.removeClass('tpl');

    $names = [];
    tmp = $tpl.find('.name');
    for (i = 0; i < Options.maxteamsize; i += 1) {
      $names[i] = tmp.eq(i);
    }

    $teamno = $tpl.find('.teamno');

    $chname = $tpl.find('.chname');
    $chname.detach();

    template = {
      $tpl : $tpl,
      $teamno : $teamno,
      $names : $names,
      $chname : $chname,
    };

    updateTemplate();
  }

  /**
   * reads names from a string and adds the players accordingly. Ignores
   * #-escaped lines
   * 
   * @returns true on success, undefined or false on failure
   */
  function createTeamsFromString (str) {
    var lines, line, names, teamsize, team, i;

    if (Team.count() !== 0) {
      new Toast(Strings.teamsnotempty);
      return undefined;
    }

    stripregex = /(^\s+|\s+$)/g;

    lines = str.split('\n');
<commit_msg>tab_teams: missing var declaration added<commit_after>define([ './team', './toast', './strings', './tab_ranking', './storage',
    './autocomplete', './options', './tab_new', './opts', './tabshandle' ], function (Team, Toast, Strings, Tab_Ranking, Storage, Autocomplete, Options, Tab_New, Opts, Tabshandle) {

  // TODO combine $anchors, $fileload and $teamsize
  var Tab_Teams, $tab, template, newteam, $anchor, options, $fileload, $teamsize;

  $tab = undefined;

  function trimName (name) {
    return name.replace(/^\s*|\s*$/g, '').replace(/\s\s*/g, ' ');
  }

  function updateTeamCounts () {
    $tab.find('.numteams').text(Team.count());
  }

  function initTeamSize () {
    $teamsize = $tab.find('.teamsize');
    $teamsize.find('button').on('click', function (e) {
      var teamsize, $button;

      $button = $(this);

      if ($button.prop('tagName') !== 'BUTTON') {
        $button = $button.parents('button');
      }

      teamsize = Number($button.val());

      Options.teamsize = teamsize;

      Tabshandle.updateOpts();
      require('./alltabs').reset();
      require('./alltabs').update();

      e.preventDefault();
      return false;
    });
  }

  function updateTeamSize () {
    $teamsize.find('button').removeClass('selected');
    $teamsize.find('button[value=' + Options.teamsize + ']').addClass('selected');
    $teamsize.show();
  }

  function initTemplate () {
    var tmp, $tpl, $teamno, $names, $chname, i;

    if (template) {
      console.error('tab_teams: template already exists: ');
      console.error(template);
      return;
    }

    $tpl = $tab.find('.team.tpl');

    $tpl.detach();
    $tpl.removeClass('tpl');

    $names = [];
    tmp = $tpl.find('.name');
    for (i = 0; i < Options.maxteamsize; i += 1) {
      $names[i] = tmp.eq(i);
    }

    $teamno = $tpl.find('.teamno');

    $chname = $tpl.find('.chname');
    $chname.detach();

    template = {
      $tpl : $tpl,
      $teamno : $teamno,
      $names : $names,
      $chname : $chname,
    };

    updateTemplate();
  }

  /**
   * reads names from a string and adds the players accordingly. Ignores
   * #-escaped lines
   * 
   * @returns true on success, undefined or false on failure
   */
  function createTeamsFromString (str) {
    var lines, line, name, names, teamsize, team, i;

    if (Team.count() !== 0) {
      new Toast(Strings.teamsnotempty);
      return undefined;
    }

    stripregex = /(^\s+|\s+$)/g;

    lines = str.split('\n');

{'fraction_non_alphanumeric': 0.19450661241098677, 'fraction_numerical': 0.0012207527975584944, 'mean_word_length': 2.76416539050536, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3914211', 'n_tokens_mistral': 1687, 'n_tokens_neox': 1666, 'n_words': 351}