PageSourceSearch

https://www.eifelmosel.de/assets/js/panoplayer/eventShim.js

js eifelmosel.de collected 2026-10-08 22:47:35 UTC 6,162 bytes, 180 lines download raw bytes

1/* Copyright (c) 2012 Jeremy McPeak http://www.wdonline.com
2 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5*/
6
7(function() {
8
9    function init() {
10
11        // filter out unsupported browsers
12        if (Element.prototype.addEventListener || !Object.defineProperty) {
13            return {
14                loadedForBrowser : false
15            };
16        }
17
18        // create an MS event object and get prototype
19        var proto = document.createEventObject().constructor.prototype;
20
21        /**
22     * Indicates whether an event propagates up from the target.
23     * @returns Boolean
24     */
25        Object.defineProperty(proto, "bubbles", {
26            get: function() {
27                // not a complete list of DOM3 events; some of these IE8 doesn't support
28                var bubbleEvents = ["select", "scroll", "click", "dblclick",
29                    "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "wheel", "textinput",
30                    "keydown", "keypress", "keyup"],
31                    type = this.type;
32
33                for (var i = 0, l = bubbleEvents.length; i < l; i++) {
34                    if (type === bubbleEvents[i]) {
35                        return true;
36                    }
37                }
38
39                return false;
40            }
41        });
42
43
44        /**
45     * Indicates whether or not preventDefault() was called on the event.
46     * @returns Boolean
47     */
48        Object.defineProperty(proto, "defaultPrevented", {
49            get: function() {
50                // if preventDefault() was never called, or returnValue not given a value
51                // then returnValue is undefined
52                var returnValue = this.returnValue,
53                    undef;
54
55                return !(returnValue === undef || returnValue);
56            }
57        });
58
59
60        /**
61     * Gets the secondary targets of mouseover and mouseout events (toElement and fromElement)
62     * @returns EventTarget or {null}
63     */
64        Object.defineProperty(proto, "relatedTarget", {
65            get: function() {
66                var type = this.type;
67
68                if (type === "mouseover" || type === "mouseout") {
69                    return (type === "mouseover") ? this.fromElement : this.toElement;
70                }
71
72                return null;
73            }
74        });
75
76
77        /**
78     * Gets the target of the event (srcElement)
79     * @returns EventTarget
80     */
81        Object.defineProperty(proto, "target", {
82            get: function() { return this.srcElement; }
83        });
84
85
86        /**
87     * Cancels the event if it is cancelable. (returnValue)
88     * @returns {undefined}
89     */
90        proto.preventDefault = function() {
91            this.returnValue = false;
92        };
93
94        /**
95     * Prevents further propagation of the current event. (cancelBubble())
96     * @returns {undefined}
97     */
98        proto.stopPropagation = function() {
99            this.cancelBubble = true;
100        };
101
102        /***************************************
103     *
104     * Event Listener Setup
105     *    Nothing complex here
106     *
107     ***************************************/
108
109        /**
110     * Determines if the provided object implements EventListener
111     * @returns boolean
112    */
113        var implementsEventListener = function(obj) {
114            return (typeof obj !== "function" && typeof obj["handleEvent"] === "function");
115        };
116
117        var customELKey = "__eventShim__";
118
119        /**
120     * Adds an event listener to the DOM object
121     * @returns {undefined}
122     */
123        var addEventListenerFunc = function(type, handler, useCapture) {
124            // useCapture isn't used; it's IE!
125
126            var fn = handler;
127
128            if (implementsEventListener(handler)) {
129
130                if (typeof handler[customELKey] !== "function") {
131                    handler[customELKey] = function(e) {
132                        handler["handleEvent"](e);
133                    };
134                }
135
136                fn = handler[customELKey];
137            }
138
139            this.attachEvent("on" + type, fn);
140        };
141
142        /**
143     * Removes an event listener to the DOM object
144     * @returns {undefined}
145     */
146        var removeEventListenerFunc = function(type, handler, useCapture) {
147            // useCapture isn't used; it's IE!
148
149            var fn = handler;
150
151            if (implementsEventListener(handler)) {
152                fn = handler[customELKey];
153            }
154
155            this.detachEvent("on" + type, fn);
156        };
157
158        // setup the DOM and window objects
159        HTMLDocument.prototype.addEventListener = addEventListenerFunc;
160        HTMLDocument.prototype.removeEventListener = removeEventListenerFunc;
161
162        Element.prototype.addEventListener = addEventListenerFunc;
163        Element.prototype.removeEventListener = removeEventListenerFunc;
164
165        window.addEventListener = addEventListenerFunc;
166        window.removeEventListener = removeEventListenerFunc;
167
168        return {
169            loadedForBrowser : true
170        };
171    }
172
173    // check for AMD support
174    if (typeof define === "function" && define["amd"]) {
175        define(init);
176    } else {
177        return init();
178    }
179    
180}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.