<commit_before>var GenericTable = new Widget({
  init: function (element) {
    this.rows = this.find('tr');
    var _this = this;
    this.rows.each(function (i, row) {
      $u(row).bind('click', function (event) {
        _this.onRowClick(row);
      })
    })
  },

  onRowClick: function (row) {
    if (this.selectedRow == row) {
      $u(this.selectedRow).removeClass('selected');
      return;
    }

    if (this.selectedRow) {
      $u(this.selectedRow).removeClass('selected');
    }

    this.selectedRow = row;
    $u(row).addClass('selected');
  },
});

GenericTable.init = function(node) {
  $u(node).find('table').each(function(i, el) {
    new GenericTable(el);<commit_msg>Try to make select next-prev in table (not done)<commit_after>var GenericTable = new Widget({
  init: function (element) {
    this.rows = this.find('tr');
    var _this = this;
    this.rows.each(function (i, row) {
      $u(row).bind('click', function (event) {
        _this.onRowClick(row);
      });
    });

    window.Mousetrap.bind("down", function () {
      this.selectNextRow();
      return false;
    }.bind(this));

    window.Mousetrap.bind("up", function () {
      this.selectPrevRow();
      return false;
    }.bind(this));
  },

  onRowClick: function (row) {
    if (this.selectedRow == row) {
      $u(this.selectedRow).removeClass('selected');
      return;
    }

    if (this.selectedRow) {
      $u(this.selectedRow).removeClass('selected');
    }

    this.selectedRow = row;
    console.log('selected', this.selectedRow);
    $u(row).addClass('selected');
  },

  selectNextRow: function () {
    console.log('selected', this.selectedRow, this);
    if (this.selectedRow) {
      var newNext = $u(this.selectedRow).next('tr')[0];
      console.log('new next', newNext);
    }
  }
});

GenericTable.init = function(node) {
  $u(node).find('table').each(function(i, el) {
    new GenericTable(el);
{'fraction_non_alphanumeric': 0.17773131207527443, 'fraction_numerical': 0.0005227391531625719, 'mean_word_length': 2.970954356846473, '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': '6932254', 'n_tokens_mistral': 644, 'n_tokens_neox': 637, 'n_words': 112}