<commit_before>/*!
 * Autoplay for Lectric
 * Copyright 2013 <NAME>
 * Licensed under the MIT license.
 */
(function( factory ) {
  //AMD
  if(typeof define === 'function' && define.amd) {
    define([], factory);

  //NODE
  } else if(typeof module === 'object' && module.exports) {
    module.exports = factory();

  //GLOBAL
  } else {
    window.lectircAutoplay = factory();
  }
})(function() {

  var exports = {};

  exports.extend = function( slider, defaultDuration, byPageNotSlide ) {
    
    var timer;

    var nextFn = 'next';
    if (byPageNotSlide) {
      nextFn = 'nextPage';
    }

    function advance() {
      slider[nextFn]();
      var duration = slider.getSlideData('duration') || defaultDuration;
      timer = setTimeout( advance, duration )
    }

    slider.start = function( startRightNow ) {
      if (timer) { return }
      if (startRightNow) {
        advance();
      } else {
        setTimeout( advance, slider.getSlideData('duration') || defaultDuration );
      }
    };

    slider.stop = function() {
      clearTimeout( timer );
      timer = null;
    };
  };

  return exports;
});
<commit_msg>clear timeout when landing on a new frame<commit_after>/*!
 * Autoplay for Lectric
 * Copyright 2013 <NAME>
 * Licensed under the MIT license.
 */
(function( factory ) {
  //AMD
  if(typeof define === 'function' && define.amd) {
    define([], factory);

  //NODE
  } else if(typeof module === 'object' && module.exports) {
    module.exports = factory();

  //GLOBAL
  } else {
    window.lectricAutoplay = factory();
  }
})(function() {

  var exports = {};

  exports.extend = function( slider, defaultDuration, byPageNotSlide ) {
    
    var timer;

    var nextFn = 'next';
    if (byPageNotSlide) {
      nextFn = 'nextPage';
    }

    slider.on('animationEnd.lectric', function() {
      if (timer) {
        clearTimeout(timer);
        var duration = slider.getSlideData('duration') || defaultDuration;
        timer = setTimeout( advance, duration );
      }
    });

    function advance() {
      slider[nextFn]();
    }

    slider.start = function( startRightNow ) {
      if (timer) { return }
      if (startRightNow) {
        advance();
      } else {
        timer = setTimeout( advance, slider.getSlideData('duration') || defaultDuration );
      }
    };

    slider.stop = function() {
      clearTimeout( timer );
      timer = null;
    };
  };

  return exports;
});

{'fraction_non_alphanumeric': 0.14603044014808722, 'fraction_numerical': 0.003290826820238585, 'mean_word_length': 2.4842406876790832, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5794044', 'n_tokens_mistral': 768, 'n_tokens_neox': 726, 'n_words': 179}