<commit_before>/*
    angularGrid.js v 0.5.3
    Author: <NAME>
    Copyright (c) 2015-2016 <NAME> - ignitersworld.com , released under the MIT license.
    Demo on: http://ignitersworld.com/lab/angulargrid/demo1.html
    Documentation and download on https://github.com/s-yadav/angulargrid
*/

/* module to create pinterest like responsive masonry grid system for angular */
;
(function(angular, window, undefined) {
  "use strict";
  //defaults for plugin
  var defaults = {
    gridWidth: 300, //minumum width of a grid, this may increase to take whole space of container
    gutterSize: 10, //spacing between two grid,
    gridNo: 'auto', // grid number, by default calculate auto matically
    direction: 'ltor', //direction of grid item
    refreshOnImgLoad: true, // to make a refresh on image load inside container
    cssGrid: false,
    performantScroll: false,
    pageSize: 'auto', //decide based on screen size
    scrollContainer: 'body',
    infiniteScrollDelay: 3000,
    infiniteScrollDistance: 100,
  };

  var $ = angular.element;
  var camelCaseToHyphenCase = function(str) {
    return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
  }

  //css for the clones
  var cloneCss = {
    visibility: 'hidden',
    opacity: 0,
    top: 0,
    left: 0,
    width: ''
  };

  var single = (function() {
    var $elm = $(window);
    return function(elm) {
      $elm[0] = elm;
      return $elm;
    };
  }());

  //function to check if image is loaded
  function imageLoaded(img) {
    return img.complete && (typeof img.naturalWidth === 'undefined' || img.naturalWidth !== 0);
  }

  //function to covert domlist to array
  function domToAry(list) {
    return Array.prototype.slice.call(list);
  }



  //add required css
  $(document.head).append('<style>' +
    '.ag-no-transition{' +
    '-webkit-transition: none !important;' +
    'transition: none !important;' +
    '} ' +
    '.angular-grid{position : relative;} ' +
    '.angular-grid > *{opacity : 0} ' +
    '.angular-grid > .angular-grid-item{opacity : 1}' + '</style>');

  angular.module('angularGrid', []).directive('angularGrid', ['$timeout', '$window', '$q', 'angularGridInstance',
      function($timeout, $window, $q, angularGridInstance) {
        return {
          restrict: 'A',
          scope: {
            model: '=angularGrid',
            /** deprecated options ***/
            dep_gridWidth: '=gridWidth',
            dep_gutterSize: '=gutterSize',
            dep_refreshOnImgLoad: '=refreshOnImgLoad',
            dep_direction: '=direction',
            dep_cssGrid: '=cssGrid',
            dep_options: '=angularGridOptions',
            dep_agId: '@angularGridId',
            /** deprecated options end***/

            gridWidth: '=agGridWidth',
            gutterSize: '=agGutterSize',
            refreshOnImgLoad: '=agRefreshOnImgLoad',
            direction: '=agDirection',
            cssGrid: '=agCssGrid',
            options: '=agOptions',
            agId: '@',
            pageSize: '=agPageSize',
            performantScroll: '=agPerformantScroll',
            scrollContainer: '@agScrollContainer',
            infiniteScroll: '&agInfiniteScroll',
            infiniteScrollDistance: '=agInfiniteScrollDistance',
            infiniteScrollDelay: '=agInfiniteScrollDelay'
          },
          link: function(scope, element, attrs) {
            var domElm = element[0],
              win = $($window),
              agId = scope.agId || scope.dep_agId, // angularGridId is deprecated
              listElms,
              reflowCount = 0, //to keep tack of times reflowgrid been called
              timeoutPromise;

            element.addClass('angular-grid');



            //get the user input options
            var options = {};
            //check deprecated options
            ['gridWidth', 'gutterSize', 'refreshOnImgLoad', 'direction', 'options', 'cssGrid', 'agId'].forEach(function(key) {
              var depKey = camelCaseToHyphenCase(key);
              var correctKey = 'ag-' + camelCaseToHyphenCase(key);
              if (key == 'options') depKey = "angular-grid-options";
              if (key == 'agId') {
                depKey = "angular-grid-id";
                correctKey = "ag-id";
              }
              if (scope['dep_' + key] !== undefined) {
                if (console && console.warn) console.warn(depKey + ' is deprecated. Use ' + correctKey + ' instead in template.');
              }
            });

            function getOptions() {
              options = {};
              Object.keys(defaults).forEach(function(key) {
                if (scope[key] !== undefined) {
                  options[key] = scope[key];
                } else if (scope['dep_' + key] !== undefined) {
                  options[key] = scope['dep_' + key];
                }
              });
              options = angular.extend({}, defaults, options, scope.options || scope.dep_options);
              if (options.cssGrid) options.gutterSize = 0;
              if (options.pageSize == 'auto') {
                options.pageSize = window.offsetWidth >= 768 ? 2 : 3;
              }
            }

            getOptions();


            /********
            code to allow performant scroll
            *****/
            var scrollNs = {}; //namespace for performantScroll

            function findPos(obj, withRespectTo) {
              withRespectTo = withRespectTo || document.body;
              var curleft = 0,
                curtop = 0;
              if (obj.offsetParent) {
                do {
                  curleft += obj.offsetLeft;
                  curtop += obj.offsetTop;
                  obj = obj.offsetParent;
                } while (obj && obj != withRespectTo);
              }
              return {
                left: curleft,
                top: curtop
              };
            }

            function getScrollContainerInfo() {
              var container = $(document.querySelector(options.scrollContainer)),
                contElm = container[0];

              return {
                height: contElm.offsetHeight,
                scrollHeight: contElm.scrollHeight,
                startFrom: findPos(domElm, contElm).top,
                $elm: options.scrollContainer == 'body' ? win : container
              };
            }


            //this method check what all elements should be present on dom at specific page
            function calculatePageInfo(listElmPosInfo, scrollBodyHeight, colNo) {

              scrollNs.pageInfo = [{
                from: 0
              }];

              var elmInfo, from, to,
                pageSize = options.pageSize,
                scrollContHeight = scrollNs.scrollContInfo.height,
                pageHeight = scrollContHeight * pageSize,
                totalPages = Math.ceil(scrollBodyHeight / pageHeight),
                pageNo = 0;


              for (pageNo = 0; pageNo < totalPages; pageNo++) {
                for (var idx = 0, ln = listElmPosInfo.length; idx < ln; idx++) {<commit_msg>Fixed container height detection<commit_after>/*
    angularGrid.js v 0.5.3
    Author: <NAME>
    Copyright (c) 2015-2016 <NAME> - ignitersworld.com , released under the MIT license.
    Demo on: http://ignitersworld.com/lab/angulargrid/demo1.html
    Documentation and download on https://github.com/s-yadav/angulargrid
*/

/* module to create pinterest like responsive masonry grid system for angular */
;
(function(angular, window, undefined) {
  "use strict";
  //defaults for plugin
  var defaults = {
    gridWidth: 300, //minumum width of a grid, this may increase to take whole space of container
    gutterSize: 10, //spacing between two grid,
    gridNo: 'auto', // grid number, by default calculate auto matically
    direction: 'ltor', //direction of grid item
    refreshOnImgLoad: true, // to make a refresh on image load inside container
    cssGrid: false,
    performantScroll: false,
    pageSize: 'auto', //decide based on screen size
    scrollContainer: 'body',
    infiniteScrollDelay: 3000,
    infiniteScrollDistance: 100,
  };

  var $ = angular.element;
  var camelCaseToHyphenCase = function(str) {
    return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
  }

  //css for the clones
  var cloneCss = {
    visibility: 'hidden',
    opacity: 0,
    top: 0,
    left: 0,
    width: ''
  };

  var single = (function() {
    var $elm = $(window);
    return function(elm) {
      $elm[0] = elm;
      return $elm;
    };
  }());

  //function to check if image is loaded
  function imageLoaded(img) {
    return img.complete && (typeof img.naturalWidth === 'undefined' || img.naturalWidth !== 0);
  }

  //function to covert domlist to array
  function domToAry(list) {
    return Array.prototype.slice.call(list);
  }



  //add required css
  $(document.head).append('<style>' +
    '.ag-no-transition{' +
    '-webkit-transition: none !important;' +
    'transition: none !important;' +
    '} ' +
    '.angular-grid{position : relative;} ' +
    '.angular-grid > *{opacity : 0} ' +
    '.angular-grid > .angular-grid-item{opacity : 1}' + '</style>');

  angular.module('angularGrid', []).directive('angularGrid', ['$timeout', '$window', '$q', 'angularGridInstance',
      function($timeout, $window, $q, angularGridInstance) {
        return {
          restrict: 'A',
          scope: {
            model: '=angularGrid',
            /** deprecated options ***/
            dep_gridWidth: '=gridWidth',
            dep_gutterSize: '=gutterSize',
            dep_refreshOnImgLoad: '=refreshOnImgLoad',
            dep_direction: '=direction',
            dep_cssGrid: '=cssGrid',
            dep_options: '=angularGridOptions',
            dep_agId: '@angularGridId',
            /** deprecated options end***/

            gridWidth: '=agGridWidth',
            gutterSize: '=agGutterSize',
            refreshOnImgLoad: '=agRefreshOnImgLoad',
            direction: '=agDirection',
            cssGrid: '=agCssGrid',
            options: '=agOptions',
            agId: '@',
            pageSize: '=agPageSize',
            performantScroll: '=agPerformantScroll',
            scrollContainer: '@agScrollContainer',
            infiniteScroll: '&agInfiniteScroll',
            infiniteScrollDistance: '=agInfiniteScrollDistance',
            infiniteScrollDelay: '=agInfiniteScrollDelay'
          },
          link: function(scope, element, attrs) {
            var domElm = element[0],
              win = $($window),
              agId = scope.agId || scope.dep_agId, // angularGridId is deprecated
              listElms,
              reflowCount = 0, //to keep tack of times reflowgrid been called
              timeoutPromise;

            element.addClass('angular-grid');



            //get the user input options
            var options = {};
            //check deprecated options
            ['gridWidth', 'gutterSize', 'refreshOnImgLoad', 'direction', 'options', 'cssGrid', 'agId'].forEach(function(key) {
              var depKey = camelCaseToHyphenCase(key);
              var correctKey = 'ag-' + camelCaseToHyphenCase(key);
              if (key == 'options') depKey = "angular-grid-options";
              if (key == 'agId') {
                depKey = "angular-grid-id";
                correctKey = "ag-id";
              }
              if (scope['dep_' + key] !== undefined) {
                if (console && console.warn) console.warn(depKey + ' is deprecated. Use ' + correctKey + ' instead in template.');
              }
            });

            function getOptions() {
              options = {};
              Object.keys(defaults).forEach(function(key) {
                if (scope[key] !== undefined) {
                  options[key] = scope[key];
                } else if (scope['dep_' + key] !== undefined) {
                  options[key] = scope['dep_' + key];
                }
              });
              options = angular.extend({}, defaults, options, scope.options || scope.dep_options);
              if (options.cssGrid) options.gutterSize = 0;
              if (options.pageSize == 'auto') {
                options.pageSize = window.offsetWidth >= 768 ? 2 : 3;
              }
            }

            getOptions();


            /********
            code to allow performant scroll
            *****/
            var scrollNs = {}; //namespace for performantScroll

            function findPos(obj, withRespectTo) {
              withRespectTo = withRespectTo || document.body;
              var curleft = 0,
                curtop = 0;
              if (obj.offsetParent) {
                do {
                  curleft += obj.offsetLeft;
                  curtop += obj.offsetTop;
                  obj = obj.offsetParent;
                } while (obj && obj != withRespectTo);
              }
              return {
                left: curleft,
                top: curtop
              };
            }

            function getScrollContainerInfo() {
              var container = $(document.querySelector(options.scrollContainer)),
                contElm = container[0];

              return {
                height: contElm.offsetHeight,
                scrollHeight: element.prop('offsetHeight'),
                startFrom: findPos(domElm, contElm).top,
                $elm: options.scrollContainer == 'body' ? win : container
              };
            }


            //this method check what all elements should be present on dom at specific page
            function calculatePageInfo(listElmPosInfo, scrollBodyHeight, colNo) {

              scrollNs.pageInfo = [{
                from: 0
              }];

              var elmInfo, from, to,
                pageSize = options.pageSize,
                scrollContHeight = scrollNs.scrollContInfo.height,
                pageHeight = scrollContHeight * pageSize,
                totalPages = Math.ceil(scrollBodyHeight / pageHeight),
                pageNo = 0;


              for (pageNo = 0; pageNo < totalPages; pageNo++) {
                for (var idx = 0, ln = listElmPosInfo.length; idx < ln; idx++) {
{'fraction_non_alphanumeric': 0.12315096609809612, 'fraction_numerical': 0.006794536060584613, 'mean_word_length': 1.8316633266533067, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6917139', 'n_tokens_mistral': 3972, 'n_tokens_neox': 3767, 'n_words': 957}