<commit_before>poller = () ->
  $.getJSON("<%= Rails.application.routes.url_helpers.join_dynamic_path %>",
    (data, textStatus) ->
      if data["ready"]
        adjust_page(data["step"], data["body"], data["explanation"])
      if data["keep_polling"]
        setTimeout(poller, 200)
  )

<%# Include a helper for the header styles below %>
<% environment.context_class.instance_eval { include JoinHelper } %>

adjust_page = (step, body, explanation) ->
  for i in [1,2,3]
    if i == step
      if body
        node = $("#body#{i} > .contents")
        node.empty()
        node.append(body)
      if explanation
        node = $("#explanation#{i} > .contents")
        node.empty()
        node.append(explanation)
      $("#header#{i}").removeClass("<%= inactive_header_style %>")
      $("#header#{i}").addClass("<%= active_header_style %>")
      $("#body#{i}").removeClass("hidden")
      $("#explanation#{i}").removeClass("hidden")
    else
      $("#header#{i}").removeClass("<%= active_header_style %>")
      $("#header#{i}").addClass("<%= inactive_header_style %>")
      $("#body#{i}").addClass("hidden")
      $("#explanation#{i}").addClass("hidden")

$(document).ready ->
  setTimeout(poller, 200)
<commit_msg>Remove ?code from the url on the /join url.<commit_after>poller = () ->
  $.getJSON("<%= Rails.application.routes.url_helpers.join_dynamic_path %>",
    (data, textStatus) ->
      if data["ready"]
        adjust_page(data["step"], data["body"], data["explanation"])
      if data["keep_polling"]
        setTimeout(poller, 200)
  )

<%# Include a helper for the header styles below %>
<% environment.context_class.instance_eval { include JoinHelper } %>

adjust_page = (step, body, explanation) ->
  for i in [1,2,3]
    if i == step
      if body
        node = $("#body#{i} > .contents")
        node.empty()
        node.append(body)
      if explanation
        node = $("#explanation#{i} > .contents")
        node.empty()
        node.append(explanation)
      $("#header#{i}").removeClass("<%= inactive_header_style %>")
      $("#header#{i}").addClass("<%= active_header_style %>")
      $("#body#{i}").removeClass("hidden")
      $("#explanation#{i}").removeClass("hidden")
    else
      $("#header#{i}").removeClass("<%= active_header_style %>")
      $("#header#{i}").addClass("<%= inactive_header_style %>")
      $("#body#{i}").addClass("hidden")
      $("#explanation#{i}").addClass("hidden")

$(document).ready ->
  setTimeout(poller, 200)
  history.replaceState(null, null, "<%= Rails.application.routes.url_helpers.join_path %>")

{'fraction_non_alphanumeric': 0.20846273291925466, 'fraction_numerical': 0.006987577639751553, 'mean_word_length': 3.4973821989528795, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 30, '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': '4822162', 'n_tokens_mistral': 813, 'n_tokens_neox': 816, 'n_words': 143}