<commit_before>/**
 * The event module. Provides methods to add, remove, delegate and fire events and othe convenicence
 * methods
 * @author <EMAIL>
 */
(function($) {
   var slice = $.slice,
      forEach = $.forEach,
      filter = $.filter,
      readyCalls = [],
      isTypeOf = $.isTypeOf,
      
      extend = $.extend,
      noop = function() {}, customEvents = {}, 
      defaultDefn = {
         setup: noop,
         destroy: noop,
         defaultAction: noop
      },
      
      isReady = false,
      eventStore,
      create = document.createEvent;
   
   /**
    * Wrapper for addEventListener and attachEvent
    */
   function addListener(elem, type, handler, capture) {
      if(elem.addEventListener) {
         elem.addEventListener(type, handler, capture || false);
      }else if(elem.attachEvent) {
         elem.attachEvent("on" + type, handler);
      }
   }

   /**
    * Wrapper for removeEventListener and detachEvent
    */
   function removeListener(elem, type, handler, capture) {
      if(elem.removeEventListener) {
         elem.removeEventListener(type, handler, capture || false);
      }else if(elem.detachEvent) {
         elem.detachEvent("on" + type, handler);
      }
   }
   
   /**
    * Fix the event to normalize accross browsers, espeically IE
    * http://www.quirksmode.org/js/events_properties.html was a great source of info
    */
   function fixEvent(evt, elem) {
      var e = evt || window.event, t = e.target, doc, body;
      e.preventDefault || (e.preventDefault = function() {e.returnValue = false;});
      e.stopPropagation || (e.stopPropagation = function() {e.cancelBubble = true;});
      
      if(!t) {
         t = e.target = e.srcElement || elem;
         e.currentTarget = elem; //ofcourse :D
      }
      
      // bug in safari?
      if(t.nodeType === 3 ) {
         e.target = e.target.parentNode;
      }
      
      if(!e.relatedTarget && e.fromElement) {
         e.relatedTarget = e.fromElement === e.target ? e.toElement : e.fromElement;
      }
      
      // fix buttons
      if(!e.buttons) {
         e.buttons = e.button;
      }
      
      // positioning
      if(!e.pageX || !e.pageY) {
         if(e.clientX || e.clientY) {
            doc = e.target.ownerDocument || document;
            body = doc.body;
            e.pageX = e.clientX + body.scrollLeft;
            e.pageY = e.clientY + body.scrollTop;
         }
      }
   }
   
   /**
    * Creates and initializes an event.
    * @param {String} type The type of the event e.g. mouseout, click, etc.
    * @param {Object} props The properties for the event. This can be an object that sets other properties
    * for this event or any string or any other object. If the props is an object, its properties are<commit_msg>Minor fixes<commit_after>/**
 * The event module. Provides methods to add, remove, delegate and fire events and othe convenicence
 * methods
 * @author <EMAIL>
 */
(function($) {
   var slice = $.slice,
      forEach = $.forEach,
      filter = $.filter,
      readyCalls = [],
      isTypeOf = $.isTypeOf,
      
      extend = $.extend,
      noop = function() {}, customEvents = {}, 
      defaultDefn = {
         setup: noop,
         destroy: noop,
         defaultAction: noop
      },
      
      isReady = false,
      eventStore,
      create = document.createEvent;
   
   /**
    * Wrapper for addEventListener and attachEvent
    */
   function addListener(elem, type, handler, capture) {
      if(elem.addEventListener) {
         elem.addEventListener(type, handler, capture || false);
      }else if(elem.attachEvent) {
         elem.attachEvent("on" + type, handler);
      }
   }

   /**
    * Wrapper for removeEventListener and detachEvent
    */
   function removeListener(elem, type, handler, capture) {
      if(elem.removeEventListener) {
         elem.removeEventListener(type, handler, capture || false);
      }else if(elem.detachEvent) {
         elem.detachEvent("on" + type, handler);
      }
   }
   
   /**
    * Fix the event to normalize accross browsers, espeically IE
    * http://www.quirksmode.org/js/events_properties.html was a great source of info
    */
   function fixEvent(evt, elem) {
      var e = evt || window.event, t = e.target, doc, body;
      e.preventDefault || (e.preventDefault = function() {this.returnValue = false;});
      e.stopPropagation || (e.stopPropagation = function() {this.cancelBubble = true;});
      
      if(!t) {
         t = e.target = e.srcElement || elem;
         e.currentTarget = elem; //ofcourse :D
      }
      
      // bug in safari? for text nodes
      if(t.nodeType === 3 ) {
         e.target = e.target.parentNode;
      }
      
      if(!e.relatedTarget && e.fromElement) {
         e.relatedTarget = e.fromElement === e.target ? e.toElement : e.fromElement;
      }
      
      // fix buttons
      if(!e.buttons) {
         e.buttons = e.button;
      }
      
      // positioning
      if(!e.pageX || !e.pageY) {
         if(e.clientX || e.clientY) {
            doc = e.target.ownerDocument || document;
            body = doc.body;
            e.pageX = e.clientX + body.scrollLeft;
            e.pageY = e.clientY + body.scrollTop;
         }
      }
   }
   
   /**
    * Creates and initializes an event.
    * @param {String} type The type of the event e.g. mouseout, click, etc.
    * @param {Object} props The properties for the event. This can be an object that sets other properties
    * for this event or any string or any other object. If the props is an object, its properties are
{'fraction_non_alphanumeric': 0.12214837434884139, 'fraction_numerical': 0.00035925992455541585, 'mean_word_length': 2.027732463295269, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '714718', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1659, 'n_words': 445}