<commit_before>(function($) {
    $(document).ready(function(){
        $('.edit_chunk').on(
            'click',
            'a',
            function() {
                var key = $(this).parent().data('key');
                var chunk = $(this).parent();
                chunk.empty();
                $.get('/chunks/edit/' + key + '/',
                      {},
                      function(data) {
                          chunk.html(data)
                          $('form', chunk).ajaxForm({
                              dataType: 'text',
                              beforeSubmit: function() { $('button', chunk).prop('disabled', true); },
                              success: function(d, s, x) {
                                  console.log('SUCCESS: ' + x.status);
                                  $('form', chunk).css({
                                      'border': '10px solid green',
                                  }).animate(
                                      {'opacity': 'hide',},
                                      1000, 'linear',
                                      function() {
                                          var txt = $('.edit_chunk form textarea').val();
                                          chunk.empty();
                                          chunk.html(txt + '<a href="#">редактировать</a>')
                                      }
                                  );
                              },
                              error: function(d, s, x) { console.log('ERROR: ' + x.status); }
                          });
                      });
                return false;
            });
    });
})(jQuery);
<commit_msg>Select the chunk content on edit.<commit_after>(function($) {
    $(document).ready(function(){
        $('.edit_chunk').on(
            'click',
            'a',
            function() {
                var key = $(this).parent().data('key');
                var chunk = $(this).parent();
                chunk.empty();
                $.get('/chunks/edit/' + key + '/',
                      {},
                      function(data) {
                          chunk.html(data)
                          $('form', chunk).ajaxForm({
                              dataType: 'text',
                              beforeSubmit: function() { $('button', chunk).prop('disabled', true); },
                              success: function(d, s, x) {
                                  console.log('SUCCESS: ' + x.status);
                                  $('form', chunk).css({
                                      'border': '10px solid green',
                                  }).animate(
                                      {'opacity': 'hide',},
                                      1000, 'linear',
                                      function() {
                                          var txt = $('.edit_chunk form textarea').val();
                                          chunk.empty();
                                          chunk.html(txt + '<a href="#">редактировать</a>')});
                              },
                              error: function(d, s, x) { console.log('ERROR: ' + x.status); }
                          }).find('textarea').select();
                      });
                return false;
            });
    });
})(jQuery);

{'fraction_non_alphanumeric': 0.1406064209274673, 'fraction_numerical': 0.0035671819262782403, 'mean_word_length': 0.7282999486389317, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7195834', 'n_tokens_mistral': 726, 'n_tokens_neox': 674, 'n_words': 130}