<commit_before>/**
 * presents the mouse events class
 *
 * NOTE: this class generally is for an internal usage, it builds a new clean
 *       unextended mouse event.
 *       Use the Event general constructor, if you need a usual extened event.
 *
 * Copyright (C) 2008-2009 <NAME> aka St. <nemshilov#gma-ilc-om>
 */
Event.Mouse = new Class(Event.Base, {
  
  extend: {
    NAMES: $w('click middleclick rightclick dblclick mousedown mouseup mouseover mouseout mousemove'),
    
    Methods: {
      isLeftClick: function() {
        return this.which == 1;
      },

      isRightClick : function() {
        return this.which == 3;
      },
      
      position: function() {
        return {x: this.pageX, y: this.pageY};
      }
    },
    
    /**
     * proceses the event extending as if it's a mouse event
     *
     * @param Event new event
     * @return Event extended event
     */
    ext: function(event) {
      $ext(event, this.Methods, true);
      
      if (Browser.IE) {
        // faking the which button so we could work with it in a crossbrowser way
        event.which = event.button == Event.BUTTONS.RIGHT ? 3 : event.button == Event.BUTTONS.MIDDLE ? 2 : 1;
        
        // fake the mouse position
        var scrolls = window.scrolls();
        
        event.pageX = event.clientX + scrolls.x;
        event.pageY = event.clientY + scrolls.y;
        
        
        // faking the relatedElement
        event.relatedElement = event.type == 'mouseover' ? event.fromEvent :
          event.type == 'mouseout' ? event.toEvent : null;
        
        // faking the target property  
        event['target'] = event.srcElement;
      } 
      
      // Safari bug fix
      if (event.target && event.target.nodeType == 3)
        event.target = event.target.parentNode;
      
      return event;
    }
  },<commit_msg>nothing<commit_after>/**
 * presents the mouse events class
 *
 * NOTE: this class generally is for an internal usage, it builds a new clean
 *       unextended mouse event.
 *       Use the Event general constructor, if you need a usual extened event.
 *
 * Copyright (C) 2008-2009 <NAME> aka St. <nemshilov#gma-ilc-om>
 */
Event.Mouse = new Class(Event.Base, {
  
  extend: {
    NAMES: $w('click middleclick rightclick dblclick mousedown mouseup mouseover mouseout mousemove'),
    
    Methods: {
      isLeftClick: function() {
        return this.which == 1;
      },

      isRightClick : function() {
        return this.which == 3;
      },
      
      position: function() {
        return {x: this.pageX, y: this.pageY};
      }
    },
    
    /**
     * proceses the event extending as if it's a mouse event
     *
     * @param Event new event
     * @return Event extended event
     */
    ext: function(event) {
      $ext(event, this.Methods, true);
      
      if (Browser.IE) {
        // faking the which button so we could work with it in a crossbrowser way
        event.which = event.button == Event.BUTTONS.RIGHT ? 3 : event.button == Event.BUTTONS.MIDDLE ? 2 : 1;
        
        // fake the mouse position
        var scrolls = window.scrolls();
        
        event.pageX = event.clientX + scrolls.x;
        event.pageY = event.clientY + scrolls.y;
        
        
        // faking the relatedElement
        event.relatedElement = event.type == 'mouseover' ? event.fromEvent :
          event.type == 'mouseout' ? event.toEvent : null;
        
        // faking the target property  
        event.target = event.srcElement;
      } 
      
      // Safari bug fix
      if (event.target && event.target.nodeType == 3)
        event.target = event.target.parentNode;
      
      return event;
    }
  },
{'fraction_non_alphanumeric': 0.10690121786197564, 'fraction_numerical': 0.007577807848443843, 'mean_word_length': 1.914826498422713, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3363783', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1083, 'n_words': 324}