<commit_before>OpenLayers.Events = Class.create();

OpenLayers.Events.prototype = {
    // hash of Array(Function)
    listeners: null,

    // OpenLayers.Map
    map: null,

    // DOMElement
    div: null,

    // supported events
    BROWSER_EVENTS: [
        "mouseover", "mouseout",
        "mousedown", "mouseup", "mousemove", 
        "click", "dblclick"
    ],
    MAP_EVENTS: [ 
        "mouseover", "mouseout", 
        "mousedown", "mouseup", "mousemove",
        "click", "dblclick"
    ],

    initialize: function (map, div) {
        this.listeners = {};
        this.map      = map;
        this.div      = div;
        for (var i = 0; i < this.MAP_EVENTS.length; i++) {
            this.listeners[ this.MAP_EVENTS[i] ] = [];
        }
        for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
            var eventName = this.BROWSER_EVENTS[i];
            Event.observe(div, eventName, 
                this.handleBrowserEvent.bindAsEventListener(this));
        }
    },

    register: function (eventName, obj, func) {
        var listeners = this.listeners[eventName];
        listeners.push( func.bindAsEventListener(obj) );
    },

    handleBrowserEvent: function (evt) {
        evt.xy = this.getMousePosition(evt); 
        this.triggerMapEvent(evt.type, evt)
    },

    getMousePosition: function (evt) {
        var offsets = Position.page(this.div); 
        return new OpenLayers.Pixel(
                        evt.clientX - offsets[0], 
                        evt.clientY - offsets[1]); 
    },

    triggerMapEvent: function (type, evt) {
        evt.map = this.map;

        var listeners = this.listeners[type];
        for (var i = 0; i < listeners.length; i++) {
            var callback = listeners[i];
            callback(evt);
        }
    }
};<commit_msg>JSAN commenting<commit_after>OpenLayers.Events = Class.create();

OpenLayers.Events.prototype = {
    // hash of Array(Function)
    listeners: null,

    // OpenLayers.Map
    map: null,

    // DOMElement
    div: null,

    // supported events
    BROWSER_EVENTS: [
        "mouseover", "mouseout",
        "mousedown", "mouseup", "mousemove", 
        "click", "dblclick"
    ],
    MAP_EVENTS: [ 
        "mouseover", "mouseout", 
        "mousedown", "mouseup", "mousemove",
        "click", "dblclick"
    ],

    /**
    * @param {OpenLayers.Map} map
    * @param {DOMElement} div
    */
    initialize: function (map, div) {
        this.listeners = {};
        this.map      = map;
        this.div      = div;
        for (var i = 0; i < this.MAP_EVENTS.length; i++) {
            this.listeners[ this.MAP_EVENTS[i] ] = [];
        }
        for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
            var eventName = this.BROWSER_EVENTS[i];
            Event.observe(div, eventName, 
                this.handleBrowserEvent.bindAsEventListener(this));
        }
    },

    /**
    * @param {str} eventName
    * @param {Object} obj
    * @param {Function} func
    */
    register: function (eventName, obj, func) {
        var listeners = this.listeners[eventName];
        listeners.push( func.bindAsEventListener(obj) );
    },

    /**
    * @param {event} evt
    */
    handleBrowserEvent: function (evt) {
        evt.xy = this.getMousePosition(evt); 
        this.triggerMapEvent(evt.type, evt)
    },

    /**
    * @param {event} evt
    */
    getMousePosition: function (evt) {
        var offsets = Position.page(this.div); 
        return new OpenLayers.Pixel(
                        evt.clientX - offsets[0], 
                        evt.clientY - offsets[1]); 
    },

    /**
    * @param {str} type
    * @param {event} evt
    */
    triggerMapEvent: function (type, evt) {
        evt.map = this.map;

        var listeners = this.listeners[type];
        for (var i = 0; i < listeners.length; i++) {
            var callback = listeners[i];
            callback(evt);
        }
    }
};
{'fraction_non_alphanumeric': 0.13886063072227875, 'fraction_numerical': 0.00254323499491353, 'mean_word_length': 1.8315334773218142, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '3185819', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1240, 'n_words': 254}