Changeset 1587
- Timestamp:
- 10/05/06 10:46:45 (2 years ago)
- Files:
-
- sandbox/crschmidt/noprototype/build/license.txt (modified) (1 diff)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Ajax.js (modified) (5 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Control/KeyboardDefaults.js (modified) (2 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Control/LayerSwitcher.js (modified) (10 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Control/MouseDefaults.js (modified) (8 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Control/MouseToolbar.js (modified) (7 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Control/PanZoom.js (modified) (3 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Control/PanZoomBar.js (modified) (6 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Events.js (modified) (5 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Layer/GeoRSS.js (modified) (2 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Layer/Text.js (modified) (1 diff)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Map.js (modified) (2 diffs)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Prototype.js (deleted)
- sandbox/crschmidt/noprototype/lib/OpenLayers/Util.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/crschmidt/noprototype/build/license.txt
r1424 r1587 14 14 */ 15 15 16 /* Prototype JavaScript framework, version 1.4.0 16 /* Contains portions of Prototype.js: 17 * 18 * Prototype JavaScript framework, version 1.4.0 17 19 * (c) 2005 Sam Stephenson <sam@conio.net> 18 20 * sandbox/crschmidt/noprototype/lib/OpenLayers/Ajax.js
r1586 r1587 109 109 110 110 OpenLayers.Ajax = { 111 emptyFunction: function () {}, 112 111 113 getTransport: function() { 112 114 return OpenLayers.Util.Try( … … 217 219 var requestHeaders = 218 220 ['X-Requested-With', 'XMLHttpRequest', 219 'X-Prototype-Version', Prototype.Version];221 'X-Prototype-Version', 'OpenLayers']; 220 222 221 223 if (this.options.method == 'post') { … … 272 274 (this.options['on' + this.transport.status] 273 275 || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')] 274 || Prototype.emptyFunction)(transport, json);276 || OpenLayers.Ajax.emptyFunction)(transport, json); 275 277 } catch (e) { 276 278 this.dispatchException(e); … … 282 284 283 285 try { 284 (this.options['on' + event] || Prototype.emptyFunction)(transport, json);286 (this.options['on' + event] || OpenLayers.Ajax.emptyFunction)(transport, json); 285 287 OpenLayers.Ajax.Responders.dispatch('on' + event, this, transport, json); 286 288 } catch (e) { … … 290 292 /* Avoid memory leak in MSIE: clean up the oncomplete event handler */ 291 293 if (event == 'Complete') 292 this.transport.onreadystatechange = Prototype.emptyFunction;294 this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction; 293 295 }, 294 296 295 297 dispatchException: function(exception) { 296 (this.options.onException || Prototype.emptyFunction)(this, exception);298 (this.options.onException || OpenLayers.Ajax.emptyFunction)(this, exception); 297 299 OpenLayers.Ajax.Responders.dispatch('onException', this, exception); 298 300 } sandbox/crschmidt/noprototype/lib/OpenLayers/Control/KeyboardDefaults.js
r1586 r1587 26 26 */ 27 27 draw: function() { 28 Event.observe(document,28 OpenLayers.Event.observe(document, 29 29 'keypress', 30 30 this.defaultKeyDown.bind(this)); … … 36 36 defaultKeyDown: function (evt) { 37 37 switch(evt.keyCode) { 38 case Event.KEY_LEFT:38 case OpenLayers.Event.KEY_LEFT: 39 39 this.map.pan(-50, 0); 40 40 break; 41 case Event.KEY_RIGHT:41 case OpenLayers.Event.KEY_RIGHT: 42 42 this.map.pan(50, 0); 43 43 break; 44 case Event.KEY_UP:44 case OpenLayers.Event.KEY_UP: 45 45 this.map.pan(0, -50); 46 46 break; 47 case Event.KEY_DOWN:47 case OpenLayers.Event.KEY_DOWN: 48 48 this.map.pan(0, 50); 49 49 break; sandbox/crschmidt/noprototype/lib/OpenLayers/Control/LayerSwitcher.js
r1586 r1587 130 130 inputElem.layer = layer; 131 131 inputElem.control = this; 132 Event.observe(inputElem, "mouseup",132 OpenLayers.Event.observe(inputElem, "mouseup", 133 133 this.onInputClick.bindAsEventListener(inputElem)); 134 134 … … 137 137 labelSpan.innerHTML = layer.name; 138 138 labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "baseline"; 139 Event.observe(labelSpan, "click",139 OpenLayers.Event.observe(labelSpan, "click", 140 140 this.onInputClick.bindAsEventListener(inputElem)); 141 141 // create line break … … 178 178 this.control.updateMap(); 179 179 } 180 Event.stop(e);180 OpenLayers.Event.stop(e); 181 181 }, 182 182 … … 230 230 231 231 if (e != null) { 232 Event.stop(e);232 OpenLayers.Event.stop(e); 233 233 } 234 234 }, … … 247 247 248 248 if (e != null) { 249 Event.stop(e);249 OpenLayers.Event.stop(e); 250 250 } 251 251 }, … … 285 285 this.div.style.backgroundColor = "transparent"; 286 286 287 Event.observe(this.div, "mouseup",287 OpenLayers.Event.observe(this.div, "mouseup", 288 288 this.mouseUp.bindAsEventListener(this)); 289 Event.observe(this.div, "click",289 OpenLayers.Event.observe(this.div, "click", 290 290 this.ignoreEvent); 291 Event.observe(this.div, "mousedown",291 OpenLayers.Event.observe(this.div, "mousedown", 292 292 this.mouseDown.bindAsEventListener(this)); 293 Event.observe(this.div, "dblclick", this.ignoreEvent);293 OpenLayers.Event.observe(this.div, "dblclick", this.ignoreEvent); 294 294 295 295 … … 318 318 this.baseLayersDiv = document.createElement("div"); 319 319 this.baseLayersDiv.style.paddingLeft = "10px"; 320 /* Event.observe(this.baseLayersDiv, "click",320 /*OpenLayers.Event.observe(this.baseLayersDiv, "click", 321 321 this.onLayerClick.bindAsEventListener(this)); 322 322 */ … … 368 368 this.maximizeDiv.style.left = ""; 369 369 this.maximizeDiv.style.display = "none"; 370 Event.observe(this.maximizeDiv,370 OpenLayers.Event.observe(this.maximizeDiv, 371 371 "click", 372 372 this.maximizeControl.bindAsEventListener(this)); … … 387 387 this.minimizeDiv.style.left = ""; 388 388 this.minimizeDiv.style.display = "none"; 389 Event.observe(this.minimizeDiv,389 OpenLayers.Event.observe(this.minimizeDiv, 390 390 "click", 391 391 this.minimizeControl.bindAsEventListener(this)); … … 400 400 */ 401 401 ignoreEvent: function(evt) { 402 Event.stop(evt);402 OpenLayers.Event.stop(evt); 403 403 }, 404 404 sandbox/crschmidt/noprototype/lib/OpenLayers/Control/MouseDefaults.js
r1586 r1587 22 22 23 23 //register mousewheel events specifically on the window and document 24 Event.observe(window, "DOMMouseScroll",24 OpenLayers.Event.observe(window, "DOMMouseScroll", 25 25 this.onWheelEvent.bindAsEventListener(this)); 26 Event.observe(window, "mousewheel",26 OpenLayers.Event.observe(window, "mousewheel", 27 27 this.onWheelEvent.bindAsEventListener(this)); 28 Event.observe(document, "mousewheel",28 OpenLayers.Event.observe(document, "mousewheel", 29 29 this.onWheelEvent.bindAsEventListener(this)); 30 30 }, … … 48 48 */ 49 49 defaultClick: function (evt) { 50 if (! Event.isLeftClick(evt)) return;50 if (!OpenLayers.Event.isLeftClick(evt)) return; 51 51 var notAfterDrag = !this.performedDrag; 52 52 this.performedDrag = false; … … 60 60 var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); 61 61 this.map.setCenter(newCenter, this.map.zoom + 1); 62 Event.stop(evt);62 OpenLayers.Event.stop(evt); 63 63 return false; 64 64 }, … … 68 68 */ 69 69 defaultMouseDown: function (evt) { 70 if (! Event.isLeftClick(evt)) return;70 if (!OpenLayers.Event.isLeftClick(evt)) return; 71 71 this.mouseDragStart = evt.xy.clone(); 72 72 this.performedDrag = false; … … 87 87 } 88 88 document.onselectstart=function() { return false; } 89 Event.stop(evt);89 OpenLayers.Event.stop(evt); 90 90 }, 91 91 … … 125 125 */ 126 126 defaultMouseUp: function (evt) { 127 if (! Event.isLeftClick(evt)) return;127 if (!OpenLayers.Event.isLeftClick(evt)) return; 128 128 if (this.zoomBox) { 129 129 this.zoomBoxEnd(evt); … … 218 218 // first determine whether or not the wheeling was inside the map 219 219 var inMap = false; 220 var elem = Event.element(e);220 var elem = OpenLayers.Event.element(e); 221 221 while(elem != null) { 222 222 if (this.map && elem == this.map.div) { … … 250 250 251 251 //only wheel the map, not the window 252 Event.stop(e);252 OpenLayers.Event.stop(e); 253 253 } 254 254 }, sandbox/crschmidt/noprototype/lib/OpenLayers/Control/MouseToolbar.js
r1586 r1587 69 69 btn.events.register("mousedown", this, this.buttonDown); 70 70 btn.events.register("mouseup", this, this.buttonUp); 71 btn.events.register("dblclick", this, Event.stop);71 btn.events.register("dblclick", this, OpenLayers.Event.stop); 72 72 btn.action = id; 73 73 btn.title = title; … … 84 84 */ 85 85 buttonDown: function(evt) { 86 if (! Event.isLeftClick(evt)) return;86 if (!OpenLayers.Event.isLeftClick(evt)) return; 87 87 this.buttonClicked = evt.element.action; 88 Event.stop(evt);88 OpenLayers.Event.stop(evt); 89 89 }, 90 90 … … 93 93 */ 94 94 buttonUp: function(evt) { 95 if (! Event.isLeftClick(evt)) return;95 if (!OpenLayers.Event.isLeftClick(evt)) return; 96 96 if (this.buttonClicked != null) { 97 97 if (this.buttonClicked == evt.element.action) { 98 98 this.switchModeTo(evt.element.action); 99 99 } 100 Event.stop(evt);100 OpenLayers.Event.stop(evt); 101 101 this.buttonClicked = null; 102 102 } … … 111 111 var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); 112 112 this.map.setCenter(newCenter, this.map.zoom + 1); 113 Event.stop(evt);113 OpenLayers.Event.stop(evt); 114 114 return false; 115 115 }, … … 119 119 */ 120 120 defaultMouseDown: function (evt) { 121 if (! Event.isLeftClick(evt)) return;121 if (!OpenLayers.Event.isLeftClick(evt)) return; 122 122 this.mouseDragStart = evt.xy.clone(); 123 123 this.performedDrag = false; … … 195 195 } 196 196 document.onselectstart = function() { return false; } 197 Event.stop(evt);197 OpenLayers.Event.stop(evt); 198 198 }, 199 199 … … 270 270 */ 271 271 defaultMouseUp: function (evt) { 272 if (! Event.isLeftClick(evt)) return;272 if (!OpenLayers.Event.isLeftClick(evt)) return; 273 273 switch (this.mode) { 274 274 case "zoombox": sandbox/crschmidt/noprototype/lib/OpenLayers/Control/PanZoom.js
r1586 r1587 102 102 */ 103 103 doubleClick: function (evt) { 104 Event.stop(evt);104 OpenLayers.Event.stop(evt); 105 105 return false; 106 106 }, … … 110 110 */ 111 111 buttonDown: function (evt) { 112 if (! Event.isLeftClick(evt)) return;112 if (!OpenLayers.Event.isLeftClick(evt)) return; 113 113 114 114 switch (this.action) { … … 136 136 } 137 137 138 Event.stop(evt);138 OpenLayers.Event.stop(evt); 139 139 }, 140 140 sandbox/crschmidt/noprototype/lib/OpenLayers/Control/PanZoomBar.js
r1586 r1587 148 148 */ 149 149 divClick: function (evt) { 150 if (! Event.isLeftClick(evt)) return;150 if (!OpenLayers.Event.isLeftClick(evt)) return; 151 151 var y = evt.xy.y; 152 152 var top = OpenLayers.Util.pagePosition(evt.object)[1]; 153 153 var levels = Math.floor((y - top)/this.zoomStopHeight); 154 154 this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels); 155 Event.stop(evt);155 OpenLayers.Event.stop(evt); 156 156 }, 157 157 … … 161 161 */ 162 162 zoomBarDown:function(evt) { 163 if (! Event.isLeftClick(evt)) return;163 if (!OpenLayers.Event.isLeftClick(evt)) return; 164 164 this.map.events.register("mousemove", this, this.passEventToSlider); 165 165 this.map.events.register("mouseup", this, this.passEventToSlider); … … 167 167 this.zoomStart = evt.xy.clone(); 168 168 this.div.style.cursor = "move"; 169 Event.stop(evt);169 OpenLayers.Event.stop(evt); 170 170 }, 171 171 … … 186 186 } 187 187 this.mouseDragStart = evt.xy.clone(); 188 Event.stop(evt);188 OpenLayers.Event.stop(evt); 189 189 } 190 190 }, … … 196 196 */ 197 197 zoomBarUp:function(evt) { 198 if (! Event.isLeftClick(evt)) return;198 if (!OpenLayers.Event.isLeftClick(evt)) return; 199 199 if (this.zoomStart) { 200 200 this.div.style.cursor="default"; … … 205 205 this.moveZoomBar(); 206 206 this.mouseDragStart = null; 207 Event.stop(evt);207 OpenLayers.Event.stop(evt); 208 208 } 209 209 }, sandbox/crschmidt/noprototype/lib/OpenLayers/Events.js
r1574 r1587 2 2 * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full 3 3 * text of the license. */ 4 5 OpenLayers.Event = { 6 KEY_BACKSPACE: 8, 7 KEY_TAB: 9, 8 KEY_RETURN: 13, 9 KEY_ESC: 27, 10 KEY_LEFT: 37, 11 KEY_UP: 38, 12 KEY_RIGHT: 39, 13 KEY_DOWN: 40, 14 KEY_DELETE: 46, 15 16 element: function(event) { 17 return event.target || event.srcElement; 18 }, 19 20 isLeftClick: function(event) { 21 return (((event.which) && (event.which == 1)) || 22 ((event.button) && (event.button == 1))); 23 }, 24 25 pointerX: function(event) { 26 return event.pageX || (event.clientX + 27 (document.documentElement.scrollLeft || document.body.scrollLeft)); 28 }, 29 30 pointerY: function(event) { 31 return event.pageY || (event.clientY + 32 (document.documentElement.scrollTop || document.body.scrollTop)); 33 }, 34 35 stop: function(event) { 36 if (event.preventDefault) { 37 event.preventDefault(); 38 event.stopPropagation(); 39 } else { 40 event.returnValue = false; 41 event.cancelBubble = true; 42 } 43 }, 44 45 // find the first node with the given tagName, starting from the 46 // node the event was triggered on; traverses the DOM upwards 47 findElement: function(event, tagName) { 48 var element = OpenLayers.Event.element(event); 49 while (element.parentNode && (!element.tagName || 50 (element.tagName.toUpperCase() != tagName.toUpperCase()))) 51 element = element.parentNode; 52 return element; 53 }, 54 55 observers: false, 56 57 _observeAndCache: function(element, name, observer, useCapture) { 58 if (!this.observers) this.observers = []; 59 if (element.addEventListener) { 60 this.observers.push([element, name, observer, useCapture]); 61 element.addEventListener(name, observer, useCapture); 62 } else if (element.attachEvent) { 63 this.observers.push([element, name, observer, useCapture]); 64 element.attachEvent('on' + name, observer); 65 } 66 }, 67 68 unloadCache: function() { 69 if (!OpenLayers.Event.observers) return; 70 for (var i = 0; i < OpenLayers.Event.observers.length; i++) { 71 OpenLayers.Event.stopObserving.apply(this, OpenLayers.Event.observers[i]); 72 OpenLayers.Event.observers[i][0] = null; 73 } 74 OpenLayers.Event.observers = false; 75 }, 76 77 observe: function(elementParam, name, observer, useCapture) { 78 var element = $(elementParam); 79 useCapture = useCapture || false; 80 81 if (name == 'keypress' && 82 (navigator.appVersion.match(/Konqueror|Safari|KHTML/) 83 || element.attachEvent)) 84 name = 'keydown'; 85 86 this._observeAndCache(element, name, observer, useCapture); 87 }, 88 89 stopObserving: function(elementParam, name, observer, useCapture) { 90 var element = $(elementParam); 91 useCapture = useCapture || false; 92 93 if (name == 'keypress' && 94 (navigator.appVersion.match(/Konqueror|Safari|KHTML/) 95 || element.detachEvent)) 96 name = 'keydown'; 97 98 if (element.removeEventListener) { 99 element.removeEventListener(name, observer, useCapture); 100 } else if (element.detachEvent) { 101 element.detachEvent('on' + name, observer); 102 } 103 } 104 }; 105 /* prevent memory leaks in IE */ 106 OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false); 107 108 if (window.Event) { 109 OpenLayers.Util.extend(window.Event, OpenLayers.Event); 110 } else { 111 var Event = OpenLayers.Event; 112 } 113 114 4 115 5 116 /** … … 30 141 eventTypes: null, 31 142 32 33 143 /** 34 144 * @constructor … … 73 183 74 184 // use Prototype to register the event cross-browser 75 Event.observe(element, eventType,185 OpenLayers.Event.observe(element, eventType, 76 186 this.handleBrowserEvent.bindAsEventListener(this)); 77 187 } 78 188 // disable dragstart in IE so that mousedown/move/up works normally 79 Event.observe(element, "dragstart",Event.stop);189 OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop); 80 190 }, 81 191 … … 181 291 // don't fall through to other DOM elements 182 292 if (!this.fallThrough) { 183 Event.stop(evt);293 OpenLayers.Event.stop(evt); 184 294 } 185 295 } … … 212 322 } 213 323 return new OpenLayers.Pixel( 214 (evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) - this.element.offsets[0], 215 (evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) - this.element.offsets[1] 216 ); 324 (evt.clientX + (document.documentElement.scrollLeft 325 || document.body.scrollLeft)) - this.element.offsets[0], 326 (evt.clientY + (document.documentElement.scrollTop 327 || document.body.scrollTop)) - this.element.offsets[1] 328 ); 217 329 }, 218 330 sandbox/crschmidt/noprototype/lib/OpenLayers/Layer/GeoRSS.js
r1586 r1587 131 131 if (!sameMarkerClicked) { 132 132 var popup = this.createPopup(); 133 Event.observe(popup.div, "click",133 OpenLayers.Event.observe(popup.div, "click", 134 134 function() { 135 135 for(var i=0; i < this.layer.map.popups.length; i++) { … … 139 139 this.layer.map.addPopup(popup); 140 140 } 141 Event.stop(evt);141 OpenLayers.Event.stop(evt); 142 142 }, 143 143 sandbox/crschmidt/noprototype/lib/OpenLayers/Layer/Text.js
r1586 r1587 146 146 this.layer.map.addPopup(this.createPopup()); 147 147 } 148 Event.stop(evt);148 OpenLayers.Event.stop(evt); 149 149 }, 150 150 sandbox/crschmidt/noprototype/lib/OpenLayers/Map.js
r1586 r1587 153 153 // Note that this is ok, as updateSize() does nothing if the 154 154 // map's size has not actually changed. 155 Event.observe(window, 'resize',155 OpenLayers.Event.observe(window, 'resize', 156 156 this.updateSize.bindAsEventListener(this)); 157 157 } … … 174 174 175 175 // always call map.destroy() 176 Event.observe(window,176 OpenLayers.Event.observe(window, 177 177 'unload', 178 178 this.destroy.bindAsEventListener(this)); sandbox/crschmidt/noprototype/lib/OpenLayers/Util.js
r1586 r1587 134 134 if(delayDisplay) { 135 135 image.style.display = "none"; 136 Event.observe(image, "load",136 OpenLayers.Event.observe(image, "load", 137 137 OpenLayers.Util.onImageLoad.bindAsEventListener(image)); 138 Event.observe(image, "error",138 OpenLayers.Event.observe(image, "error", 139 139 OpenLayers.Util.onImageLoadError.bindAsEventListener(image)); 140 140 … … 273 273 if (delayDisplay) { 274 274 img.style.display = "none"; 275 Event.observe(img, "load",275 OpenLayers.Event.observe(img, "load", 276 276 OpenLayers.Util.onImageLoad.bindAsEventListener(div)); 277 Event.observe(img, "error",277 OpenLayers.Event.observe(img, "error", 278 278 OpenLayers.Util.onImageLoadError.bindAsEventListener(div)); 279 279 }
