<commit_before>//  Generic method to build a popup from a template
//   popupClass: name of the html file without the extention
//   customData: array of paired values to replace corresponding tags in the html template (i.e. {player_name})
function buildPopup(popupClass, useLarge, useRight, customData) {
    $.get("templates/" + popupClass + ".html", function(data) {
      //  In a few cases, we need a larger popup
      $(".popup_inner")
        .removeClass("popup_inner_large");
      $(".popup_inner")
        .removeClass("popup_inner_right");
      if (useLarge) {
        $(".popup_inner")
          .addClass("popup_inner_large");
      }
      if (useRight) {
        $(".popup_inner")
          .addClass("popup_inner_right");
      }

      //  Now load and update the template
      var html = data;
      if (customData) {
        customData.forEach(function(data) {
          html = html.replace(new RegExp("{" + data[0] + "}", 'g'), data[1]);
        });
      }
      $(".popup_inner")
        .html(html);
      $(".popup")
        .show();

    });
  }

  function hidePopup() {
    action_in_progress = false;
    allowed_actions.can_build = true;
    allowed_actions.can_finish = (current_game.round_num > 2 || turn_actions.length === 2);
    updatePanelDisplay();
    $(".game_chat").removeClass('game_chat_top_z');
    $(".btn-control-maximize").removeClass('btn-hide');
    $(".score").removeClass("score--back");
    $(".game_chat").addClass("game_chat--back");

    $('.popup')
      .hide();
  }

  /***************************************************
   *  start_up.html
   **************************************************/
  function build_popup_start(section, isLarge) {
    buildPopup(section, isLarge, false);
  }

  /***************************************************
   *  start_intro.html
   **************************************************/

  /***************************************************
   *  start_menu.html
   **************************************************/
  function build_popup_start_menu() {
    buildPopup("start_menu", false, false);
  }

  /***************************************************
   *  start_settings.html
   **************************************************/

  /***************************************************
   *  start_players.html
   **************************************************/
  function build_popup_lobby(game_list) {
    //  Format list of games
    var show_join = (game_list.length > 0 ? "block" : "none");
    var game_list_html = "";

    for (var g = 0; g < game_list.length; g++) {
      var name_list = game_list[g].player_names.join(", ");
      game_list_html += "<div class='game_list_row' onclick='join_game(" + game_list[g].game_id + ");'>";
      game_list_html += "    <div class='game_list_row_title'>" + game_list[g].game_name + "</div>";
      game_list_html += "    <div class='game_list_row_spots'>" + game_list[g].player_names.length + " of " +
        game_list[g].max_players + "</div>";
      game_list_html += "    <div class='game_list_row_players'><b>In game:</b> " + name_list + "</div>";
      game_list_html += "</div>";
    }
    buildPopup("start_lobby", false, false, [
      ["join_game_display", show_join],
      ["player", current_player.name],<commit_msg>add id tag for tests<commit_after>//  Generic method to build a popup from a template
//   popupClass: name of the html file without the extention
//   customData: array of paired values to replace corresponding tags in the html template (i.e. {player_name})
function buildPopup(popupClass, useLarge, useRight, customData) {
    $.get("templates/" + popupClass + ".html", function(data) {
      //  In a few cases, we need a larger popup
      $(".popup_inner")
        .removeClass("popup_inner_large");
      $(".popup_inner")
        .removeClass("popup_inner_right");
      if (useLarge) {
        $(".popup_inner")
          .addClass("popup_inner_large");
      }
      if (useRight) {
        $(".popup_inner")
          .addClass("popup_inner_right");
      }

      //  Now load and update the template
      var html = data;
      if (customData) {
        customData.forEach(function(data) {
          html = html.replace(new RegExp("{" + data[0] + "}", 'g'), data[1]);
        });
      }
      $(".popup_inner")
        .html(html);
      $(".popup")
        .show();

    });
  }

  function hidePopup() {
    action_in_progress = false;
    allowed_actions.can_build = true;
    allowed_actions.can_finish = (current_game.round_num > 2 || turn_actions.length === 2);
    updatePanelDisplay();
    $(".game_chat").removeClass('game_chat_top_z');
    $(".btn-control-maximize").removeClass('btn-hide');
    $(".score").removeClass("score--back");
    $(".game_chat").addClass("game_chat--back");

    $('.popup')
      .hide();
  }

  /***************************************************
   *  start_up.html
   **************************************************/
  function build_popup_start(section, isLarge) {
    buildPopup(section, isLarge, false);
  }

  /***************************************************
   *  start_intro.html
   **************************************************/

  /***************************************************
   *  start_menu.html
   **************************************************/
  function build_popup_start_menu() {
    buildPopup("start_menu", false, false);
  }

  /***************************************************
   *  start_settings.html
   **************************************************/

  /***************************************************
   *  start_players.html
   **************************************************/
  function build_popup_lobby(game_list) {
    //  Format list of games
    var show_join = (game_list.length > 0 ? "block" : "none");
    var game_list_html = "";

    for (var g = 0; g < game_list.length; g++) {
      var name_list = game_list[g].player_names.join(", ");
      game_list_html += "<div id='game_id_"+g+"' class='game_list_row' onclick='join_game(" + game_list[g].game_id + ");'>";
      game_list_html += "    <div class='game_list_row_title'>" + game_list[g].game_name + "</div>";
      game_list_html += "    <div class='game_list_row_spots'>" + game_list[g].player_names.length + " of " +
        game_list[g].max_players + "</div>";
      game_list_html += "    <div class='game_list_row_players'><b>In game:</b> " + name_list + "</div>";
      game_list_html += "</div>";
    }
    buildPopup("start_lobby", false, false, [
      ["join_game_display", show_join],
      ["player", current_player.name],
{'fraction_non_alphanumeric': 0.2916540671303296, 'fraction_numerical': 0.0018143332325370426, 'mean_word_length': 3.4395973154362416, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, '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': '3592370', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1916, 'n_words': 356}