Changeset 1546
- Timestamp:
- 05/05/08 10:36:32 (6 days ago)
- Location:
- trunk
- Files:
-
- 32 modified
-
Compatibility/Request/Request.JSON.js (modified) (1 diff)
-
Compatibility/Request/Request.js (modified) (1 diff)
-
Demos/Fx.Slide/demo.js (modified) (2 diffs)
-
Demos/Sortables/index.html (modified) (1 diff)
-
Docs/Class/Class.Extras.md (modified) (13 diffs)
-
Docs/Fx/Fx.md (modified) (3 diffs)
-
Docs/Plugins/Accordion.md (modified) (2 diffs)
-
Docs/Plugins/Drag.Move.md (modified) (1 diff)
-
Docs/Plugins/Drag.md (modified) (2 diffs)
-
Docs/Plugins/Group.md (modified) (2 diffs)
-
Docs/Plugins/Scroller.md (modified) (1 diff)
-
Docs/Plugins/Slider.md (modified) (4 diffs)
-
Docs/Plugins/Sortables.md (modified) (1 diff)
-
Docs/Plugins/Tips.md (modified) (5 diffs)
-
Docs/Request/Request.HTML.md (modified) (1 diff)
-
Docs/Request/Request.md (modified) (6 diffs)
-
Docs/Utilities/Swiff.md (modified) (1 diff)
-
Source/Class/Class.Extras.js (modified) (4 diffs)
-
Source/Core/Core.js (modified) (3 diffs)
-
Source/Fx/Fx.js (modified) (1 diff)
-
Source/Plugins/Accordion.js (modified) (2 diffs)
-
Source/Plugins/Drag.Move.js (modified) (3 diffs)
-
Source/Plugins/Drag.js (modified) (5 diffs)
-
Source/Plugins/Fx.Scroll.js (modified) (1 diff)
-
Source/Plugins/Fx.Slide.js (modified) (1 diff)
-
Source/Plugins/Scroller.js (modified) (2 diffs)
-
Source/Plugins/Slider.js (modified) (4 diffs)
-
Source/Plugins/SmoothScroll.js (modified) (1 diff)
-
Source/Plugins/Sortables.js (modified) (3 diffs)
-
Source/Plugins/Tips.js (modified) (1 diff)
-
Source/Request/Request.js (modified) (4 diffs)
-
Specs/Class/Class.Extras.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compatibility/Request/Request.JSON.js
r1540 r1546 19 19 20 20 failure: function(){ 21 this.fireEvent(' onFailure', this.xhr);21 this.fireEvent('failure', this.xhr); 22 22 } 23 23 -
trunk/Compatibility/Request/Request.js
r1540 r1546 30 30 31 31 failure: function(){ 32 this.fireEvent(' onFailure', this.xhr);32 this.fireEvent('failure', this.xhr); 33 33 } 34 34 -
trunk/Demos/Fx.Slide/demo.js
r1399 r1546 37 37 38 38 // When Vertical Slide ends its transition, we check for its status 39 // note that onComplete will not affect 'hide' and 'show' methods40 myVerticalSlide.addEvent(' onComplete', function() {39 // note that complete will not affect 'hide' and 'show' methods 40 myVerticalSlide.addEvent('complete', function() { 41 41 $('vertical_status').set('html', status[myVerticalSlide.open]); 42 42 }); … … 74 74 75 75 // When Horizontal Slide ends its transition, we check for its status 76 // note that onComplete will not affect 'hide' and 'show' methods77 myHorizontalSlide.addEvent(' onComplete', function() {76 // note that complete will not affect 'hide' and 'show' methods 77 myHorizontalSlide.addEvent('complete', function() { 78 78 $('horizontal_status').set('html', status[myHorizontalSlide.open]); 79 79 }); -
trunk/Demos/Sortables/index.html
r1436 r1546 25 25 The advanced example shows, that it is even possible to drag&drop list-elements 26 26 into another list. 27 < p/>27 </p> 28 28 <div id="anotherSortablesDemo"> 29 29 -
trunk/Docs/Class/Class.Extras.md
r1309 r1546 140 140 141 141 A Utility Class. Its methods can be implemented with [Class:implement][] into any [Class][]. 142 In [Fx][], for example, this Class is used to allow any number of functions to be added to the Fx events, like onComplete, onStart, and onCancel.142 In [Fx][], for example, this Class is used to allow any number of functions to be added to the Fx events, like 'complete', 'start', and 'cancel'. 143 143 Events in a Class that implements [Events](#Events) must be either added as an option or with addEvent, not directly through .options.onEventName. 144 144 … … 156 156 157 157 - This class can be implemented into other classes to add its functionality to them. 158 - Events has been designed to work well with the [Options](#Options) class when the option property begins with 'on' and is followed by a capital letter (e.g. 'onComplete').158 - Events has been designed to work well with the [Options](#Options) class when the option property begins with 'on' and is followed by a capital letter it will be added as an event (e.g. 'onComplete' will add as 'complete' event). 159 159 160 160 ### Example: … … 163 163 Implements: Events, 164 164 initialize: function(element){ 165 ...165 // ... 166 166 }, 167 167 complete: function(){ 168 this.fireEvent(' onComplete');168 this.fireEvent('complete'); 169 169 } 170 170 }); 171 171 172 172 var myWidget = new Widget(); 173 myWidget.addEvent('onComplete', myFunction); 173 myWidget.addEvent('complete', myFunction); 174 175 ### Notes: 176 177 - Events starting with 'on' are still supported in all methods and are converted to their representation without 'on' (e.g. 'onComplete' becomes 'complete'). 174 178 175 179 … … 191 195 ### Arguments: 192 196 193 1. type - (*string*) The type of event (e.g. ' onComplete').197 1. type - (*string*) The type of event (e.g. 'complete'). 194 198 2. fn - (*function*) The function to execute. 195 199 3. internal - (*boolean*, optional) Sets the function property: internal to true. Internal property is used to prevent removal. … … 202 206 203 207 var myFx = new Fx.Tween('element', 'opacity'); 204 myFx.addEvent('onStart', myStartFunction); 205 208 myFx.addEvent('start', myStartFunction); 206 209 207 210 … … 217 220 ### Arguments: 218 221 219 1. events - (*object*) An object with key/value representing: key the event name (e.g. ' onStart'), and value the function that is called when the Event occurs.222 1. events - (*object*) An object with key/value representing: key the event name (e.g. 'start'), and value the function that is called when the Event occurs. 220 223 221 224 ### Returns: … … 227 230 var myFx = new Fx.Tween('element', 'opacity'); 228 231 myFx.addEvents({ 229 ' onStart': myStartFunction,230 ' onComplete': function() {232 'start': myStartFunction, 233 'complete': function() { 231 234 alert('Done.'); 232 235 } … … 246 249 ### Arguments: 247 250 248 1. type - (*string*) The type of event (e.g. ' onComplete').251 1. type - (*string*) The type of event (e.g. 'complete'). 249 252 2. args - (*mixed*, optional) The argument(s) to pass to the function. To pass more than one argument, the arguments must be in an array. 250 253 3. delay - (*number*, optional) Delay in miliseconds to wait before executing the event (defaults to 0). … … 260 263 initialize: function(arg1, arg2){ 261 264 //... 262 this.fireEvent(" onInitialize", [arg1, arg2], 50);265 this.fireEvent("initialize", [arg1, arg2], 50); 263 266 } 264 267 }); … … 277 280 ### Arguments: 278 281 279 1. type - (*string*) The type of event (e.g. ' onComplete').282 1. type - (*string*) The type of event (e.g. 'complete'). 280 283 2. fn - (*function*) The function to remove. 281 284 … … 300 303 ### Arguments: 301 304 302 1. type - (*string*, optional) The type of event to remove (e.g. ' onComplete'). If no type is specified, removes all events of all types.305 1. type - (*string*, optional) The type of event to remove (e.g. 'complete'). If no type is specified, removes all events of all types. 303 306 304 307 ### Returns: … … 309 312 310 313 var myFx = new Fx.Tween('myElement', 'opacity'); 311 myFx.removeEvents(' onComplete');314 myFx.removeEvents('complete'); 312 315 313 316 … … 323 326 A Utility Class. Its methods can be implemented with [Class:implement][] into any [Class][]. 324 327 Used to automate the setting of a Class instance's options. 325 Will also add Class [Events](#Events) when the option property begins with 'on' and is followed by a capital letter (e.g. 'onComplete' ).328 Will also add Class [Events](#Events) when the option property begins with 'on' and is followed by a capital letter (e.g. 'onComplete' adds a 'complete' event). 326 329 327 330 ### Syntax: -
trunk/Docs/Fx/Fx.md
r1443 r1546 40 40 ### Events: 41 41 42 * onStart - (*function*) The function to execute when the effect begins.43 * onCancel - (*function*) The function to execute when you manually stop the effect.44 * onComplete - (*function*) The function to execute after the effect has processed.45 * onChainComplete - (*function*) The function to execute when using link 'chain' ([see options](#Fx:constructor)). It gets called after all effects in the chain have completed.42 * start - (*function*) The function to execute when the effect begins. 43 * cancel - (*function*) The function to execute when you manually stop the effect. 44 * complete - (*function*) The function to execute after the effect has processed. 45 * chainComplete - (*function*) The function to execute when using link 'chain' ([see options](#Fx:constructor)). It gets called after all effects in the chain have completed. 46 46 47 47 ### Notes: … … 59 59 ---------------------------- 60 60 61 The start method is used to begin a transition. Fires the onStartevent.61 The start method is used to begin a transition. Fires the 'start' event. 62 62 63 63 ### Syntax: … … 111 111 ------------------------------ 112 112 113 The cancel method is used to cancel a running transition. Fires the onCancelevent.113 The cancel method is used to cancel a running transition. Fires the 'cancel' event. 114 114 115 115 ### Syntax: -
trunk/Docs/Plugins/Accordion.md
r1516 r1546 41 41 ## Events: 42 42 43 ### onActive43 ### active 44 44 45 45 * (*function*) Function to execute when an element starts to show. … … 54 54 2. element - (*element*) The Element being displayed. 55 55 56 ### onBackground56 ### background 57 57 58 58 * (*function*) Function to execute when an element starts to hide. -
trunk/Docs/Plugins/Drag.Move.md
r1538 r1546 35 35 ### Events: 36 36 37 * onDrop - Executed when the element drops. Passes as argument the element and the element dropped on. If dropped on nothing, the second argument is null.38 * onLeave - Executed when the element leaves one of the droppables.39 * onEnter - Executed when the element enters one of the droppables.37 * drop - Executed when the element drops. Passes as argument the element and the element dropped on. If dropped on nothing, the second argument is null. 38 * leave - Executed when the element leaves one of the droppables. 39 * enter - Executed when the element enters one of the droppables. 40 40 41 41 ### Example: -
trunk/Docs/Plugins/Drag.md
r1505 r1546 34 34 ### Events: 35 35 36 * onBeforeStart - Executed before the Drag instance attaches the events. Receives the dragged element as an argument.37 * onStart - Executed when the user starts to drag (on mousedown). Receives the dragged element as an argument.38 * onSnap - Executed when the user has dragged past the snap option. Receives the dragged element as an argument.39 * onDrag - Executed on every step of the drag. Receives the dragged element as an argument.40 * onComplete - Executed when the user completes the drag. Receives the dragged element as an argument.36 * beforeStart - Executed before the Drag instance attaches the events. Receives the dragged element as an argument. 37 * start - Executed when the user starts to drag (on mousedown). Receives the dragged element as an argument. 38 * snap - Executed when the user has dragged past the snap option. Receives the dragged element as an argument. 39 * drag - Executed on every step of the drag. Receives the dragged element as an argument. 40 * complete - Executed when the user completes the drag. Receives the dragged element as an argument. 41 41 42 42 ### Examples: … … 126 126 ------------------------------ 127 127 128 Stops (removes) all attached events from the Drag instance and executes the onCompleteEvent.128 Stops (removes) all attached events from the Drag instance and executes the 'complete' Event. 129 129 130 130 ### Syntax: -
trunk/Docs/Plugins/Group.md
r1464 r1546 23 23 24 24 var group = new Group(xhr1, xhr2, xhr3); 25 group.addEvent(' onComplete', function(){25 group.addEvent('complete', function(){ 26 26 alert('All Scripts loaded'); 27 27 }); … … 44 44 ### Arguments: 45 45 46 1. type - (*string*) The event name (e.g. ' onComplete') to add.46 1. type - (*string*) The event name (e.g. 'complete') to add. 47 47 2. fn - (*function*) The callback function to execute when all instances fired this event. 48 48 -
trunk/Docs/Plugins/Scroller.md
r1485 r1546 30 30 ### Events: 31 31 32 * onChange - (*function*) When the mouse reaches some boundaries, you can choose to alter some other values, instead of the scrolling offsets.32 * change - (*function*) When the mouse reaches some boundaries, you can choose to alter some other values, instead of the scrolling offsets. 33 33 34 34 #### Signature: -
trunk/Docs/Plugins/Slider.md
r1505 r1546 33 33 34 34 35 Slider Event: onChange {#Slider:onChange}35 Slider Event: change {#Slider:change} 36 36 ----------------------------------------- 37 37 … … 48 48 49 49 50 Slider Event: onComplete {#Slider: onComplete}50 Slider Event: onComplete {#Slider:complete} 51 51 --------------------------------------------- 52 52 … … 63 63 64 64 65 Slider Event: onTick {#Slider:onTick}65 Slider Event: tick {#Slider:tick} 66 66 ------------------------------------- 67 67 68 * (*function*) Fires when the user drags the knob. This Event can be overriden to alter the onTick behavior.68 * (*function*) Fires when the user drags the knob. This Event can be overriden to alter the tick behavior. 69 69 70 70 ### Signature: … … 78 78 ### Notes: 79 79 80 - Slider originally uses the onTickevent to set the style of the knob to a new position.80 - Slider originally uses the 'tick' event to set the style of the knob to a new position. 81 81 82 82 ### Returns: -
trunk/Docs/Plugins/Sortables.md
r1544 r1546 22 22 ### Events: 23 23 24 * onStart - function executed when the item starts dragging25 * onSort - function executed when the item is inserted into a new place in one of the lists26 * onComplete - function executed when the item ends dragging24 * start - function executed when the item starts dragging 25 * sort - function executed when the item is inserted into a new place in one of the lists 26 * complete - function executed when the item ends dragging 27 27 28 28 ### Examples: -
trunk/Docs/Plugins/Tips.md
r1485 r1546 26 26 ### Options: 27 27 28 * showDelay - (*number*: defaults to 100) The delay the onShow method is called.29 * hideDelay - (*number*: defaults to 100) The delay the onHide method is called.28 * showDelay - (*number*: defaults to 100) The delay the show event is fired. 29 * hideDelay - (*number*: defaults to 100) The delay the hide hide is fired. 30 30 * className - (*string*: defaults to null) the className your tooltip container will get. Useful for extreme styling. 31 31 * The tooltip element inside the tooltip container above will have 'tip' as classname. … … 38 38 ### Events: 39 39 40 * onHide: fires when the tip is shown41 * onShow: fires when the tip is being hidden40 * hide: fires when the tip is shown 41 * show: fires when the tip is being hidden 42 42 43 43 ### Example: … … 52 52 53 53 54 Tips Event: onShow {#Tips:onShow}54 Tips Event: show {#Tips:show} 55 55 --------------------------------- 56 56 … … 67 67 ### Example: 68 68 69 myTips.addEvent(' onShow', function(tip){69 myTips.addEvent('show', function(tip){ 70 70 tip.fade('in'); 71 71 }); 72 72 73 Tips Event: onHide {#Tips:onHide}73 Tips Event: hide {#Tips:hide} 74 74 --------------------------------- 75 75 … … 86 86 ### Example: 87 87 88 myTips.addEvent(' onHide', function(tip){88 myTips.addEvent('hide', function(tip){ 89 89 tip.fade('out'); 90 90 }); -
trunk/Docs/Request/Request.HTML.md
r1545 r1546 26 26 ### Events: 27 27 28 #### onComplete28 #### complete 29 29 30 30 * (*function*) Function to execute when the HTML request completes. -
trunk/Docs/Request/Request.md
r1504 r1546 30 30 ---------------------------------------- 31 31 32 ### onRequest32 ### request 33 33 34 34 (*function*) Function to execute when the Request is sent. … … 42 42 1. instance - (Request) The transport instance. 43 43 44 ### onSuccess44 ### success 45 45 46 46 (*function*) Function to execute when the Request completes. … … 55 55 2. responseXML - (*mixed*) The response XML from the request. 56 56 57 ### onFailure57 ### failure 58 58 59 59 (*function*) Function to execute when the request fails (error status code). … … 67 67 instance - (Request) The transport instance. 68 68 69 ### onException69 ### exception 70 70 71 71 (*function*) Function to execute when setting a request header fails. … … 80 80 2. value - (*string*) The value of the failing header. 81 81 82 ### onCancel82 ### cancel 83 83 84 84 (*function*) Function to execute when a request has been cancelled. … … 91 91 92 92 * running - (*boolean*) True if the request is running. 93 * response - (*object*) Object with text and XML as keys. You can access this property in the onSuccessevent.93 * response - (*object*) Object with text and XML as keys. You can access this property in the 'success' event. 94 94 95 95 ### Returns: -
trunk/Docs/Utilities/Swiff.md
r1465 r1546 51 51 }, 52 52 events: { 53 onLoad: myOnloadFunc53 load: myOnloadFunc 54 54 } 55 55 }); -
trunk/Source/Class/Class.Extras.js
r1514 r1546 28 28 29 29 addEvent: function(type, fn, internal){ 30 type = Events.removeOn(type); 30 31 if (fn != $empty){ 31 32 this.$events = this.$events || {}; … … 43 44 44 45 fireEvent: function(type, args, delay){ 46 type = Events.removeOn(type); 45 47 if (!this.$events || !this.$events[type]) return this; 46 48 this.$events[type].each(function(fn){ … … 51 53 52 54 removeEvent: function(type, fn){ 55 type = Events.removeOn(type); 53 56 if (!this.$events || !this.$events[type]) return this; 54 57 if (!fn.internal) this.$events[type].erase(fn); … … 67 70 }); 68 71 72 Events.removeOn = function(string){ 73 return string.replace(/^on([A-Z])/, function(full, first) { 74 return first.toLowerCase(); 75 }); 76 }; 77 69 78 var Options = new Class({ 70 79 -
trunk/Source/Core/Core.js
r1539 r1546 94 94 95 95 (function(objects){ 96 for (var name in objects) Native.typize(objects[name], name .toLowerCase());97 })({' Boolean': Boolean, 'Native': Native, 'Object': Object});96 for (var name in objects) Native.typize(objects[name], name); 97 })({'boolean': Boolean, 'native': Native, 'object': Object}); 98 98 99 99 (function(objects){ … … 102 102 103 103 (function(object, methods){ 104 for (var i = 0, l = methods.length; i < l; i++) Native.genericize(object, methods[i], true);104 for (var i = methods.length; i--; i) Native.genericize(object, methods[i], true); 105 105 return arguments.callee; 106 106 }) … … 142 142 143 143 function $unlink(object){ 144 var unlinked = null;144 var unlinked; 145 145 146 146 switch ($type(object)){ -
trunk/Source/Fx/Fx.js
r1540 r1546 83 83 84 84 onStart: function(){ 85 this.fireEvent(' onStart', this.subject);85 this.fireEvent('start', this.subject); 86 86 }, 87 87 88 88 onComplete: function(){ 89 this.fireEvent(' onComplete', this.subject);90 if (!this.callChain()) this.fireEvent(' onChainComplete', this.subject);89 this.fireEvent('complete', this.subject); 90 if (!this.callChain()) this.fireEvent('chainComplete', this.subject); 91 91 }, 92 92 93 93 onCancel: function(){ 94 this.fireEvent(' onCancel', this.subject).clearChain();94 this.fireEvent('cancel', this.subject).clearChain();