<commit_before>
#editor = ace.edit("editor")
#editor.getSession().setMode("ace/mode/markdown")

jQuery ->
  jQuery('.editor').ace({ theme: 'github', lang: 'markdown', width: '100%', indent: 2 })
  jQuery('.editor-meta select').change event, ->
    ace = jQuery(event.srcElement)
      .closest('.editor-container')
      .find('.editor')
      .data('ace')
    ace.editor.ace.getSession().setMode("ace/mode/#{event.srcElement.value}")
  jQuery('.initial-focus').focus()

  # For the nested form.
  document.body.addEventListener "DOMNodeInserted", ((event) ->
    elementJustAdded = jQuery(event.target)
    if elementJustAdded.hasClass("fields")
      jQuery(".editor").ace
        lang: "markdown"
        indent: 2
        width: "100%"
        theme: "github"

      jQuery(event.srcElement).find(".editor-meta select").change (ev) ->
        ace = undefined
        ace = jQuery(ev.target).closest(".editor-container").find(".editor").data("ace")
        ace.editor.ace.getSession().setMode "ace/mode/" + ev.target.value

    return
  ), false
<commit_msg>Fix adding new gists in firefox<commit_after>
#editor = ace.edit("editor")
#editor.getSession().setMode("ace/mode/markdown")

jQuery ->
  jQuery('.editor').ace({ theme: 'github', lang: 'markdown', width: '100%', indent: 2 })
  jQuery('.editor-meta select').change (event) ->
    ace = jQuery(event.srcElement)
      .closest('.editor-container')
      .find('.editor')
      .data('ace')
    ace.editor.ace.getSession().setMode("ace/mode/#{event.srcElement.value}")
  jQuery('.initial-focus').focus()

  # For the nested form.
  document.addEventListener "DOMNodeInserted", ((event) ->
    elementJustAdded = jQuery(event.target)
    if elementJustAdded.hasClass("fields")
      jQuery(".editor").ace
        lang: "markdown"
        indent: 2
        width: "100%"
        theme: "github"

      jQuery(event.srcElement).find(".editor-meta select").change (ev) ->
        ace = undefined
        ace = jQuery(ev.target).closest(".editor-container").find(".editor").data("ace")
        ace.editor.ace.getSession().setMode "ace/mode/" + ev.target.value

    return
  ), false

{'fraction_non_alphanumeric': 0.18352059925093633, 'fraction_numerical': 0.00749063670411985, 'mean_word_length': 3.231683168316832, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5885996', 'n_tokens_mistral': 663, 'n_tokens_neox': 637, 'n_words': 117}