<commit_before>/*! imageFlipper - a jquery plugin
 * really preliminary
 * Copyright (c) 2014 <NAME>; Licensed MIT */

(function($, undefined) {


  $.fn.imageFlipper = function(images, opts) {
    var obj = new imageFlipper(this, images, opts);
    $(this).data('imageFlipperObj', obj);
  };

  // If no element is supplied, we'll attach to body
  $.imageFlipper = function(images, opts) {
    $('body').imageFlipper(images, opts);
  }

  // Class definition
  var imageFlipper = function(container, images, opts) {

    this.images = [];
    this.container = container;
    this.visible = null;

    if (arguments.length < 3 || opts === undefined) {
      opts = {};
    }

    // default parameters
    if (!'path' in opts) {
      opts.path = '';
    }

    for (var k = 0; k < images.length; k++) {
      var img = document.createElement('img');
      $(img).attr('src', opts.path + images[k])
              .css({visibility: 'hidden',
                position: 'absolute'
              });
      if ('imageCss' in opts) {
        opts.imageCss(img, k);
      }
      //console.log(img);
      $(img).appendTo(this.container);
      this.images.push(img);
    }
    // save data
    $(this.container).data('imageFlipper', this.images);
    setMouseMoves(this, images, opts);
  }

  function setMouseMoves(that, images, opts) {
    var w = parseInt($(that.container).width());    
    $(that.container).mousemove(function(e) {
      var x = e.pageX - this.offsetLeft;
      var y = e.pageY - this.offsetTop;
      var num = Math.ceil(x / w * (images.length)) - 1;
      if (num < 0) {
        num = 0;
      }
      if (num >= images.length) {<commit_msg>Added to image change binder also touch gestures<commit_after>/*! imageFlipper - a jquery plugin
 * really preliminary
 * Copyright (c) 2014 <NAME>; Licensed MIT */

(function($, undefined) {


  $.fn.imageFlipper = function(images, opts) {
    var obj = new imageFlipper(this, images, opts);
    $(this).data('imageFlipperObj', obj);
  };

  // If no element is supplied, we'll attach to body
  $.imageFlipper = function(images, opts) {
    $('body').imageFlipper(images, opts);
  }

  // Class definition
  var imageFlipper = function(container, images, opts) {

    this.images = [];
    this.container = container;
    this.visible = null;

    if (arguments.length < 3 || opts === undefined) {
      opts = {};
    }

    // default parameters
    if (!'path' in opts) {
      opts.path = '';
    }

    for (var k = 0; k < images.length; k++) {
      var img = document.createElement('img');
      $(img).attr('src', opts.path + images[k])
              .css({visibility: 'hidden',
                position: 'absolute'
              });
      if ('imageCss' in opts) {
        opts.imageCss(img, k);
      }
      //console.log(img);
      $(img).appendTo(this.container);
      this.images.push(img);
    }
    // save data
    $(this.container).data('imageFlipper', this.images);
    setMouseMoves(this, images, opts);
  }

  function setMouseMoves(that, images, opts) {
    var w = parseInt($(that.container).width());    
  $(that.container).bind('touchmove mousemove touch',function(e) {
      var x = e.pageX - this.offsetLeft;
      var y = e.pageY - this.offsetTop;
      if (isNaN(x) || (x === 0 && y === 0)){
        x = e.originalEvent.touches[0].pageX;
        y = e.originalEvent.touches[0].pageY;
      }
      var num = Math.ceil(x / w * (images.length)) - 1;
      if (num < 0) {
        num = 0;
      }
      if (num >= images.length) {
{'fraction_non_alphanumeric': 0.16396703608979823, 'fraction_numerical': 0.00625177607274794, 'mean_word_length': 2.355576739752145, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '4588510', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1126, 'n_words': 275}