<commit_before>/*
 * scrollSync
 * https://github.com/rogeruiz/jQuery.scrollSync
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

(function($) {

  // Collection method.
  $.fn.awesome = function() {
    var self = this;
    $(window).on('scroll', function(evt) {
      $(self).find('.mask__img').css({
        'top': '-' + scrollRatio() + 'px'
      });

    });

    var scrollPosition = function () {
      var scroll = window.scrollY;

      if (scroll < 0) {
        scroll = 0;
      } else if (scroll > ($('body').outerHeight(true) - $(window).height())) {
        scroll = ($('body').outerHeight(true) - $(window).height());
      }

      return scroll;
    };

    var scrollRatio = function () {
      var outerHeight = $(window).height();
      var innerHeight = $(self).find('.iphone__mask').outerHeight(true);
      var outerScroll = scrollPosition();

      var ratio = Math.round((outerScroll * innerHeight) / outerHeight);

      if (ratio > $(self).find('.mask__img').outerHeight(true)) {
        ratio = $(self).find('.mask__img').outerHeight() - $(self).find('.iphone__mask').height();
      }

      return ratio;

    };

    
    return this.each(function(i) {
      var $el = $(this);

      // $el.find('.mask__img').css({
      //   'top': scrollPosition()
      // });

    });
  };

}(jQuery));


$(function () {
  $('.js-sync-scroll').awesome();
});<commit_msg>Fix issue with scrolling past end and add speed ratio<commit_after>/*
 * scrollSync
 * https://github.com/rogeruiz/jQuery.scrollSync
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

(function($) {

  // Collection method.
  $.fn.scrollSync = function() {
    var self = this;
    $(window).on('scroll', function(evt) {
      $(self).find('.mask__img').css({
        'top': '-' + scrollRatio() + 'px'
      });

    });

    var scrollPosition = function () {
      var scroll = window.scrollY;

      if (scroll < 0) {
        scroll = 0;
      } else if (scroll > ($('body').outerHeight(true) - $(window).height())) {
        scroll = ($('body').outerHeight(true) - $(window).height());
      }

      return scroll;
    };

    var scrollRatio = function () {
      var imgHeight = $(self).find('.mask__img').outerHeight();
      var outerHeight = $(window).outerHeight(true);
      var innerHeight = $(self).find('.ss-container__mask').outerHeight(true);
      var outerScroll = scrollPosition();
      var scrollLimit = imgHeight - $(self).find('.ss-container__mask').outerHeight();
      var speed = 1.5;
      var ratio = Math.round((outerScroll * innerHeight) / outerHeight) * speed;

      if (ratio > scrollLimit) {
        ratio = scrollLimit;
      }

      return ratio;

    };

    
    return this.each(function(i) {
      var $el = $(this);

      // $el.find('.mask__img').css({
      //   'top': scrollPosition()
      // });

    });
  };

}(jQuery));


$(function () {
  $('.js-sync-scroll').scrollSync();
});
{'fraction_non_alphanumeric': 0.19561551433389546, 'fraction_numerical': 0.004721753794266442, 'mean_word_length': 2.4448315911730547, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '7012486', 'n_tokens_mistral': 939, 'n_tokens_neox': 899, 'n_words': 185}