<commit_before>'use strict';

angular.module('angular-parallax', [
]).directive('parallax', ['$window', function($window) {
  return {
    restrict: 'A',
    scope: {
      parallaxRatio: '@',
      parallaxVerticalOffset: '@',
      parallaxHorizontalOffset: '@',
    },
    link: function($scope, elem, $attrs) {
      var setPosition = function () {
        // horizontal positioning
        elem.css('left', $scope.parallaxHorizontalOffset + "px");

        var calcValY = $window.pageYOffset * ($scope.parallaxRatio ? $scope.parallaxRatio : 1.1 );
        if (calcValY <= $window.innerHeight) {
          var topVal = (calcValY < $scope.parallaxVerticalOffset ? $scope.parallaxVerticalOffset : calcValY);
          elem.css('top', topVal + "px");
        }
      };

      setPosition();

      angular.element($window).bind("scroll", setPosition);
      angular.element($window).bind("touchmove", setPosition);
    }  // link function
  };
}]).directive('parallaxBackground', ['$window', function($window) {
  return {
    restrict: 'A',
    transclude: true,
    template: '<div ng-transclude></div>',
    scope: {
      parallaxRatio: '@',
    },
    link: function($scope, elem, attrs) {
      var setPosition = function () {
        var calcValY = (elem.prop('offsetTop') - $window.pageYOffset) * ($scope.parallaxRatio ? $scope.parallaxRatio : 1.1 );
        // horizontal positioning
        elem.css('background-position', "50% " + calcValY + "px");
      };

      // set our initial position - fixes webkit background render bug
      angular.element($window).bind('load', function(e) {
        setPosition();
        $scope.$apply();
      });

      angular.element($window).bind("scroll", setPosition);
      angular.element($window).bind("touchmove", setPosition);
    }  // link function
  };
}]).directive("scroll", function ($window) {
    return {
        restrict: 'A',
        scope: {
        },
        link: function($scope,element, attrs) {
            var lastScrollTop = 0;
            var newMarginValue = 0;

            var moveCloudsToLeft = function(margin){
              var margin = margin.substring(0, margin.length - 2);
              newMarginValue = margin - 12;
              _.each(element, function(ele){
                  ele.style.marginLeft = newMarginValue + "px";
              });
            };
            var moveCloudsToRight = function(margin){
              var margin = margin.substring(0, margin.length - 2);
              newMarginValue = parseInt(margin) + 12;
              _.each(element, function(ele){
                  ele.style.marginLeft = newMarginValue + "px";
              });
            };

            angular.element($window).bind("scroll", function() {
              var currentScrollPosition = $window.scrollY;
              var isDownwordScroll = currentScrollPosition > lastScrollTop;
              var element = document.getElementById('clouds'),
                style = window.getComputedStyle(element),
                marginLeftValue = style.getPropertyValue('margin-left').toString();

              if(isDownwordScroll){
                moveCloudsToLeft(marginLeftValue);
              }
              else{
                moveCloudsToRight(marginLeftValue);
              }
              lastScrollTop = currentScrollPosition;
            });
        }  // link function
      };
});
;
<commit_msg>making the move left element independent of id clouds<commit_after>'use strict';

angular.module('angular-parallax', [])
.directive('parallax', ['$window', function($window) {
  return {
    restrict: 'A',
    scope: {
      parallaxRatio: '@',
      parallaxVerticalOffset: '@',
      parallaxHorizontalOffset: '@',
    },
    link: function($scope, elem, $attrs) {
      var setPosition = function () {
        // horizontal positioning
        elem.css('left', $scope.parallaxHorizontalOffset + "px");

        var calcValY = $window.pageYOffset * ($scope.parallaxRatio ? $scope.parallaxRatio : 1.1 );
        if (calcValY <= $window.innerHeight) {
          var topVal = (calcValY < $scope.parallaxVerticalOffset ? $scope.parallaxVerticalOffset : calcValY);
          elem.css('top', topVal + "px");
        }
      };

      setPosition();

      angular.element($window).bind("scroll", setPosition);
      angular.element($window).bind("touchmove", setPosition);
    }  // link function
  };
}])
.directive('parallaxBackground', ['$window', function($window) {
  return {
    restrict: 'A',
    transclude: true,
    template: '<div ng-transclude></div>',
    scope: {
      parallaxRatio: '@',
    },
    link: function($scope, elem, attrs) {
      var setPosition = function () {
        var calcValY = (elem.prop('offsetTop') - $window.pageYOffset) * ($scope.parallaxRatio ? $scope.parallaxRatio : 1.1 );
        // horizontal positioning
        elem.css('background-position', "50% " + calcValY + "px");
      };

      // set our initial position - fixes webkit background render bug
      angular.element($window).bind('load', function(e) {
        setPosition();
        $scope.$apply();
      });

      angular.element($window).bind("scroll", setPosition);
      angular.element($window).bind("touchmove", setPosition);
    }  // link function
  };
}])
.directive("scroll", function ($window) {
    return {
        restrict: 'A',
        scope: {
        },
        link: function($scope,element, attrs) {
            var lastScrollTop = 0;
            var newMarginValue = 0;

            var moveCloudsToLeft = function(margin){
              var margin = margin.substring(0, margin.length - 2);
              newMarginValue = margin - 12;
              _.each(element, function(ele){
                  ele.style.marginLeft = newMarginValue + "px";
              });
            };
            var moveCloudsToRight = function(margin){
              var margin = margin.substring(0, margin.length - 2);
              newMarginValue = parseInt(margin) + 12;
              _.each(element, function(ele){
                  ele.style.marginLeft = newMarginValue + "px";
              });
            };

            var setPosition = function() {
                var currentScrollPosition = $window.scrollY;
                var isDownwordScroll = currentScrollPosition > lastScrollTop;
                var style = window.getComputedStyle(element[0]),
                marginLeftValue = style.getPropertyValue('margin-left').toString();

                if(isDownwordScroll){
                  moveCloudsToLeft(marginLeftValue);
                }
                else{
                  moveCloudsToRight(marginLeftValue);
                }
                lastScrollTop = currentScrollPosition;
            };

                angular.element($window).bind("scroll", setPosition);
        }  // link function
      };
});
;
{'fraction_non_alphanumeric': 0.13762274659240803, 'fraction_numerical': 0.004836582148614979, 'mean_word_length': 2.123112128146453, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6540464', 'n_tokens_mistral': 1890, 'n_tokens_neox': 1850, 'n_words': 357}