<commit_before>(function(scope) {

  var addEventListener = window.Element.prototype.addEventListener;
  
  var events = {
    touchstart: 'mousedown',
    touchend:   'mouseup',
    touchmove:  'mousemove',
    tap:        'click'
  };

  var Tap = function(element) {
    
    var originY,
        currY,
        diffY,
        threshold=40;
    
    var onTouchEnd = function (e) {
      var newEvent  = window.document.createEvent('TouchEvent');
      /* TODO: some of the event properties transposed below
            are actually stored on the touch objects. 
            For touchend, they'll be on changedTouches
            --
            var touch = e.changedTouches[0];
      */
      newEvent.initTouchEvent(
        "tap",
        e.bubbles,
        e.cancelable,
        e.view,
        e.detail,
        e.screenX,
        e.screenY,
        e.clientX,
        e.clientY,
        e.ctrlKey,
        e.altKey,
        e.shiftKey,
        e.metaKey,
        e.touches,
        e.targetTouches,
        e.changedTouches,
        e.scale,
        e.rotation
      );
      
      element.dispatchEvent(newEvent);
    }
    
    var onTouchMove = function (e) {
      currY=e.targetTouches[0].screenY;
      diffY=Math.abs(originY-currY);
      if (diffY > threshold) {
        console.log('cancelled')
        element.removeEventListener('touchend',onTouchEnd);
        element.removeEventListener('touchmove',onTouchMove);
      }
    }

    var onTouchStart = function(e) {
      originY=e.targetTouches[0].screenY;
      element.addEventListener('touchend',onTouchEnd); 
      element.addEventListener('touchmove',onTouchMove); 
    };
    
    element.addEventListener('touchstart',onTouchStart);
    
    return {
      <commit_msg>switched from using TouchEvent to MouseEvent - problems with the TouchEvent implementation on Android<commit_after>(function(scope) {

  var addEventListener = window.Element.prototype.addEventListener;
  
  var events = {
    touchstart: 'mousedown',
    touchend:   'mouseup',
    touchmove:  'mousemove',
    tap:        'click'
  };

  var Tap = function(element) {

    var originY,
        currY,
        diffY,
        threshold=40;
    
    var onTouchEnd = function (e) {

      var newEvent  = window.document.createEvent('MouseEvent');
      /* TODO: some of the event properties transposed below
            are actually stored on the touch objects. 
            For touchend, they'll be on changedTouches
            --
            var touch = e.changedTouches[0];
      */
      
      newEvent.initMouseEvent(
        "tap",
        e.bubbles,
        e.cancelable,
        e.view,
        e.detail,
        e.screenX,
        e.screenY,
        e.clientX,
        e.clientY,
        e.ctrlKey,
        e.altKey,
        e.shiftKey,
        e.button,
        e.relatedTarget
      );
      
      element.dispatchEvent(newEvent);
      
    }
    
    var onTouchMove = function (e) {
      currY=e.targetTouches[0].screenY;
      diffY=Math.abs(originY-currY);
      if (diffY > threshold) {
        alert('cancelled');
        element.removeEventListener('touchend',onTouchEnd);
        element.removeEventListener('touchmove',onTouchMove);
      }
    }

    var onTouchStart = function(e) {
      originY=e.targetTouches[0].screenY;
      element.addEventListener('touchend',onTouchEnd); 
      element.addEventListener('touchmove',onTouchMove); 
    };
    
    element.addEventListener('touchstart',onTouchStart);
    
    return {
      
{'fraction_non_alphanumeric': 0.10464784716281722, 'fraction_numerical': 0.00285143997718848, 'mean_word_length': 1.9754028837998303, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1592569', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1061, 'n_words': 194}