in partnership with mediatemple

Changeset 684

Show
Ignore:
Timestamp:
06/19/07 05:23:43 (1 year ago)
Author:
tomocchino
Message:

got rid of revertOptions in Sortables, now you can customize the revert effect by simply passing the effect options to revert or pass true to use the default options (JanK)
removed object initialization as it was remnant from when setup was going to be a much more complicated process

Location:
trunk/Plugins
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/Plugins/Group.js

    r588 r684  
    2929        xhr3.request(); 
    3030        (end) 
    31  
    3231*/ 
    3332 
  • trunk/Plugins/Hash.Cookie.js

    r500 r684  
    9595        }; 
    9696}); 
     97 
    9798Hash.Cookie.implement(Hash.Cookie.Methods); 
  • trunk/Plugins/Slider.js

    r673 r684  
    144144}); 
    145145 
    146 Slider.implement(new Events); 
    147 Slider.implement(new Options); 
     146Slider.implement(new Events, new Options); 
  • trunk/Plugins/Sortables.js

    r683 r684  
    1313Arguments: 
    1414        list - required, the list or lists that will become sortable. 
    15                 This argument can be a string id, an element, or an object or array of either strings or elements. When a single 
    16                 list (or id) is passed, that list will be sortable only with itself. To enable sorting between lists, one or more 
    17                 lists or id's must be passed using an array or an object. See Examples below. 
     15                This argument can be an Element, or array of Elements. When a single list (or id) is passed, that list will be sortable only with itself. 
     16                To enable sorting between lists, one or more lists or id's must be passed using an array or an object. See Examples below. 
    1817        options - an Object, see options and events below. 
    1918 
    2019Options: 
     20        constrain - whether or not to constrain the element being dragged to its parent element. defaults to false. 
    2121        clone - whether or not to display a copy of the actual element while dragging. defaults to true. 
    2222        cloneOpacity - opacity of the place holding element 
    2323        elementOpacity - opacity of the element being dragged for sorting 
    24         revert - whether or not to use an effect to slide the element into its final location after sorting. defaults to false. 
    25         revertOptions - an object specifying extra options to be passed to the revert effect, if used. 
    2624        handle - a selector which be used to select the element inside each item to be used as a handle for sorting that item.  if no match is found, the element is used as its own handle. 
    27         constrain - whether or not to constrain the element being dragged to its parent element. defaults to false. 
     25        revert - whether or not to use an effect to slide the element into its final location after sorting. If you pass an object it will be treated as true and used as aditional options for the revert effect. defaults to false. 
    2826 
    2927Events: 
     
    3432        (start code) 
    3533        var mySortables = new Sortables('list-1', { 
    36                 revert: true, 
    37                 revertOptions: {duration: 500, transition: Fx.Transitions.Elastic.easeOut} 
     34                revert: { duration: 500, transition: Fx.Transitions.Elastic.easeOut } 
    3835        }); 
    3936        //creates a new Sortable instance over the list with id 'list-1' with some extra options for the revert effect 
     37 
     38        var mySortables = new Sortables(['list-1', 'list-2'], { 
     39                constrain: true, 
     40                clone: false, 
     41                revert: true 
     42        }); 
     43        //creates a new Sortable instance allowing the sorting of the lists with id's 'list-1' and 'list-2' with extra options 
     44        //since constrain was set to false, the items will not be able to be dragged from one list to the other 
    4045         
    4146        var mySortables = new Sortables(['list-1', 'list-2', 'list-3']); 
    4247        //creates a new Sortable instance allowing sorting between the lists with id's 'list-1', 'list-2, and 'list-3' 
    4348        (end) 
    44  
    4549*/ 
    4650 
     
    6266                this.setOptions(options); 
    6367                this.idle = true; 
    64                 this.lists = []; 
    6568                this.hovering = false; 
    6669                this.newInsert = false; 
     70                this.revert = this.options.revert ? $merge({ duration: 250, wait: false }, this.options.revert) : false; 
    6771                this.bound = { 
    6872                        'start': [], 
     
    7276                 
    7377                switch($type(lists)){ 
    74                         case 'array': for (var i = 0, l = lists.length; i < l; i++) this.lists[i] = $(lists[i]); break; 
    75                         case 'object': for (var e in lists) this.lists.push($(lists[e])); break; 
    76                         case 'string': case 'element': this.lists.push($(lists)); break; 
    77                         default: return; 
     78                        case 'string': case 'element': this.lists = $splat($(lists)); break; 
     79                        case 'array': this.lists = $$(lists); break; 
    7880                } 
    7981                 
     
    267269                this.reposition(); 
    268270 
    269                 if (!this.options.revert) this.reset(); 
     271                if (!this.revert) this.reset(); 
    270272                else { 
    271                         if (!this.effect) this.effect = this.element.effects($merge(this.options.revertOptions, {wait: false, onComplete: this.reset.bind(this)})); 
     273                        if (!this.effect) this.effect = this.element.effects(this.revert).addEvent('onComplete', this.reset.bind(this)); 
    272274                        else this.effect.element = this.element; 
    273275                        this.effect.start({