<commit_before># Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

# This really is the wrong file for all of this

$ ->
  $(document).on 'click', '.show-post-body', (event) ->
    span = $(this)
    unless $(this).data('postloaded')
      # If we need to lazy-load the post body from the server
      # This is criminally ugly
      $($(this).parent().children('div.post-body')[0]).load "/post/#{$(this).data('postid')}/body", ->
         console.log("yay")
         togglePostBodyVisible(span)
         span.data('postloaded', true)

    else
      togglePostBodyVisible(this)

  $(document).on 'keyup', '#search', (event) ->
    val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
    console.log val

    $("tr").not('tr:first').show().filter( () ->
      text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
      return !~text.indexOf(val);
    ).hide();
  $(document).on 'click', '#search ~ li a', () ->
    $('#search').focus()
  setTimeout ->
    $('#search').addClass 'ready'
  , 100

togglePostBodyVisible = (row) ->
  $(".post-body[data-postid='" + $(row).data("postid") + "']").toggle()

  if $(row).text() == "►"
    $(row).text("▼")
  else if $(row).text() == "▼"
    $(row).text("►")<commit_msg>preventDefault when search icon clicked<commit_after># Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

# This really is the wrong file for all of this

$ ->
  $(document).on 'click', '.show-post-body', (event) ->
    span = $(this)
    unless $(this).data('postloaded')
      # If we need to lazy-load the post body from the server
      # This is criminally ugly
      $($(this).parent().children('div.post-body')[0]).load "/post/#{$(this).data('postid')}/body", ->
         console.log("yay")
         togglePostBodyVisible(span)
         span.data('postloaded', true)

    else
      togglePostBodyVisible(this)

  $(document).on 'keyup', '#search', (event) ->
    val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
    console.log val

    $("tr").not('tr:first').show().filter( () ->
      text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
      return !~text.indexOf(val);
    ).hide();
  $(document).on 'click', 'li.search-icon a', (e) ->
    $('#search').focus()
    e.preventDefault()
  setTimeout ->
    $('#search').addClass 'ready'
  , 100

togglePostBodyVisible = (row) ->
  $(".post-body[data-postid='" + $(row).data("postid") + "']").toggle()

  if $(row).text() == "►"
    $(row).text("▼")
  else if $(row).text() == "▼"
    $(row).text("►")
{'fraction_non_alphanumeric': 0.21762208067940553, 'fraction_numerical': 0.0028308563340410475, 'mean_word_length': 3.188148148148148, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6798900', 'n_tokens_mistral': 909, 'n_tokens_neox': 916, 'n_words': 228}