Changeset 519

Show
Ignore:
Timestamp:
01/18/06 13:18:13 (3 years ago)
Author:
therve@gmail.com
Message:

Some syntax, change to MochiKit namespaces

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mochikit/branches/scriptaculous/MochiKit/Controls.js

    r511 r519  
    462462 
    463463                    while (foundPos != -1) { 
    464                         if (foundPos == 0 && elem.length != entry.length) { 
     464                        if (foundPos === 0 && elem.length != entry.length) { 
    465465                            ret.push('<li><strong>' + elem.substr(0, entry.length) + '</strong>' + 
    466466                                elem.substr(entry.length) + '</li>'); 
     
    658658            textField.style.backgroundColor = this.options.highlightcolor; 
    659659            var size = this.options.size || this.options.cols || 0; 
    660             if (size != 0) { 
     660            if (size !== 0) { 
    661661                textField.size = size; 
    662662            } 
  • mochikit/branches/scriptaculous/MochiKit/DragAndDrop.js

    r511 r519  
    11/*** 
     2MochiKit.Effect 1.2 
     3 
     4See <http://mochikit.com/> for documentation, downloads, license, etc. 
     5 
    26Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 
    37    Mochi-ized By Thomas Herve (_firstname_@nimail.org) 
    48 
    5 See scriptaculous.js for full license. 
    6  
    79***/ 
    810 
    9 if (typeof(DragAndDrop) == 'undefined') { 
    10     DragAndDrop = {}; 
     11if (typeof(MochiKit.DragAndDrop) == 'undefined') { 
     12    MochiKit.DragAndDrop = {}; 
    1113} 
    1214 
    13 DragAndDrop.NAME = 'DragAndDrop'; 
    14 DragAndDrop.VERSION = '1.0'; 
    15  
    16 DragAndDrop.__repr__ = function () { 
     15MochiKit.DragAndDrop.NAME = 'MochiKit.DragAndDrop'; 
     16MochiKit.DragAndDrop.VERSION = '1.2'; 
     17 
     18MochiKit.DragAndDrop.__repr__ = function () { 
    1719    return '[' + this.NAME + ' ' + this.VERSION + ']'; 
    1820}; 
    1921 
    20 DragAndDrop.toString = function () { 
     22MochiKit.DragAndDrop.toString = function () { 
    2123    return this.__repr__(); 
    2224}; 
    2325 
    24 DragAndDrop.Droppables = { 
     26MochiKit.DragAndDrop.Droppables = { 
    2527    /*** 
    2628 
     
    102104}; 
    103105 
    104 DragAndDrop.Droppable = function (element, options) { 
     106MochiKit.DragAndDrop.Droppable = function (element, options) { 
    105107    this.__init__(element, options); 
    106108}; 
    107109 
    108 DragAndDrop.Droppable.prototype = { 
     110MochiKit.DragAndDrop.Droppable.prototype = { 
    109111    /*** 
    110112 
    111113    A droppable object. Simple use is to create giving an element: 
    112114 
    113         new DragAndDrop.Droppable('myelement'); 
     115        new MochiKit.DragAndDrop.Droppable('myelement'); 
    114116 
    115117    Generally you'll want to define the 'onDrop' function and maybe the 
     
    117119 
    118120    ***/ 
     121    __class__: MochiKit.DragAndDrop.Droppable, 
     122 
    119123    __init__: function (element, /* optional */options) { 
    120124        this.element = MochiKit.DOM.getElement(element); 
     
    146150        MochiKit.DOM.makePositioned(this.element); // fix IE 
    147151 
    148         DragAndDrop.Droppables.register(this); 
     152        MochiKit.DragAndDrop.Droppables.register(this); 
    149153    }, 
    150154 
     
    178182                                            this.options.hoverclass); 
    179183        } 
    180         DragAndDrop.Droppables.last_active = null; 
     184        MochiKit.DragAndDrop.Droppables.last_active = null; 
    181185    }, 
    182186 
     
    185189            MochiKit.DOM.addElementClass(this.element, this.options.hoverclass); 
    186190        } 
    187         DragAndDrop.Droppables.last_active = this; 
     191        MochiKit.DragAndDrop.Droppables.last_active = this; 
     192    }, 
     193 
     194    repr: function () { 
     195        return '[' + this.__class__.NAME + ", options:" + MochiKit.Base.repr(this.options) + "]"; 
    188196    } 
    189197}; 
    190198 
    191 DragAndDrop.Draggables = { 
     199MochiKit.DragAndDrop.Draggables = { 
    192200    /*** 
    193201 
     
    230238 
    231239    activate: function (draggable) { 
    232         // allows keypress events if window isn't currently focused 
     240        // allows keypress events if window is not currently focused 
    233241        // fails for Safari 
    234242        window.focus(); 
     
    236244    }, 
    237245 
    238     deactivate: function (draggbale) { 
     246    deactivate: function (draggable) { 
    239247        this.activeDraggable = null; 
    240248    }, 
     
    298306        MochiKit.Iter.forEach(['onStart', 'onEnd', 'onDrag'], 
    299307        function (eventName) { 
    300             DragAndDrop.Draggables[eventName + 'Count'] = 
     308            MochiKit.DragAndDrop.Draggables[eventName + 'Count'] = 
    301309            MochiKit.Base.filter(function (o) { 
    302310                return o[eventName]; 
    303             }, DragAndDrop.Draggables.observers).length; 
     311            }, MochiKit.DragAndDrop.Draggables.observers).length; 
    304312        }); 
    305313    } 
    306314}; 
    307315 
    308 DragAndDrop.Draggable = function (element, options) { 
     316MochiKit.DragAndDrop.Draggable = function (element, options) { 
    309317    this.__init__(element, options); 
    310318}; 
    311319 
    312 DragAndDrop.Draggable.prototype = { 
     320MochiKit.DragAndDrop.Draggable.prototype = { 
    313321    /*** 
    314322 
    315323    A draggable object. Simple instantiate : 
    316324 
    317         new DragAndDrop.Draggable('myelement'); 
     325        new MochiKit.DragAndDrop.Draggable('myelement'); 
    318326 
    319327    ***/ 
     328    __class__ : MochiKit.DragAndDrop.Draggable, 
     329 
    320330    __init__: function (element, /* optional */options) { 
    321331        options = MochiKit.Base.update({ 
     
    362372                                                               this); 
    363373        MochiKit.Event.observe(this.handle, 'mousedown', this.eventMouseDown); 
    364         DragAndDrop.Draggables.register(this); 
     374        MochiKit.DragAndDrop.Draggables.register(this); 
    365375    }, 
    366376 
     
    368378        MochiKit.Event.stopObserving(this.handle, 'mousedown', 
    369379                                     this.eventMouseDown); 
    370         DragAndDrop.Draggables.unregister(this); 
     380        MochiKit.DragAndDrop.Draggables.unregister(this); 
    371381    }, 
    372382 
     
    403413        }, [0, 1]); 
    404414 
    405         DragAndDrop.Draggables.activate(this); 
     415        MochiKit.DragAndDrop.Draggables.activate(this); 
    406416        MochiKit.Event.stop(event); 
    407417    }, 
     
    424434            this.element.parentNode.insertBefore(this._clone, this.element); 
    425435        } 
    426         DragAndDrop.Droppables.prepare(this.element); 
    427         DragAndDrop.Draggables.notify('onStart', this, event); 
     436        MochiKit.DragAndDrop.Droppables.prepare(this.element); 
     437        MochiKit.DragAndDrop.Draggables.notify('onStart', this, event); 
    428438        if (this.options.starteffect) { 
    429439            this.options.starteffect(this.element); 
     
    436446        } 
    437447        MochiKit.Position.prepare(); 
    438         DragAndDrop.Droppables.show(pointer, this.element); 
    439         DragAndDrop.Draggables.notify('onDrag', this, event); 
     448        MochiKit.DragAndDrop.Droppables.show(pointer, this.element); 
     449        MochiKit.DragAndDrop.Draggables.notify('onDrag', this, event); 
    440450        this.draw(pointer); 
    441451        if (this.options.change) { 
     
    466476 
    467477        if (success) { 
    468             DragAndDrop.Droppables.fire(event, this.element); 
    469         } 
    470         DragAndDrop.Draggables.notify('onEnd', this, event); 
     478            MochiKit.DragAndDrop.Droppables.fire(event, this.element); 
     479        } 
     480        MochiKit.DragAndDrop.Draggables.notify('onEnd', this, event); 
    471481 
    472482        var revert = this.options.revert; 
     
    491501        } 
    492502 
    493         DragAndDrop.Draggables.deactivate(this); 
    494         DragAndDrop.Droppables.reset(); 
     503        MochiKit.DragAndDrop.Draggables.deactivate(this); 
     504        MochiKit.DragAndDrop.Droppables.reset(); 
    495505    }, 
    496506 
     
    550560            style.visibility = '';  // fix gecko rendering 
    551561        } 
     562    }, 
     563 
     564    repr: function () { 
     565        return '[' + this.__class__.NAME + ", options:" + MochiKit.Base.repr(this.options) + "]"; 
    552566    } 
    553567}; 
  • mochikit/branches/scriptaculous/MochiKit/Effects.js

    r510 r519  
    11/*** 
     2 
     3MochiKit.Effect 1.2 
     4 
     5See <http://mochikit.com/> for documentation, downloads, license, etc. 
    26 
    37Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 
     
    812    Mochi-ized By Thomas Herve (_firstname_@nimail.org) 
    913 
    10 See scriptaculous.js for full license. 
    11  
    1214***/ 
    1315 
    14 var Effect = { 
    15     tagifyText: function (element, /* optional */tagifyStyle) { 
    16         /*** 
    17  
    18         Change a node text to character in tags. 
    19  
    20         @param tagifyStyle: the style to apply to character nodes, default to 
    21         'position: relative'. 
    22  
    23         ***/ 
    24         var tagifyStyle = tagifyStyle || 'position:relative'; 
    25         if (MochiKit.Base.isIE()) { 
    26             tagifyStyle += ';zoom:1'; 
    27         } 
    28         element = MochiKit.DOM.getElement(element); 
    29         MochiKit.Iter.forEach(element.childNodes, function (child) { 
    30             if (child.nodeType == 3) { 
    31                 MochiKit.Iter.forEach(child.nodeValue.split(''), function (character) { 
    32                     element.insertBefore( 
    33                         MochiKit.DOM.SPAN({style: tagifyStyle}, 
    34                             character == ' ' ? String.fromCharCode(160) : character), child); 
    35                 }); 
    36                 MochiKit.DOM.removeElement(child); 
    37             } 
    38         }); 
    39     }, 
    40  
    41     multiple: function (elements, effect, /* optional */options) { 
    42         /*** 
    43  
    44         Launch the same effect subsequently on given elements. 
    45  
    46         ***/ 
    47         options = MochiKit.Base.update({ 
    48             speed: 0.1, 
    49             delay: 0.0 
    50         }, options || {}); 
    51         var masterDelay = options.delay; 
    52         var index = 0; 
    53         MochiKit.Iter.forEach(elements, function (element) { 
    54             options.delay = index * options.speed + masterDelay; 
    55             new effect(element, options); 
    56             index += 1; 
    57         }); 
    58     }, 
    59  
    60     PAIRS: { 
    61         'slide': ['SlideDown','SlideUp'], 
    62         'blind': ['BlindDown','BlindUp'], 
    63         'appear': ['Appear','Fade'] 
    64     }, 
    65  
    66     toggle: function (element, /* optional */effect, /* optional */options) { 
     16if (typeof(dojo) != 'undefined') { 
     17    dojo.provide('MochiKit.Effect'); 
     18    dojo.require('MochiKit.Base'); 
     19    dojo.require('MochiKit.DOM'); 
     20    dojo.require('MochiKit.Color'); 
     21    dojo.require('MochiKit.Iter'); 
     22
     23 
     24if (typeof(JSAN) != 'undefined') { 
     25    JSAN.use("MochiKit.Base", []); 
     26    JSAN.use("MochiKit.DOM", []); 
     27    JSAN.use("MochiKit.Color", []); 
     28    JSAN.use("MochiKit.Iter", []); 
     29
     30 
     31try { 
     32    if (typeof(MochiKit.Base) == 'undefined' || 
     33        typeof(MochiKit.DOM) == 'undefined' || 
     34        typeof(MochiKit.Color) == 'undefined' || 
     35        typeof(MochiKit.Iter) == 'undefined') { 
     36        throw ""; 
     37    } 
     38} catch (e) { 
     39    throw "MochiKit.Effect depends on MochiKit.Base, MochiKit.DOM, MochiKit.Color and MochiKit.Iter!"; 
     40
     41 
     42if (typeof(MochiKit.Effect) == "undefined") { 
     43    MochiKit.Effect = {}; 
     44
     45 
     46MochiKit.Effect.NAME = "MochiKit.Effect"; 
     47MochiKit.Effect.VERSION = "1.2"; 
     48 
     49MochiKit.Effect.__repr__ = function () { 
     50    return "[" + this.NAME + " " + this.VERSION + "]"; 
     51}; 
     52 
     53MochiKit.Effect.toString = function () { 
     54    return this.__repr__(); 
     55}; 
     56 
     57MochiKit.Effect.tagifyText = function (element, /* optional */tagifyStyle) { 
     58    /*** 
     59 
     60    Change a node text to character in tags. 
     61 
     62    @param tagifyStyle: the style to apply to character nodes, default to 
     63    'position: relative'. 
     64 
     65    ***/ 
     66    var tagifyStyle = tagifyStyle || 'position:relative'; 
     67    if (MochiKit.Base.isIE()) { 
     68        tagifyStyle += ';zoom:1'; 
     69    } 
     70    element = MochiKit.DOM.getElement(element); 
     71    MochiKit.Iter.forEach(element.childNodes, function (child) { 
     72        if (child.nodeType == 3) { 
     73            MochiKit.Iter.forEach(child.nodeValue.split(''), function (character) { 
     74                element.insertBefore( 
     75                    MochiKit.DOM.SPAN({style: tagifyStyle}, 
     76                        character == ' ' ? String.fromCharCode(160) : character), child); 
     77            }); 
     78            MochiKit.DOM.removeElement(child); 
     79        } 
     80    }); 
     81}; 
     82 
     83MochiKit.Effect.multiple = function (elements, effect, /* optional */options) { 
     84    /*** 
     85 
     86    Launch the same effect subsequently on given elements. 
     87 
     88    ***/ 
     89    options = MochiKit.Base.update({ 
     90        speed: 0.1, 
     91        delay: 0.0 
     92    }, options || {}); 
     93    var masterDelay = options.delay; 
     94    var index = 0; 
     95    MochiKit.Iter.forEach(elements, function (element) { 
     96        options.delay = index * options.speed + masterDelay; 
     97        new effect(element, options); 
     98        index += 1; 
     99    }); 
     100}; 
     101 
     102MochiKit.Effect.PAIRS = { 
     103    'slide': ['SlideDown','SlideUp'], 
     104    'blind': ['BlindDown','BlindUp'], 
     105    'appear': ['Appear','Fade'] 
     106}; 
     107 
     108MochiKit.Effect.toggle = function (element, /* optional */effect, /* optional */options) { 
    67109    /*** 
    68110 
     
    72114 
    73115    ***/ 
    74         element = MochiKit.DOM.getElement(element); 
    75         effect = (effect || 'appear').toLowerCase(); 
    76         options = MochiKit.Base.update({ 
    77             queue: {position: 'end', scope: (element.id || 'global')} 
    78         }, options || {}); 
    79         Effect[MochiKit.DOM.isVisible(element) ? 
    80           Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); 
    81     } 
     116    element = MochiKit.DOM.getElement(element); 
     117    effect = (effect || 'appear').toLowerCase(); 
     118    options = MochiKit.Base.update({ 
     119        queue: {position: 'end', scope: (element.id || 'global')} 
     120    }, options || {}); 
     121    MochiKit.Effect[MochiKit.DOM.isVisible(element) ? 
     122      MochiKit.Effect.PAIRS[effect][1] : MochiKit.Effect.PAIRS[effect][0]](element, options); 
    82123}; 
    83124 
     
    88129***/ 
    89130 
    90 Effect.Transitions = {} 
    91  
    92 Effect.Transitions.linear = function (pos) { 
     131MochiKit.Effect.Transitions = {} 
     132 
     133MochiKit.Effect.Transitions.linear = function (pos) { 
    93134    return pos; 
    94 
    95 Effect.Transitions.sinoidal = function (pos) { 
     135}; 
     136 
     137MochiKit.Effect.Transitions.sinoidal = function (pos) { 
    96138    return (-Math.cos(pos*Math.PI)/2) + 0.5; 
    97 
    98 Effect.Transitions.reverse = function (pos) { 
     139}; 
     140 
     141MochiKit.Effect.Transitions.reverse = function (pos) { 
    99142    return 1 - pos; 
    100 
    101 Effect.Transitions.flicker = function (pos) { 
     143}; 
     144 
     145MochiKit.Effect.Transitions.flicker = function (pos) { 
    102146    return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; 
    103 
    104 Effect.Transitions.wobble = function (pos) { 
     147}; 
     148 
     149MochiKit.Effect.Transitions.wobble = function (pos) { 
    105150    return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; 
    106 
    107 Effect.Transitions.pulse = function (pos) { 
     151}; 
     152 
     153MochiKit.Effect.Transitions.pulse = function (pos) { 
    108154    return (Math.floor(pos*10) % 2 == 0 ? 
    109155        (pos*10 - Math.floor(pos*10)) : 1 - (pos*10 - Math.floor(pos*10))); 
    110 
    111 Effect.Transitions.none = function (pos) { 
     156}; 
     157 
     158MochiKit.Effect.Transitions.none = function (pos) { 
    112159    return 0; 
    113 
    114 Effect.Transitions.full = function (pos) { 
     160}; 
     161 
     162MochiKit.Effect.Transitions.full = function (pos) { 
    115163    return 1; 
    116 } 
     164}; 
    117165 
    118166/*** 
     
    122170***/ 
    123171 
    124 Effect.ScopedQueue = function () { 
     172MochiKit.Effect.ScopedQueue = function () { 
    125173    this.__init__(); 
    126174}; 
    127175 
    128 MochiKit.Base.update(Effect.ScopedQueue.prototype, { 
     176MochiKit.Base.update(MochiKit.Effect.ScopedQueue.prototype, { 
    129177    __init__: function () { 
    130178        this.effects = []; 
     
    171219 
    172220    remove: function (effect) { 
    173         this.effects = MochiKit.Iter.list(MochiKit.Iter.ifilter(function (e) { 
     221        this.effects = MochiKit.Iter.filter(function (e) { 
    174222            return e != effect; 
    175         }, this.effects))
     223        }, this.effects)
    176224        if (this.effects.length == 0) { 
    177225            clearInterval(this.interval); 
     
    188236}); 
    189237 
    190 Effect.Queues = { 
     238MochiKit.Effect.Queues = { 
    191239    instances: new Array(), 
    192240 
     
    197245 
    198246        if (!this.instances[queueName]) { 
    199             this.instances[queueName] = new Effect.ScopedQueue(); 
     247            this.instances[queueName] = new MochiKit.Effect.ScopedQueue(); 
    200248        } 
    201249        return this.instances[queueName]; 
     
    203251}; 
    204252 
    205 Effect.Queue = Effect.Queues.get('global'); 
    206  
    207 Effect.DefaultOptions = { 
    208     transition: Effect.Transitions.sinoidal, 
     253MochiKit.Effect.Queue = MochiKit.Effect.Queues.get('global'); 
     254 
     255MochiKit.Effect.DefaultOptions = { 
     256    transition: MochiKit.Effect.Transitions.sinoidal, 
    209257    duration: 1.0,  // seconds 
    210     fps: 25.0,  // max. 25fps due to Effect.Queue implementation 
     258    fps: 25.0,  // max. 25fps due to MochiKit.Effect.Queue implementation 
    211259    sync: false,  // true for combining 
    212260    from: 0.0, 
     
    216264}; 
    217265 
    218 Effect.Base = function () {}; 
    219  
    220 Effect.Base.prototype = { 
     266MochiKit.Effect.Base = function () {}; 
     267 
     268MochiKit.Effect.Base.prototype = { 
    221269    /*** 
    222270 
     
    225273 
    226274    ***/ 
     275 
     276    __class__ : MochiKit.Effect.Base, 
     277     
    227278    position: null, 
    228279 
    229280    start: function (options) { 
    230281        this.options = MochiKit.Base.setdefault(options || {}, 
    231                                                 Effect.DefaultOptions); 
     282                                                MochiKit.Effect.DefaultOptions); 
    232283        this.currentFrame = 0; 
    233284        this.state = 'idle'; 
     
    236287        this.event('beforeStart'); 
    237288        if (!this.options.sync) { 
    238             Effect.Queues.get(typeof(this.options.queue) == 'string' ? 
     289            MochiKit.Effect.Queues.get(typeof(this.options.queue) == 'string' ? 
    239290                'global' : this.options.queue.scope).add(this); 
    240291        } 
     
    289340    cancel: function () { 
    290341        if (!this.options.sync) { 
    291             Effect.Queues.get(typeof(this.options.queue) == 'string' ? 
     342            MochiKit.Effect.Queues.get(typeof(this.options.queue) == 'string' ? 
    292343                'global' : this.options.queue.scope).remove(this); 
    293344        } 
     
    304355    }, 
    305356 
    306     __repr__: function () { 
    307         return '<Effect:' + MochiKit.Base.repr(this) + ', options:' + 
    308                MochiKit.Base.repr(this.options) + '>'; 
     357    repr: function () { 
     358        return '[' + this.__class__.NAME + ', options:' + 
     359               MochiKit.Base.repr(this.options) + ']'; 
    309360    } 
    310361} 
    311362 
    312 Effect.Parallel = function (effects, options) { 
     363MochiKit.Effect.Parallel = function (effects, options) { 
    313364    this.__init__(effects, options); 
    314365}; 
    315366 
    316 MochiKit.Base.update(Effect.Parallel.prototype, Effect.Base.prototype); 
    317  
    318 MochiKit.Base.update(Effect.Parallel.prototype, { 
     367MochiKit.Base.update(MochiKit.Effect.Parallel.prototype, MochiKit.Effect.Base.prototype); 
     368 
     369MochiKit.Base.update(MochiKit.Effect.Parallel.prototype, { 
    319370    /*** 
    320371 
     
    346397}); 
    347398 
    348 Effect.Opacity = function (element, options) { 
     399MochiKit.Effect.Opacity = function (element, options) { 
    349400    this.__init__(element, options); 
    350401}; 
    351402 
    352 MochiKit.Base.update(Effect.Opacity.prototype, Effect.Base.prototype); 
    353  
    354 MochiKit.Base.update(Effect.Opacity.prototype, { 
     403MochiKit.Base.update(MochiKit.Effect.Opacity.prototype, MochiKit.Effect.Base.prototype); 
     404 
     405MochiKit.Base.update(MochiKit.Effect.Opacity.prototype, { 
    355406    /*** 
    356407 
     
    379430}); 
    380431 
    381 Effect.Move = function (element, options) { 
     432MochiKit.Effect.Move = function (element, options) { 
    382433    this.__init__(element, options); 
    383434}; 
    384435 
    385 MochiKit.Base.update(Effect.Move.prototype, Effect.Base.prototype); 
    386  
    387 MochiKit.Base.update(Effect.Move.prototype, { 
     436MochiKit.Base.update(MochiKit.Effect.Move.prototype, MochiKit.Effect.Base.prototype); 
     437 
     438MochiKit.Base.update(MochiKit.Effect.Move.prototype, { 
    388439    /*** 
    389440 
     
    428479}); 
    429480 
    430 Effect.Scale = function (element, percent, options) { 
     481MochiKit.Effect.Scale = function (element, percent, options) { 
    431482    this.__init__(element, percent, options); 
    432483}; 
    433484 
    434 MochiKit.Base.update(Effect.Scale.prototype, Effect.Base.prototype); 
    435  
    436 MochiKit.Base.update(Effect.Scale.prototype, { 
     485MochiKit.Base.update(MochiKit.Effect.Scale.prototype, MochiKit.Effect.Base.prototype); 
     486 
     487MochiKit.Base.update(MochiKit.Effect.Scale.prototype, { 
    437488    /*** 
    438489 
     
    546597}); 
    547598 
    548 Effect.Highlight = function (element, options) { 
     599MochiKit.Effect.Highlight = function (element, options) { 
    549600    this.__init__(element, options); 
    550601}; 
    551602 
    552 MochiKit.Base.update(Effect.Highlight.prototype, Effect.Base.prototype); 
    553  
    554 MochiKit.Base.update(Effect.Highlight.prototype, { 
     603MochiKit.Base.update(MochiKit.Effect.Highlight.prototype, MochiKit.Effect.Base.prototype); 
     604 
     605MochiKit.Base.update(MochiKit.Effect.Highlight.prototype, { 
    555606    /*** 
    556607 
     
    622673}); 
    623674 
    624 Effect.ScrollTo = function (element, options) { 
     675MochiKit.Effect.ScrollTo = function (element, options) { 
    625676    this.__init__(element, options); 
    626677}; 
    627678 
    628 MochiKit.Base.update(Effect.ScrollTo.prototype, Effect.Base.prototype); 
    629  
    630 MochiKit.Base.update(Effect.ScrollTo.prototype, { 
     679MochiKit.Base.update(MochiKit.Effect.ScrollTo.prototype, MochiKit.Effect.Base.prototype); 
     680 
     681MochiKit.Base.update(MochiKit.Effect.ScrollTo.prototype, { 
    631682    /*** 
    632683 
     
    672723***/ 
    673724 
    674 Effect.Fade = function (element, options) { 
     725MochiKit.Effect.Fade = function (element, options) { 
    675726    /*** 
    676727 
     
    692743        } 
    693744    }, options || {}); 
    694     return new Effect.Opacity(element, options); 
    695 }; 
    696  
    697 Effect.Appear = function (element, options) { 
     745    return new MochiKit.Effect.Opacity(element, options); 
     746}; 
     747 
     748MochiKit.Effect.Appear = function (element, options) { 
    698749    /*** 
    699750 
     
    712763        } 
    713764    }, options || {}); 
    714     return new Effect.Opacity(element, options); 
    715 }; 
    716  
    717 Effect.Puff = function (element, options) { 
     765    return new MochiKit.Effect.Opacity(element, options); 
     766}; 
     767 
     768MochiKit.Effect.Puff = function (element, options) { 
    718769    /*** 
    719770 
     
    739790        } 
    740791    }, options || {}); 
    741     return new Effect.Parallel( 
    742         [new Effect.Scale(element, 200, 
     792    return new MochiKit.Effect.Parallel( 
     793        [new MochiKit.Effect.Scale(element, 200, 
    743794            {sync: true, scaleFromCenter: true, 
    744795             scaleContent: true, restoreAfterFinish: true}), 
    745          new Effect.Opacity(element, {sync: true, to: 0.0 })], 
     796         new MochiKit.Effect.Opacity(element, {sync: true, to: 0.0 })], 
    746797        options 
    747798    ); 
    748799}; 
    749800 
    750 Effect.BlindUp = function (element, options) { 
     801MochiKit.Effect.BlindUp = function (element, options) { 
    751802    /*** 
    752803 
     
    766817    }, options || {}); 
    767818 
    768     return new Effect.Scale(element, 0, options); 
    769 }; 
    770  
    771 Effect.BlindDown = function (element, options) { 
     819    return new MochiKit.Effect.Scale(element, 0, options); 
     820}; 
     821 
     822MochiKit.Effect.BlindDown = function (element, options) { 
    772823    /*** 
    773824 
     
    795846        } 
    796847    }, options || {}); 
    797     return new Effect.Scale(element, 100, options); 
    798 }; 
    799  
    800 Effect.SwitchOff = function (element) { 
     848    return new MochiKit.Effect.Scale(element, 100, options); 
     849}; 
     850 
     851MochiKit.Effect.SwitchOff = function (element) { 
    801852    /*** 
    802853 
     
    823874        } 
    824875    }; 
    825     return new Effect.Appear(element, { 
     876    return new MochiKit.Effect.Appear(element, { 
    826877        duration: 0.4, 
    827878        from: 0, 
    828         transition: Effect.Transitions.flicker, 
    829         afterFinishInternal: function (effect) { 
    830             new Effect.Scale(effect.element, 1, optionsScale) 
     879        transition: MochiKit.Effect.Transitions.flicker, 
     880        afterFinishInternal: function (effect) { 
     881            new MochiKit.Effect.Scale(effect.element, 1, optionsScale) 
    831882        } 
    832883    }); 
    833884}; 
    834885 
    835 Effect.DropOut = function (element, options) { 
     886MochiKit.Effect.DropOut = function (element, options) { 
    836887    /*** 
    837888 
     
    857908        } 
    858909    }, options || {}); 
    859     return new Effect.Parallel( 
    860         [new Effect.Move(element, {x: 0, y: 100, sync: true}), 
    861          new Effect.Opacity(element, {sync: true, to: 0.0})], 
     910    return new MochiKit.Effect.Parallel( 
     911        [new MochiKit.Effect.Move(element, {x: 0, y: 100, sync: true}), 
     912         new MochiKit.Effect.Opacity(element, {sync: true, to: 0.0})], 
    862913        options); 
    863914}; 
    864915 
    865 Effect.Shake = function (element) { 
     916MochiKit.Effect.Shake = function (element) { 
    866917    /*** 
    867918 
     
    873924        top: MochiKit.DOM.getStyle(element, 'top'), 
    874925        left: MochiKit.DOM.getStyle(element, 'left') }; 
    875         return new Effect.Move(element, 
     926        return new MochiKit.Effect.Move(element, 
    876927          {x: 20, y: 0, duration: 0.05, afterFinishInternal: function (effect) { 
    877         new Effect.Move(effect.element, 
     928        new MochiKit.Effect.Move(effect.element, 
    878929          {x: -40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 
    879         new Effect.Move(effect.element, 
     930        new MochiKit.Effect.Move(effect.element, 
    880931           {x: 40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 
    881         new Effect.Move(effect.element, 
     932        new MochiKit.Effect.Move(effect.element, 
    882933          {x: -40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 
    883         new Effect.Move(effect.element, 
     934        new MochiKit.Effect.Move(effect.element, 
    884935           {x: 40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 
    885         new Effect.Move(effect.element, 
     936        new MochiKit.Effect.Move(effect.element, 
    886937         {x: -20, y: 0, duration: 0.05, afterFinishInternal: function (effect) { 
    887938                MochiKit.DOM.undoPositioned(effect.element); 
     
    890941}; 
    891942 
    892 Effect.SlideDown = function (element, options) { 
     943MochiKit.Effect.SlideDown = function (element, options) { 
    893944    /*** 
    894945 
     
    932983    }, options || {}); 
    933984 
    934     return new Effect.Scale(element, 100, options); 
    935 }; 
    936  
    937 Effect.SlideUp = function (element, options) { 
     985    return new MochiKit.Effect.Scale(element, 100, options); 
     986}; 
     987 
     988MochiKit.Effect.SlideUp = function (element, options) { 
    938989    /*** 
    939990 
     
    9731024        } 
    9741025    }, options || {}); 
    975     return new Effect.Scale(element, 0, options); 
     1026    return new MochiKit.Effect.Scale(element, 0, options); 
    9761027}; 
    9771028 
    9781029// Bug in opera makes the TD containing this element expand for a instance 
    9791030// after finish 
    980 Effect.Squish = function (element, options) { 
     1031MochiKit.Effect.Squish = function (element, options) { 
    9811032    /*** 
    9821033 
     
    9951046    }, options || {}); 
    9961047 
    997     return new Effect.Scale(element, MochiKit.Base.isOpera() ? 1 : 0, options); 
    998 }; 
    999  
    1000 Effect.Grow = function (element, options) { 
     1048    return new MochiKit.Effect.Scale(element, MochiKit.Base.isOpera() ? 1 : 0, options); 
     1049}; 
     1050 
     1051MochiKit.Effect.Grow = function (element, options) { 
    10011052    /*** 
    10021053 
     
    10081059    options = MochiKit.Base.update({ 
    10091060        direction: 'center', 
    1010         moveTransistion: Effect.Transitions.sinoidal, 
    1011         scaleTransition: Effect.Transitions.sinoidal, 
    1012         opacityTransition: Effect.Transitions.full 
     1061        moveTransistion: MochiKit.Effect.Transitions.sinoidal, 
     1062        scaleTransition: MochiKit.Effect.Transitions.sinoidal, 
     1063        opacityTransition: MochiKit.Effect.Transitions.full 
    10131064    }, options || {}); 
    10141065    var oldStyle = { 
     
    10631114    }, options || {}); 
    10641115 
    1065     return new Effect.Move(element, { 
     1116    return new MochiKit.Effect.Move(element, { 
    10661117        x: initialMoveX, 
    10671118        y: initialMoveY, 
     
    10731124        }, 
    10741125        afterFinishInternal: function (effect) { 
    1075             new Effect.Parallel( 
    1076                 [new Effect.Opacity(effect.element, { 
     1126            new MochiKit.Effect.Parallel( 
     1127                [new MochiKit.Effect.Opacity(effect.element, { 
    10771128                    sync: true, to: 1.0, from: 0.0, 
    10781129                    transition: options.opacityTransition 
    10791130                 }), 
    1080                  new Effect.Move(effect.element, { 
     1131                 new MochiKit.Effect.Move(effect.element, { 
    10811132                     x: moveX, y: moveY, sync: true, 
    10821133                     transition: options.moveTransition 
    10831134                 }), 
    1084                  new Effect.Scale(effect.element, 100, { 
     1135                 new MochiKit.Effect.Scale(effect.element, 100, { 
    10851136                        scaleMode: {originalHeight: dims.h, 
    10861137                                    originalWidth: dims.w}, 
     
    10961147}; 
    10971148 
    1098 Effect.Shrink = function (element, options) { 
     1149MochiKit.Effect.Shrink = function (element, options) { 
    10991150    /*** 
    11001151 
     
    11051156    options = MochiKit.Base.update({ 
    11061157        direction: 'center', 
    1107         moveTransistion: Effect.Transitions.sinoidal, 
    1108         scaleTransition: Effect.Transitions.sinoidal, 
    1109         opacityTransition: Effect.Transitions.none 
     1158        moveTransistion: MochiKit.Effect.Transitions.sinoidal, 
     1159        scaleTransition: MochiKit.Effect.Transitions.sinoidal, 
     1160        opacityTransition: MochiKit.Effect.Transitions.none 
    11101161    }, options || {}); 
    11111162    var oldStyle = { 
     
    11541205    }, options || {}); 
    11551206 
    1156     return new Effect.Parallel( 
    1157         [new Effect.Opacity(element, { 
     1207    return new MochiKit.Effect.Parallel( 
     1208        [new MochiKit.Effect.Opacity(element, { 
    11581209            sync: true, to: 0.0, from: 1.0, 
    11591210            transition: options.opacityTransition 
    11601211         }), 
    1161          new Effect.Scale(element, MochiKit.Base.isOpera() ? 1 : 0, { 
     1212         new MochiKit.Effect.Scale(element, MochiKit.Base.isOpera() ? 1 : 0, { 
    11621213             sync: true, transition: options.scaleTransition, 
    11631214             restoreAfterFinish: true 
    11641215         }), 
    1165          new Effect.Move(element, { 
     1216         new MochiKit.Effect.Move(element, { 
    11661217             x: moveX, y: moveY, sync: true, transition: options.moveTransition 
    11671218         }) 
     
    11701221}; 
    11711222 
    1172 Effect.Pulsate = function (element, options) { 
     1223MochiKit.Effect.Pulsate = function (element, options) { 
    11731224    /*** 
    11741225 
     
    11851236    }, options || {}); 
    11861237    var oldOpacity = MochiKit.DOM.getInlineOpacity(element); 
    1187     var transition = options.transition || Effect.Transitions.sinoidal; 
     1238    var transition = options.transition || MochiKit.Effect.Transitions.sinoidal; 
    11881239    var reverser = MochiKit.Base.bind(function (pos) { 
    1189         return transition(1 - Effect.Transitions.pulse(pos)); 
     1240        return transition(1 - MochiKit.Effect.Transitions.pulse(pos)); 
    11901241    }, transition); 
    11911242    MochiKit.Base.bind(reverser, transition); 
    1192     return new Effect.Opacity(element, MochiKit.Base.update({ 
     1243    return new MochiKit.Effect.Opacity(element, MochiKit.Base.update({ 
    11931244        transition: reverser}, options)); 
    11941245}; 
    11951246 
    1196 Effect.Fold = function (element, options) { 
     1247MochiKit.Effect.Fold = function (element, options) { 
    11971248    /*** 
    11981249 
     
    12121263        scaleX: false, 
    12131264        afterFinishInternal: function (effect) { 
    1214             new Effect.Scale(element, 1, { 
     1265            new MochiKit.Effect.Scale(element, 1, { 
    12151266                scaleContent: false, 
    12161267                scaleY: false, 
     
    12231274        } 
    12241275    }, options || {}); 
    1225     return new Effect.Scale(element, 5, options); 
    1226 }; 
    1227  
     1276    return new MochiKit.Effect.Scale(element, 5, options); 
     1277}; 
     1278 
  • mochikit/branches/scriptaculous/MochiKit/New.js

    r511 r519  
    1111        } 
    1212 
    13         var camelizedString = str.indexOf('-') ==
     13        var camelizedString = str.indexOf('-') ===
    1414          ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) 
    1515          : oStringList[0]; 
     
    543543        if (parameter) { 
    544544            var key = encodeURIComponent(parameter[0]); 
    545             if (key.length == 0) { 
     545            if (key.length === 0) { 
    546546                return; 
    547547            } 
     
    669669    responseIsSuccess: function () { 
    670670        return this.transport.status == undefined 
    671             || this.transport.status ==
     671            || this.transport.status ===
    672672            || (this.transport.status >= 200 && this.transport.status < 300); 
    673673    },