<commit_before>angular.module( 'ngCurtain', [] )

.directive( 'ctnCurtains', function( $window, $document, $location ) {
  return {
    restrict: 'EA',
    transclude: true,
    replace: true,
    template: '<ul class="ctn-curtains" ng-transclude></ul>',
    scope: true,
    controller: function ( $scope, $element ) {
      $scope.window = angular.element( $window );
      var sections = $scope.sections = [];
      var windowHeight;
      var bodyHeight;
      var currentSectionIdx;
      var body = $document.find( 'body' );
      $scope.locationChangeFromScroll = false;

      /**
       * Used by the child ctnSection elements to register themselves as
       * sections within this curtain.
       */
      this.addSection = function ( section ) {
        sections.push( section );
      };

      /**
       * Change the current section.
       */
      this.setCurrent = $scope.setCurrent = function ( idx ) {
        currentSectionIdx = idx || 0;

        var currSection = sections[ currentSectionIdx ];

        angular.forEach( sections, function forEachRemoveCurrent ( section ) {
          section.isCurrent = false;
          section.isHidden = true;
        });

        currSection.isCurrent = true;
        currSection.isHidden = false;
        $location.path( currSection.path );

        if ( sections.length > currentSectionIdx + 1 ) {
          sections[ currentSectionIdx + 1 ].isHidden = false;
        }
      };

      $scope.scrollTo = function scrollTo () {
        var path = $location.path();
        angular.forEach( sections, function forEachSectionCheckLocation ( section, index ) {
          if ( section.path === path ) {
            currentSectionIdx = index;
          }
        });
        currentSectionIdx = currentSectionIdx || 0;

        $scope.setCurrent( currentSectionIdx );
        $scope.window.prop( 'scrollTop', sections[ currentSectionIdx ].levelHeight );
        
        angular.forEach( sections, function forEachSectionCheckLocation ( section, index ) {
          if ( index < currentSectionIdx ) {
            section.translate( -(section.height) );
          }
        });
      };

      /**
       * Based on the height of the window and the height of each section, set
       * the height of all sections.
       */
      $scope.configureSections = function configureSections () {
        var height, zidx, levelHeight = 0;<commit_msg>fix(*): changed scroll method to work cross-browser<commit_after>angular.module( 'ngCurtain', [] )

.directive( 'ctnCurtains', function( $window, $document, $location ) {
  return {
    restrict: 'EA',
    transclude: true,
    replace: true,
    template: '<ul class="ctn-curtains" ng-transclude></ul>',
    scope: true,
    controller: function ( $scope, $element ) {
      $scope.window = angular.element( $window );
      var sections = $scope.sections = [];
      var windowHeight;
      var bodyHeight;
      var currentSectionIdx;
      var body = $document.find( 'body' );
      $scope.locationChangeFromScroll = false;

      /**
       * Used by the child ctnSection elements to register themselves as
       * sections within this curtain.
       */
      this.addSection = function ( section ) {
        sections.push( section );
      };

      /**
       * Change the current section.
       */
      this.setCurrent = $scope.setCurrent = function ( idx ) {
        currentSectionIdx = idx || 0;

        var currSection = sections[ currentSectionIdx ];

        angular.forEach( sections, function forEachRemoveCurrent ( section ) {
          section.isCurrent = false;
          section.isHidden = true;
        });

        currSection.isCurrent = true;
        currSection.isHidden = false;
        $location.path( currSection.path );

        if ( sections.length > currentSectionIdx + 1 ) {
          sections[ currentSectionIdx + 1 ].isHidden = false;
        }
      };

      $scope.scrollTo = function scrollTo () {
        var path = $location.path();
        angular.forEach( sections, function forEachSectionCheckLocation ( section, index ) {
          if ( section.path === path ) {
            currentSectionIdx = index;
          }
        });
        currentSectionIdx = currentSectionIdx || 0;

        $scope.setCurrent( currentSectionIdx );
        $scope.window[0].scroll( 0, sections[ currentSectionIdx ].levelHeight );
        
        angular.forEach( sections, function forEachSectionCheckLocation ( section, index ) {
          if ( index < currentSectionIdx ) {
            section.translate( -(section.height) );
          }
        });
      };

      /**
       * Based on the height of the window and the height of each section, set
       * the height of all sections.
       */
      $scope.configureSections = function configureSections () {
        var height, zidx, levelHeight = 0;
{'fraction_non_alphanumeric': 0.11157110329124405, 'fraction_numerical': 0.002483957772717864, 'mean_word_length': 2.195767195767196, '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': '1628904', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1263, 'n_words': 337}