<commit_before>/**
 * Layout controller.
 *
 * @author <NAME> <<EMAIL>>
 */
(function ( $ ) {
  "use strict";

  function fillWith (container, sel) {
    var toFill = typeof sel === 'string' ? container.children(sel) : sel,
        height = container.height(),
        allocated = 0,
        remaining,
        fill;

    container.children().each(function () {
      var $this = $(this);

      if ($this.is(sel)) {
        return;
      }
      
      if (( $this.css('position') === 'static' ||
            $this.css('position') === 'relative') &&
          $this.css('float') === 'none')
      {
        allocated += $this.outerHeight(true);
      }
    });

    remaining = height - allocated;
    fill = remaining / toFill.length;
    toFill.each(function () {
      $(this).outerHeight(fill, true);
    });

    toFill
      .css('overflow', 'auto')
      .css('overflow-x', 'hidden');
  }

  $.layouts = {
    fillWith: fillWith
  };

  $.fn.layout = function (type, params) {

    if (type === null) {
      return this.each(function () {
        $(this).removeData('layout-fn');
      });
    }

    if (type) {
      return this.each(function () {
        var ctx = $(this);

        ctx.data('layout-fn', function () {
          $.layouts[type](ctx, params);
        });
      });
    }

    return this.each(function () {
      var ctx = $(this), fn = ctx.data('layout-fn');

      if (fn) {
        fn();
      }

      // Layout all children elements that also have a layout defined
      ctx.children().each(function () {
        $(this).layout();
      });
    });
  };

  // Add a resize handler to the window which applies all layout functions
  $(window).resize(function () {
    $(document).layout();
  });
<commit_msg>Updated layout to recursively remove layout from children when an elements layout is removed<commit_after>/**
 * Layout controller.
 *
 * @author <NAME> <<EMAIL>>
 */
(function ( $ ) {
  "use strict";

  function fillWith (container, sel) {
    var toFill = typeof sel === 'string' ? container.children(sel) : sel,
        height = container.height(),
        allocated = 0,
        remaining,
        fill;

    container.children().each(function () {
      var $this = $(this);

      if ($this.is(sel)) {
        return;
      }
      
      if (( $this.css('position') === 'static' ||
            $this.css('position') === 'relative') &&
          $this.css('float') === 'none')
      {
        allocated += $this.outerHeight(true);
      }
    });

    remaining = height - allocated;
    fill = remaining / toFill.length;
    toFill.each(function () {
      $(this).outerHeight(fill, true);
    });

    toFill
      .css('overflow', 'auto')
      .css('overflow-x', 'hidden');
  }

  $.layouts = {
    fillWith: fillWith
  };

  $.fn.layout = function (type, params) {

    if (type === null) {
      return this.each(function () {
        $(this).removeData('layout-fn');

        // Clear the layout on all descendants recursively
        $(this).children().layout(null);
      });
    }

    if (type) {
      return this.each(function () {
        var ctx = $(this);

        ctx.data('layout-fn', function () {
          $.layouts[type](ctx, params);
        });
      });
    }

    return this.each(function () {
      var ctx = $(this), fn = ctx.data('layout-fn');

      if (fn) {
        fn();
      }

      // Layout all children elements that also have a layout defined
      ctx.children().layout();
    });
  };

  // Add a resize handler to the window which applies all layout functions
  $(window).resize(function () {
    $(document).layout();
  });

{'fraction_non_alphanumeric': 0.17565698478561548, 'fraction_numerical': 0.0005532503457814661, 'mean_word_length': 2.0361041141897567, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3278549', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1069, 'n_words': 252}