<commit_before>jQuery.postJSON = function( url, data, type ) {
  return jQuery.ajax({
    type: 'POST',
    contentType: 'application/json; charset=UTF-8',
    url: url,
    data: data,
    dataType: type
  });
};

window.PG.Views.ChapterAssessment = Backbone.View.extend({
  template: JST['backbone/templates/chapter_assessment'],

  events: {
    'blur  .edit-word': 'wordChanged',
    'click .show-results': 'showResults'
  }

, initialize: function(options) {
    this.assessment = options.assessment;
    this.rules      = options.rules;
    this.lessons    = options.lessons;
    this.chunks     = this.assessment.chunks;
    this.questions  = this.chunks.select(function(c) { return c.get('answer') });

    this.showStory();
  }

, showPracticeQuestions: function() {
    return this.assessment.get('rule_position');
  }

, showStory: function() {
    this.$('.text').html(
      this.template({ chunks: this.assessment.chunks })
    );

    this.$('.edit-word').attr('contentEditable', true);
  }

, wordChanged: function(e) {
    var $word, chunk;
    $word = $(e.target);
    chunk = this.chunks.get($word.data('id'));
    chunk.input = $word.text().trim();

    if (chunk.input === chunk.word) {
      return $word.removeClass('edited');
    } else {
      return $word.addClass('edited');
    }
  }
<commit_msg>fixes "Double clicking on a word turns the word into bold. "<commit_after>jQuery.postJSON = function( url, data, type ) {
  return jQuery.ajax({
    type: 'POST',
    contentType: 'application/json; charset=UTF-8',
    url: url,
    data: data,
    dataType: type
  });
};

window.PG.Views.ChapterAssessment = Backbone.View.extend({
  template: JST['backbone/templates/chapter_assessment'],

  events: {
    'blur  .edit-word': 'wordChanged',
    'click .show-results': 'showResults'
  }

, initialize: function(options) {
    this.assessment = options.assessment;
    this.rules      = options.rules;
    this.lessons    = options.lessons;
    this.chunks     = this.assessment.chunks;
    this.questions  = this.chunks.select(function(c) { return c.get('answer') });

    this.showStory();
  }

, showPracticeQuestions: function() {
    return this.assessment.get('rule_position');
  }

, showStory: function() {
    this.$('.text').html(
      this.template({ chunks: this.assessment.chunks })
    );

    this.$('.edit-word').attr('contentEditable', true);
  }

, wordChanged: function(e) {
    var $word, chunk;
    $word = $(e.target);
    chunk = this.chunks.get($word.data('id'));
    chunk.input = $word.text().trim();

    if (chunk.input === chunk.word || chunk.input === chunk.error) {
      return $word.removeClass('edited');
    } else {
      return $word.addClass('edited');
    }
  }

{'fraction_non_alphanumeric': 0.17094644167278064, 'fraction_numerical': 0.0007336757153338225, 'mean_word_length': 3.1506849315068495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3312977', 'n_tokens_mistral': 920, 'n_tokens_neox': 891, 'n_words': 163}