<commit_before>window.settlers.events['tournament.Created']              = (e) ->
  window.hlib._g 'Tournament has been created'

window.settlers.events['tournament.Finished']             = (e) ->
  window.hlib._g 'Tournament has been finished'

window.settlers.events['tournament.Canceled']             = (e) ->
  return window.hlib._g 'Tournament has been canceled due to lack of interest'

window.settlers.events['tournament.Started']              = (e) ->
  return window.hlib._g 'Tournament has started'

window.settlers.events['tournament.PlayerJoined']             = (e) ->
  return (window.hlib._g '{0} joined tournament').format e.user.name

window.settlers = window.settlers or {}

class window.settlers.TournamentObject
  constructor:          (data) ->
    jQuery.extend true, @, data

    @my_player = @players[@my_player]

    T = @

    @events.reverse()

window.settlers.templates.game_stage = doT.template '
  {{? it.type == 0}}
    <span class="game-running">{{= window.hlib._g("Not started yet")}}</span>
  {{?? it.type == 2 || it.type == 3}}
    <span class="game-finished">{{= window.hlib._g("Finished")}}</span>
  {{??}}
    <span class="game-running">{{= window.hlib._g("Active")}}</span>
  {{?}}
'

window.settlers.templates.chat_post = doT.template '
 <tr id="chat_post_{{= it.id}}">
    <td>
      <h3>
        <span class="chat-post-unread label label-important hide">Unread</span>
        {{? it.user.is_online}}
          <span class="user-online">
        {{?}}
        {{= it.user.name}}
        {{? it.user.is_online}}
          </span>
        {{?}} - {{= it.time}}
      </h3>

      <div>
        <p>{{= it.message}}</p>
      </div>
    </td>
  </tr>
'

$(window).on 'page_startup', () ->
  tabs = new window.hlib.Tabs '#views'

  $('body').on 'hlib_update', (event, startup_check) ->
    tid = window.settlers.tournament.tid

    req = new window.hlib.Ajax
      url:			'/tournament/state'
      data:
        tid:			tid
      handlers:
        h200:			(response, ajax) ->
          window.settlers.tournament = new window.settlers.TournamentObject response.tournament
          $('body').trigger 'hlib_render'<commit_msg>Fixed chat template on a tournament page<commit_after>window.settlers.events['tournament.Created']              = (e) ->
  window.hlib._g 'Tournament has been created'

window.settlers.events['tournament.Finished']             = (e) ->
  window.hlib._g 'Tournament has been finished'

window.settlers.events['tournament.Canceled']             = (e) ->
  return window.hlib._g 'Tournament has been canceled due to lack of interest'

window.settlers.events['tournament.Started']              = (e) ->
  return window.hlib._g 'Tournament has started'

window.settlers.events['tournament.PlayerJoined']             = (e) ->
  return (window.hlib._g '{0} joined tournament').format e.user.name

window.settlers = window.settlers or {}

class window.settlers.TournamentObject
  constructor:          (data) ->
    jQuery.extend true, @, data

    @my_player = @players[@my_player]

    T = @

    @events.reverse()

window.settlers.templates.game_stage = doT.template '
  {{? it.type == 0}}
    <span class="game-running">{{= window.hlib._g("Not started yet")}}</span>
  {{?? it.type == 2 || it.type == 3}}
    <span class="game-finished">{{= window.hlib._g("Finished")}}</span>
  {{??}}
    <span class="game-running">{{= window.hlib._g("Active")}}</span>
  {{?}}
'

window.settlers.templates.chat_post = doT.template '
  <tr id="chat_post_{{= it.id}}">
    <td>
      <h3>
        <span class="chat-post-unread label label-important hide">{{= window.hlib._g("Unread")}}</span>
        {{= window.settlers.fmt_player(it) }} - {{= it.time}}
        <a href="#" rel="tooltip" data-placement="right" title="{{= window.hlib._g(\'Quote\')}}" data-chat-post="{{= it.id}}">
          <span class="icon-comment-alt2-stroke"></span>
        </a>
      </h3>
      <div>
        <p>{{= it.message}}</p>
      </div>
    </td>
  </tr>
'

$(window).on 'page_startup', () ->
  tabs = new window.hlib.Tabs '#views'

  $('body').on 'hlib_update', (event, startup_check) ->
    tid = window.settlers.tournament.tid

    req = new window.hlib.Ajax
      url:			'/tournament/state'
      data:
        tid:			tid
      handlers:
        h200:			(response, ajax) ->
          window.settlers.tournament = new window.settlers.TournamentObject response.tournament
          $('body').trigger 'hlib_render'
{'fraction_non_alphanumeric': 0.1829652996845426, 'fraction_numerical': 0.004281207751239297, 'mean_word_length': 2.7365319865319866, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 63, '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': '3731653', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1493, 'n_words': 274}