<commit_before>// Created By <NAME> | MIT License | 2015


// Wrap the entire library in a self executing anonymous function so as to no conflict
(function(window){

  //--------------------- Public API Section ---------------------//
  // This is the start of the Pressure Object, this is the only object that is accessible to the end user
  // Only the methods in this object can be called, making it the "public api"
  var Pressure = {


    // This method is to determine if the browser and/or user have support for force touch of 3D touch
    // When this method is run, it will immediatly return if the browser does not support the force/3D touch,
    // however it will not return if the user has an supported trackpad or device until a click happens somewhere on the page
    supported: function(closure){
      Browser.checkSupport(closure);
    },

    // This method will return a force value from the user and will automatically determine if the user has force or 3D touch
    // It also accepts an optional type, this type is passed in by the next 2 methods to be explicit about which change event type they want
    change: function(selector, closure, type){
      Event.build(selector, closure, function(){

        // if type is set explicitly to 'force' and the user has 'force' support
        if(Support.type === 'force' && type === 'force'){
          Event.changeForceTouch(selector, closure);
        }
        // if type is set explicitly to '3d' and the user has '3d' support
        else if(Support.type === '3d' && type === '3d'){
          Event.change3DTouch(selector, closure);
        }
        // if the user has 'force' touch support
        else if(Support.type === 'force'){
          Event.changeForceTouch(selector, closure);
        }
        // if the user has '3d' touch support
        else if(Support.type === '3d'){
          Event.change3DTouch(selector, closure);
        }
      }.bind(this))
    },

    // This method is meant to be called when targeting ONLY devices with force touch
    changeForceTouch: function(selector, closure){
      this.change(selector, closure, 'force');
    },

    // This method is meant to be called when targeting ONLY devices with 3D touch
    change3DTouch: function(selector, closure){
      this.change(selector, closure, '3d');
    }
  }

  var Event = {

    // this method builds events and handles event support on ever public method called by user
    build: function(selector, userClosure, closure){
      if(Support.forPressure){
        closure();
      } else if(Support.hasRun){
        getFailClosure(userClosure)();
      } else {
        Browser.checkSupport({
          success: function(){
            closure();
          },
          fail: getFailClosure(userClosure)
        });
      }
    },

    // this handles the executing of the Force Touch change event
    changeForceTouch: function(selector, closure){
      // loop over each item that is returned
      forEach(queryElement(selector), function(index, element){
        element.addEventListener('webkitmouseforcechanged', function(event){
          getSuccessClosure(closure).call(element, event.webkitForce, event);
        }, false);
      });<commit_msg>only 3D or Force touch methods now work<commit_after>// Created By <NAME> | MIT License | 2015


// Wrap the entire library in a self executing anonymous function so as to no conflict
(function(window){

  //--------------------- Public API Section ---------------------//
  // This is the start of the Pressure Object, this is the only object that is accessible to the end user
  // Only the methods in this object can be called, making it the "public api"
  var Pressure = {


    // This method is to determine if the browser and/or user have support for force touch of 3D touch
    // When this method is run, it will immediatly return if the browser does not support the force/3D touch,
    // however it will not return if the user has an supported trackpad or device until a click happens somewhere on the page
    supported: function(closure){
      Browser.checkSupport(closure);
    },

    // This method will return a force value from the user and will automatically determine if the user has Force or 3D Touch
    // It also accepts an optional type, this type is passed in by the following 2 methods to be explicit about which change event type they want
    change: function(selector, closure, type){
      Event.build(selector, closure, function(){
        // Call ONLY the Force Touch method and only if the user supports it
        if(Support.type === 'force' && type === 'force'){
          Event.changeForceTouch(selector, closure);
        }
        // Call ONLY the 3D Touch method and only if the user supports it
        else if(Support.type === '3d' && type === '3d'){
          Event.change3DTouch(selector, closure);
        }
        // Call Force Touch if the user supports it
        else if(Support.type === 'force' && type !== '3d'){
          Event.changeForceTouch(selector, closure);
        }
        // Call 3D Touch if the user supports it
        else if(Support.type === '3d' && type !== force){
          Event.change3DTouch(selector, closure);
        }
      }.bind(this))
    },

    // targets ONLY devices with Force Touch
    changeForceTouch: function(selector, closure){
      this.change(selector, closure, 'force');
    },

    // targets ONLY devices with 3D touch
    change3DTouch: function(selector, closure){
      this.change(selector, closure, '3d');
    }
  }

  var Event = {

    // this method builds events and handles event support on ever public method called by user
    build: function(selector, userClosure, closure){

      // if the user has pressure support
      if(Support.forPressure){
        closure();
      }
      // if the user doesn't have pressure support, run failure closure if it exists
      else if(Support.hasRun){
        getFailClosure(userClosure)();
      } else {
        Browser.checkSupport({
          success: function(){
            closure();
          },
          fail: getFailClosure(userClosure)
        });
      }
    },

    // this handles the executing of the Force Touch change event
    changeForceTouch: function(selector, closure){
      // loop over each item that is returned
      forEach(queryElement(selector), function(index, element){
        element.addEventListener('webkitmouseforcechanged', function(event){
          getSuccessClosure(closure).call(element, event.webkitForce, event);
        }, false);
      });
{'fraction_non_alphanumeric': 0.10311165344722392, 'fraction_numerical': 0.005948749237339841, 'mean_word_length': 2.51959205582394, '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': '2164367', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1615, 'n_words': 704}