<commit_before>(function(window, document){

  var FableTable = function(wrapper) {
    this.wrapper = wrapper;
    this.table = wrapper.querySelector('table');
    this.header = this.table.querySelector('thead');
    this.headerClone = this.header.cloneNode(true);
  };


  FableTable.prototype.prepareHeadColumn = function(column, reference) {
    var computedStyle = window.getComputedStyle(reference, null);

    column.style.display = 'inline-block';
    column.style.minWidth = reference.offsetWidth + 'px';

    column.style.padding = computedStyle.getPropertyValue('padding');
    column.style.border = computedStyle.getPropertyValue('border');

    return this;
  };

  FableTable.prototype.prepareHeaderClone = function() {
    this.headerClone.className += ' fab-tab-header';
    this.headerClone.style.display = 'table';
    this.headerClone.style.width = this.header.offsetWidth + 'px';

    var headings = this.header.querySelectorAll('th');
    var headingsClone = this.headerClone.querySelectorAll('th');

    for (var i in headings) {
      if (headings.hasOwnProperty(i)) {
        var heading = headings[i];
        var headingClone = headingsClone[i];
        this.prepareHeadColumn(headingClone, heading);
      }
    }

    return this;
  };

  FableTable.prototype.prependHeaderClone = function() {
    this.wrapper.insertBefore(this.headerClone, this.table);
    return this;
  };

  FableTable.prototype.checkAndMoveHeader = function() {
    // console.log(this.header.offsetTop);
    var tableOffset = FableTable.util.offset(this.header);
    var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;

    var tableYOffset = tableOffset.y - scrollTop;

    if (tableYOffset < 0) {
      this.headerClone.style.display = 'block';
      this.headerClone.style.top = -1*tableYOffset + 'px';
    } else {
      this.headerClone.style.display = 'none';
    }

    setTimeout(this.checkAndMoveHeader.bind(this), 500);
    return this;
  };

  FableTable.prototype.addDistanceCheck = function() {
    setTimeout(this.checkAndMoveHeader.bind(this), 500);

    return this;
  };

  FableTable.prototype.initialize = function() {
    this
    .prepareHeaderClone()
    .prependHeaderClone()
    .addDistanceCheck();

    return this;
  };

  FableTable.util = {};
<commit_msg>tweaked function binding<commit_after>(function(window, document){

  var FableTable = function(wrapper) {
    this.wrapper = wrapper;
    this.table = wrapper.querySelector('table');
    this.header = this.table.querySelector('thead');
    this.headerClone = this.header.cloneNode(true);

    this.checkAndMoveHeader = this.checkAndMoveHeader.bind(this);
  };


  FableTable.prototype.prepareHeadColumn = function(column, reference) {
    var computedStyle = window.getComputedStyle(reference, null);

    column.style.display = 'inline-block';
    column.style.minWidth = reference.offsetWidth + 'px';

    column.style.padding = computedStyle.getPropertyValue('padding');
    column.style.border = computedStyle.getPropertyValue('border');

    return this;
  };

  FableTable.prototype.prepareHeaderClone = function() {
    this.headerClone.className += ' fab-tab-header';
    this.headerClone.style.display = 'table';
    this.headerClone.style.width = this.header.offsetWidth + 'px';

    var headings = this.header.querySelectorAll('th');
    var headingsClone = this.headerClone.querySelectorAll('th');

    for (var i in headings) {
      if (headings.hasOwnProperty(i)) {
        var heading = headings[i];
        var headingClone = headingsClone[i];
        this.prepareHeadColumn(headingClone, heading);
      }
    }

    return this;
  };

  FableTable.prototype.prependHeaderClone = function() {
    this.wrapper.insertBefore(this.headerClone, this.table);
    return this;
  };

  FableTable.prototype.checkAndMoveHeader = function() {
    // console.log(this.header.offsetTop);
    var tableOffset = FableTable.util.offset(this.header);
    var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;

    var tableYOffset = tableOffset.y - scrollTop;

    if (tableYOffset < 0) {
      this.headerClone.style.display = 'block';
      this.headerClone.style.top = -1*tableYOffset + 'px';
    } else {
      this.headerClone.style.display = 'none';
    }

    setTimeout(this.checkAndMoveHeader, 500);
    return this;
  };

  FableTable.prototype.addDistanceCheck = function() {
    setTimeout(this.checkAndMoveHeader, 500);

    return this;
  };

  FableTable.prototype.initialize = function() {
    this
    .prepareHeaderClone()
    .prependHeaderClone()
    .addDistanceCheck();

    return this;
  };

  FableTable.util = {};

{'fraction_non_alphanumeric': 0.12918561389003722, 'fraction_numerical': 0.0033071517155849523, 'mean_word_length': 3.591081593927894, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1146758', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1452, 'n_words': 238}