<commit_before>/*global window, document, jQuery, Handsontable, NVMetadata */
(function ($) {
  'use strict';

  /*jslint unparam: true */
  var boldRenderer = function (instance, td, row, col, prop,
    value, cellProperties) {
    //jshint unused:false

    Handsontable.renderers.TextRenderer.apply(this, arguments);
    td.style.fontWeight = 'bold';
  };

  $(document).ready(function () {
    var container = document.getElementById('hot'),
      hot = new Handsontable(container, {
        data: window.NVMetadata.data,
        stretchH: 'all',
        colHeaders: true,
        rowHeaders: true,
        contextMenu: true,
        height: 400,
        cells: function (r) {
          if (r === 0) {
            this.renderer = boldRenderer;
          }
        }
      });

    $('.btn-save-metadata').click(function () {
      $.ajax({
        type: 'POST',
        data: JSON.stringify(hot.getData()),
        contentType: 'application/json; charset=utf-8'
      })
        .done(function () {
          var collectionId = NVMetadata.getCollectionIdFromURL(
            window.location.href
          );
          window.location.replace('/collections/' + collectionId);
        })
        .fail(function (jqXHR, textStatus, errorThrown) {
          NVMetadata.displayErrors($('.errors'),
            NVMetadata.getErrors(jqXHR, textStatus, errorThrown));
        });
    });

    window.onbeforeunload = function () {
      if (window.sheetModified) {
        return 'You have pending unsaved changes. ' +
          'Do you really want to discard them ?';
      }
    };
  });

}(jQuery));<commit_msg>made the "File Name" column readOnly in the metadata grid (locked for edits)<commit_after>/*global window, document, jQuery, Handsontable, NVMetadata */
(function ($) {
  'use strict';

  /*jslint unparam: true */
  var boldRenderer = function (instance, td, row, col, prop,
    value, cellProperties) {
    //jshint unused:false

    Handsontable.renderers.TextRenderer.apply(this, arguments);
    td.style.fontWeight = 'bold';
  };

  $(document).ready(function () {
    var container = document.getElementById('hot'),
      hot = new Handsontable(container, {
        data: window.NVMetadata.data,
        stretchH: 'all',
        colHeaders: true,
        rowHeaders: true,
        contextMenu: true,
        height: 400,
        cells: function (r, c) {
          if (r === 0) {
            this.renderer = boldRenderer;
          }
          if (c === 0) {
            return {readOnly: true};
          }
        }
      });

    $('.btn-save-metadata').click(function () {
      $.ajax({
        type: 'POST',
        data: JSON.stringify(hot.getData()),
        contentType: 'application/json; charset=utf-8'
      })
        .done(function () {
          var collectionId = NVMetadata.getCollectionIdFromURL(
            window.location.href
          );
          window.location.replace('/collections/' + collectionId);
        })
        .fail(function (jqXHR, textStatus, errorThrown) {
          NVMetadata.displayErrors($('.errors'),
            NVMetadata.getErrors(jqXHR, textStatus, errorThrown));
        });
    });

    window.onbeforeunload = function () {
      if (window.sheetModified) {
        return 'You have pending unsaved changes. ' +
          'Do you really want to discard them ?';
      }
    };
  });

}(jQuery));
{'fraction_non_alphanumeric': 0.13801308744794766, 'fraction_numerical': 0.003271861986912552, 'mean_word_length': 2.1756373937677056, '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': '370204', 'n_tokens_mistral': 983, 'n_tokens_neox': 976, 'n_words': 212}