Changeset 519
- Timestamp:
- 01/18/06 13:18:13 (3 years ago)
- Files:
-
- mochikit/branches/scriptaculous/MochiKit/Controls.js (modified) (2 diffs)
- mochikit/branches/scriptaculous/MochiKit/DragAndDrop.js (modified) (17 diffs)
- mochikit/branches/scriptaculous/MochiKit/Effects.js (modified) (42 diffs)
- mochikit/branches/scriptaculous/MochiKit/New.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mochikit/branches/scriptaculous/MochiKit/Controls.js
r511 r519 462 462 463 463 while (foundPos != -1) { 464 if (foundPos == 0 && elem.length != entry.length) {464 if (foundPos === 0 && elem.length != entry.length) { 465 465 ret.push('<li><strong>' + elem.substr(0, entry.length) + '</strong>' + 466 466 elem.substr(entry.length) + '</li>'); … … 658 658 textField.style.backgroundColor = this.options.highlightcolor; 659 659 var size = this.options.size || this.options.cols || 0; 660 if (size != 0) {660 if (size !== 0) { 661 661 textField.size = size; 662 662 } mochikit/branches/scriptaculous/MochiKit/DragAndDrop.js
r511 r519 1 1 /*** 2 MochiKit.Effect 1.2 3 4 See <http://mochikit.com/> for documentation, downloads, license, etc. 5 2 6 Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 3 7 Mochi-ized By Thomas Herve (_firstname_@nimail.org) 4 8 5 See scriptaculous.js for full license.6 7 9 ***/ 8 10 9 if (typeof( DragAndDrop) == 'undefined') {10 DragAndDrop = {};11 if (typeof(MochiKit.DragAndDrop) == 'undefined') { 12 MochiKit.DragAndDrop = {}; 11 13 } 12 14 13 DragAndDrop.NAME = 'DragAndDrop';14 DragAndDrop.VERSION = '1.0';15 16 DragAndDrop.__repr__ = function () {15 MochiKit.DragAndDrop.NAME = 'MochiKit.DragAndDrop'; 16 MochiKit.DragAndDrop.VERSION = '1.2'; 17 18 MochiKit.DragAndDrop.__repr__ = function () { 17 19 return '[' + this.NAME + ' ' + this.VERSION + ']'; 18 20 }; 19 21 20 DragAndDrop.toString = function () {22 MochiKit.DragAndDrop.toString = function () { 21 23 return this.__repr__(); 22 24 }; 23 25 24 DragAndDrop.Droppables = {26 MochiKit.DragAndDrop.Droppables = { 25 27 /*** 26 28 … … 102 104 }; 103 105 104 DragAndDrop.Droppable = function (element, options) {106 MochiKit.DragAndDrop.Droppable = function (element, options) { 105 107 this.__init__(element, options); 106 108 }; 107 109 108 DragAndDrop.Droppable.prototype = {110 MochiKit.DragAndDrop.Droppable.prototype = { 109 111 /*** 110 112 111 113 A droppable object. Simple use is to create giving an element: 112 114 113 new DragAndDrop.Droppable('myelement');115 new MochiKit.DragAndDrop.Droppable('myelement'); 114 116 115 117 Generally you'll want to define the 'onDrop' function and maybe the … … 117 119 118 120 ***/ 121 __class__: MochiKit.DragAndDrop.Droppable, 122 119 123 __init__: function (element, /* optional */options) { 120 124 this.element = MochiKit.DOM.getElement(element); … … 146 150 MochiKit.DOM.makePositioned(this.element); // fix IE 147 151 148 DragAndDrop.Droppables.register(this);152 MochiKit.DragAndDrop.Droppables.register(this); 149 153 }, 150 154 … … 178 182 this.options.hoverclass); 179 183 } 180 DragAndDrop.Droppables.last_active = null;184 MochiKit.DragAndDrop.Droppables.last_active = null; 181 185 }, 182 186 … … 185 189 MochiKit.DOM.addElementClass(this.element, this.options.hoverclass); 186 190 } 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) + "]"; 188 196 } 189 197 }; 190 198 191 DragAndDrop.Draggables = {199 MochiKit.DragAndDrop.Draggables = { 192 200 /*** 193 201 … … 230 238 231 239 activate: function (draggable) { 232 // allows keypress events if window is n't currently focused240 // allows keypress events if window is not currently focused 233 241 // fails for Safari 234 242 window.focus(); … … 236 244 }, 237 245 238 deactivate: function (dragg bale) {246 deactivate: function (draggable) { 239 247 this.activeDraggable = null; 240 248 }, … … 298 306 MochiKit.Iter.forEach(['onStart', 'onEnd', 'onDrag'], 299 307 function (eventName) { 300 DragAndDrop.Draggables[eventName + 'Count'] =308 MochiKit.DragAndDrop.Draggables[eventName + 'Count'] = 301 309 MochiKit.Base.filter(function (o) { 302 310 return o[eventName]; 303 }, DragAndDrop.Draggables.observers).length;311 }, MochiKit.DragAndDrop.Draggables.observers).length; 304 312 }); 305 313 } 306 314 }; 307 315 308 DragAndDrop.Draggable = function (element, options) {316 MochiKit.DragAndDrop.Draggable = function (element, options) { 309 317 this.__init__(element, options); 310 318 }; 311 319 312 DragAndDrop.Draggable.prototype = {320 MochiKit.DragAndDrop.Draggable.prototype = { 313 321 /*** 314 322 315 323 A draggable object. Simple instantiate : 316 324 317 new DragAndDrop.Draggable('myelement');325 new MochiKit.DragAndDrop.Draggable('myelement'); 318 326 319 327 ***/ 328 __class__ : MochiKit.DragAndDrop.Draggable, 329 320 330 __init__: function (element, /* optional */options) { 321 331 options = MochiKit.Base.update({ … … 362 372 this); 363 373 MochiKit.Event.observe(this.handle, 'mousedown', this.eventMouseDown); 364 DragAndDrop.Draggables.register(this);374 MochiKit.DragAndDrop.Draggables.register(this); 365 375 }, 366 376 … … 368 378 MochiKit.Event.stopObserving(this.handle, 'mousedown', 369 379 this.eventMouseDown); 370 DragAndDrop.Draggables.unregister(this);380 MochiKit.DragAndDrop.Draggables.unregister(this); 371 381 }, 372 382 … … 403 413 }, [0, 1]); 404 414 405 DragAndDrop.Draggables.activate(this);415 MochiKit.DragAndDrop.Draggables.activate(this); 406 416 MochiKit.Event.stop(event); 407 417 }, … … 424 434 this.element.parentNode.insertBefore(this._clone, this.element); 425 435 } 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); 428 438 if (this.options.starteffect) { 429 439 this.options.starteffect(this.element); … … 436 446 } 437 447 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); 440 450 this.draw(pointer); 441 451 if (this.options.change) { … … 466 476 467 477 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); 471 481 472 482 var revert = this.options.revert; … … 491 501 } 492 502 493 DragAndDrop.Draggables.deactivate(this);494 DragAndDrop.Droppables.reset();503 MochiKit.DragAndDrop.Draggables.deactivate(this); 504 MochiKit.DragAndDrop.Droppables.reset(); 495 505 }, 496 506 … … 550 560 style.visibility = ''; // fix gecko rendering 551 561 } 562 }, 563 564 repr: function () { 565 return '[' + this.__class__.NAME + ", options:" + MochiKit.Base.repr(this.options) + "]"; 552 566 } 553 567 }; mochikit/branches/scriptaculous/MochiKit/Effects.js
r510 r519 1 1 /*** 2 3 MochiKit.Effect 1.2 4 5 See <http://mochikit.com/> for documentation, downloads, license, etc. 2 6 3 7 Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) … … 8 12 Mochi-ized By Thomas Herve (_firstname_@nimail.org) 9 13 10 See scriptaculous.js for full license.11 12 14 ***/ 13 15 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) { 16 if (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 24 if (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 31 try { 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 42 if (typeof(MochiKit.Effect) == "undefined") { 43 MochiKit.Effect = {}; 44 } 45 46 MochiKit.Effect.NAME = "MochiKit.Effect"; 47 MochiKit.Effect.VERSION = "1.2"; 48 49 MochiKit.Effect.__repr__ = function () { 50 return "[" + this.NAME + " " + this.VERSION + "]"; 51 }; 52 53 MochiKit.Effect.toString = function () { 54 return this.__repr__(); 55 }; 56 57 MochiKit.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 83 MochiKit.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 102 MochiKit.Effect.PAIRS = { 103 'slide': ['SlideDown','SlideUp'], 104 'blind': ['BlindDown','BlindUp'], 105 'appear': ['Appear','Fade'] 106 }; 107 108 MochiKit.Effect.toggle = function (element, /* optional */effect, /* optional */options) { 67 109 /*** 68 110 … … 72 114 73 115 ***/ 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); 82 123 }; 83 124 … … 88 129 ***/ 89 130 90 Effect.Transitions = {}91 92 Effect.Transitions.linear = function (pos) {131 MochiKit.Effect.Transitions = {} 132 133 MochiKit.Effect.Transitions.linear = function (pos) { 93 134 return pos; 94 } 95 Effect.Transitions.sinoidal = function (pos) { 135 }; 136 137 MochiKit.Effect.Transitions.sinoidal = function (pos) { 96 138 return (-Math.cos(pos*Math.PI)/2) + 0.5; 97 } 98 Effect.Transitions.reverse = function (pos) { 139 }; 140 141 MochiKit.Effect.Transitions.reverse = function (pos) { 99 142 return 1 - pos; 100 } 101 Effect.Transitions.flicker = function (pos) { 143 }; 144 145 MochiKit.Effect.Transitions.flicker = function (pos) { 102 146 return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; 103 } 104 Effect.Transitions.wobble = function (pos) { 147 }; 148 149 MochiKit.Effect.Transitions.wobble = function (pos) { 105 150 return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; 106 } 107 Effect.Transitions.pulse = function (pos) { 151 }; 152 153 MochiKit.Effect.Transitions.pulse = function (pos) { 108 154 return (Math.floor(pos*10) % 2 == 0 ? 109 155 (pos*10 - Math.floor(pos*10)) : 1 - (pos*10 - Math.floor(pos*10))); 110 } 111 Effect.Transitions.none = function (pos) { 156 }; 157 158 MochiKit.Effect.Transitions.none = function (pos) { 112 159 return 0; 113 } 114 Effect.Transitions.full = function (pos) { 160 }; 161 162 MochiKit.Effect.Transitions.full = function (pos) { 115 163 return 1; 116 } 164 }; 117 165 118 166 /*** … … 122 170 ***/ 123 171 124 Effect.ScopedQueue = function () {172 MochiKit.Effect.ScopedQueue = function () { 125 173 this.__init__(); 126 174 }; 127 175 128 MochiKit.Base.update( Effect.ScopedQueue.prototype, {176 MochiKit.Base.update(MochiKit.Effect.ScopedQueue.prototype, { 129 177 __init__: function () { 130 178 this.effects = []; … … 171 219 172 220 remove: function (effect) { 173 this.effects = MochiKit.Iter. list(MochiKit.Iter.ifilter(function (e) {221 this.effects = MochiKit.Iter.filter(function (e) { 174 222 return e != effect; 175 }, this.effects) );223 }, this.effects); 176 224 if (this.effects.length == 0) { 177 225 clearInterval(this.interval); … … 188 236 }); 189 237 190 Effect.Queues = {238 MochiKit.Effect.Queues = { 191 239 instances: new Array(), 192 240 … … 197 245 198 246 if (!this.instances[queueName]) { 199 this.instances[queueName] = new Effect.ScopedQueue();247 this.instances[queueName] = new MochiKit.Effect.ScopedQueue(); 200 248 } 201 249 return this.instances[queueName]; … … 203 251 }; 204 252 205 Effect.Queue =Effect.Queues.get('global');206 207 Effect.DefaultOptions = {208 transition: Effect.Transitions.sinoidal,253 MochiKit.Effect.Queue = MochiKit.Effect.Queues.get('global'); 254 255 MochiKit.Effect.DefaultOptions = { 256 transition: MochiKit.Effect.Transitions.sinoidal, 209 257 duration: 1.0, // seconds 210 fps: 25.0, // max. 25fps due to Effect.Queue implementation258 fps: 25.0, // max. 25fps due to MochiKit.Effect.Queue implementation 211 259 sync: false, // true for combining 212 260 from: 0.0, … … 216 264 }; 217 265 218 Effect.Base = function () {};219 220 Effect.Base.prototype = {266 MochiKit.Effect.Base = function () {}; 267 268 MochiKit.Effect.Base.prototype = { 221 269 /*** 222 270 … … 225 273 226 274 ***/ 275 276 __class__ : MochiKit.Effect.Base, 277 227 278 position: null, 228 279 229 280 start: function (options) { 230 281 this.options = MochiKit.Base.setdefault(options || {}, 231 Effect.DefaultOptions);282 MochiKit.Effect.DefaultOptions); 232 283 this.currentFrame = 0; 233 284 this.state = 'idle'; … … 236 287 this.event('beforeStart'); 237 288 if (!this.options.sync) { 238 Effect.Queues.get(typeof(this.options.queue) == 'string' ?289 MochiKit.Effect.Queues.get(typeof(this.options.queue) == 'string' ? 239 290 'global' : this.options.queue.scope).add(this); 240 291 } … … 289 340 cancel: function () { 290 341 if (!this.options.sync) { 291 Effect.Queues.get(typeof(this.options.queue) == 'string' ?342 MochiKit.Effect.Queues.get(typeof(this.options.queue) == 'string' ? 292 343 'global' : this.options.queue.scope).remove(this); 293 344 } … … 304 355 }, 305 356 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) + ']'; 309 360 } 310 361 } 311 362 312 Effect.Parallel = function (effects, options) {363 MochiKit.Effect.Parallel = function (effects, options) { 313 364 this.__init__(effects, options); 314 365 }; 315 366 316 MochiKit.Base.update( Effect.Parallel.prototype,Effect.Base.prototype);317 318 MochiKit.Base.update( Effect.Parallel.prototype, {367 MochiKit.Base.update(MochiKit.Effect.Parallel.prototype, MochiKit.Effect.Base.prototype); 368 369 MochiKit.Base.update(MochiKit.Effect.Parallel.prototype, { 319 370 /*** 320 371 … … 346 397 }); 347 398 348 Effect.Opacity = function (element, options) {399 MochiKit.Effect.Opacity = function (element, options) { 349 400 this.__init__(element, options); 350 401 }; 351 402 352 MochiKit.Base.update( Effect.Opacity.prototype,Effect.Base.prototype);353 354 MochiKit.Base.update( Effect.Opacity.prototype, {403 MochiKit.Base.update(MochiKit.Effect.Opacity.prototype, MochiKit.Effect.Base.prototype); 404 405 MochiKit.Base.update(MochiKit.Effect.Opacity.prototype, { 355 406 /*** 356 407 … … 379 430 }); 380 431 381 Effect.Move = function (element, options) {432 MochiKit.Effect.Move = function (element, options) { 382 433 this.__init__(element, options); 383 434 }; 384 435 385 MochiKit.Base.update( Effect.Move.prototype,Effect.Base.prototype);386 387 MochiKit.Base.update( Effect.Move.prototype, {436 MochiKit.Base.update(MochiKit.Effect.Move.prototype, MochiKit.Effect.Base.prototype); 437 438 MochiKit.Base.update(MochiKit.Effect.Move.prototype, { 388 439 /*** 389 440 … … 428 479 }); 429 480 430 Effect.Scale = function (element, percent, options) {481 MochiKit.Effect.Scale = function (element, percent, options) { 431 482 this.__init__(element, percent, options); 432 483 }; 433 484 434 MochiKit.Base.update( Effect.Scale.prototype,Effect.Base.prototype);435 436 MochiKit.Base.update( Effect.Scale.prototype, {485 MochiKit.Base.update(MochiKit.Effect.Scale.prototype, MochiKit.Effect.Base.prototype); 486 487 MochiKit.Base.update(MochiKit.Effect.Scale.prototype, { 437 488 /*** 438 489 … … 546 597 }); 547 598 548 Effect.Highlight = function (element, options) {599 MochiKit.Effect.Highlight = function (element, options) { 549 600 this.__init__(element, options); 550 601 }; 551 602 552 MochiKit.Base.update( Effect.Highlight.prototype,Effect.Base.prototype);553 554 MochiKit.Base.update( Effect.Highlight.prototype, {603 MochiKit.Base.update(MochiKit.Effect.Highlight.prototype, MochiKit.Effect.Base.prototype); 604 605 MochiKit.Base.update(MochiKit.Effect.Highlight.prototype, { 555 606 /*** 556 607 … … 622 673 }); 623 674 624 Effect.ScrollTo = function (element, options) {675 MochiKit.Effect.ScrollTo = function (element, options) { 625 676 this.__init__(element, options); 626 677 }; 627 678 628 MochiKit.Base.update( Effect.ScrollTo.prototype,Effect.Base.prototype);629 630 MochiKit.Base.update( Effect.ScrollTo.prototype, {679 MochiKit.Base.update(MochiKit.Effect.ScrollTo.prototype, MochiKit.Effect.Base.prototype); 680 681 MochiKit.Base.update(MochiKit.Effect.ScrollTo.prototype, { 631 682 /*** 632 683 … … 672 723 ***/ 673 724 674 Effect.Fade = function (element, options) {725 MochiKit.Effect.Fade = function (element, options) { 675 726 /*** 676 727 … … 692 743 } 693 744 }, 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 748 MochiKit.Effect.Appear = function (element, options) { 698 749 /*** 699 750 … … 712 763 } 713 764 }, 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 768 MochiKit.Effect.Puff = function (element, options) { 718 769 /*** 719 770 … … 739 790 } 740 791 }, 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, 743 794 {sync: true, scaleFromCenter: true, 744 795 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 })], 746 797 options 747 798 ); 748 799 }; 749 800 750 Effect.BlindUp = function (element, options) {801 MochiKit.Effect.BlindUp = function (element, options) { 751 802 /*** 752 803 … … 766 817 }, options || {}); 767 818 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 822 MochiKit.Effect.BlindDown = function (element, options) { 772 823 /*** 773 824 … … 795 846 } 796 847 }, 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 851 MochiKit.Effect.SwitchOff = function (element) { 801 852 /*** 802 853 … … 823 874 } 824 875 }; 825 return new Effect.Appear(element, {876 return new MochiKit.Effect.Appear(element, { 826 877 duration: 0.4, 827 878 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) 831 882 } 832 883 }); 833 884 }; 834 885 835 Effect.DropOut = function (element, options) {886 MochiKit.Effect.DropOut = function (element, options) { 836 887 /*** 837 888 … … 857 908 } 858 909 }, 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})], 862 913 options); 863 914 }; 864 915 865 Effect.Shake = function (element) {916 MochiKit.Effect.Shake = function (element) { 866 917 /*** 867 918 … … 873 924 top: MochiKit.DOM.getStyle(element, 'top'), 874 925 left: MochiKit.DOM.getStyle(element, 'left') }; 875 return new Effect.Move(element,926 return new MochiKit.Effect.Move(element, 876 927 {x: 20, y: 0, duration: 0.05, afterFinishInternal: function (effect) { 877 new Effect.Move(effect.element,928 new MochiKit.Effect.Move(effect.element, 878 929 {x: -40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 879 new Effect.Move(effect.element,930 new MochiKit.Effect.Move(effect.element, 880 931 {x: 40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 881 new Effect.Move(effect.element,932 new MochiKit.Effect.Move(effect.element, 882 933 {x: -40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 883 new Effect.Move(effect.element,934 new MochiKit.Effect.Move(effect.element, 884 935 {x: 40, y: 0, duration: 0.1, afterFinishInternal: function (effect) { 885 new Effect.Move(effect.element,936 new MochiKit.Effect.Move(effect.element, 886 937 {x: -20, y: 0, duration: 0.05, afterFinishInternal: function (effect) { 887 938 MochiKit.DOM.undoPositioned(effect.element); … … 890 941 }; 891 942 892 Effect.SlideDown = function (element, options) {943 MochiKit.Effect.SlideDown = function (element, options) { 893 944 /*** 894 945 … … 932 983 }, options || {}); 933 984 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 988 MochiKit.Effect.SlideUp = function (element, options) { 938 989 /*** 939 990 … … 973 1024 } 974 1025 }, options || {}); 975 return new Effect.Scale(element, 0, options);1026 return new MochiKit.Effect.Scale(element, 0, options); 976 1027 }; 977 1028 978 1029 // Bug in opera makes the TD containing this element expand for a instance 979 1030 // after finish 980 Effect.Squish = function (element, options) {1031 MochiKit.Effect.Squish = function (element, options) { 981 1032 /*** 982 1033 … … 995 1046 }, options || {}); 996 1047 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 1051 MochiKit.Effect.Grow = function (element, options) { 1001 1052 /*** 1002 1053 … … 1008 1059 options = MochiKit.Base.update({ 1009 1060 direction: 'center', 1010 moveTransistion: Effect.Transitions.sinoidal,1011 scaleTransition: Effect.Transitions.sinoidal,1012 opacityTransition: Effect.Transitions.full1061 moveTransistion: MochiKit.Effect.Transitions.sinoidal, 1062 scaleTransition: MochiKit.Effect.Transitions.sinoidal, 1063 opacityTransition: MochiKit.Effect.Transitions.full 1013 1064 }, options || {}); 1014 1065 var oldStyle = { … … 1063 1114 }, options || {}); 1064 1115 1065 return new Effect.Move(element, {1116 return new MochiKit.Effect.Move(element, { 1066 1117 x: initialMoveX, 1067 1118 y: initialMoveY, … … 1073 1124 }, 1074 1125 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, { 1077 1128 sync: true, to: 1.0, from: 0.0, 1078 1129 transition: options.opacityTransition 1079 1130 }), 1080 new Effect.Move(effect.element, {1131 new MochiKit.Effect.Move(effect.element, { 1081 1132 x: moveX, y: moveY, sync: true, 1082 1133 transition: options.moveTransition 1083 1134 }), 1084 new Effect.Scale(effect.element, 100, {1135 new MochiKit.Effect.Scale(effect.element, 100, { 1085 1136 scaleMode: {originalHeight: dims.h, 1086 1137 originalWidth: dims.w}, … … 1096 1147 }; 1097 1148 1098 Effect.Shrink = function (element, options) {1149 MochiKit.Effect.Shrink = function (element, options) { 1099 1150 /*** 1100 1151 … … 1105 1156 options = MochiKit.Base.update({ 1106 1157 direction: 'center', 1107 moveTransistion: Effect.Transitions.sinoidal,1108 scaleTransition: Effect.Transitions.sinoidal,1109 opacityTransition: Effect.Transitions.none1158 moveTransistion: MochiKit.Effect.Transitions.sinoidal, 1159 scaleTransition: MochiKit.Effect.Transitions.sinoidal, 1160 opacityTransition: MochiKit.Effect.Transitions.none 1110 1161 }, options || {}); 1111 1162 var oldStyle = { … … 1154 1205 }, options || {}); 1155 1206 1156 return new Effect.Parallel(1157 [new Effect.Opacity(element, {1207 return new MochiKit.Effect.Parallel( 1208 [new MochiKit.Effect.Opacity(element, { 1158 1209 sync: true, to: 0.0, from: 1.0, 1159 1210 transition: options.opacityTransition 1160 1211 }), 1161 new Effect.Scale(element, MochiKit.Base.isOpera() ? 1 : 0, {1212 new MochiKit.Effect.Scale(element, MochiKit.Base.isOpera() ? 1 : 0, { 1162 1213 sync: true, transition: options.scaleTransition, 1163 1214 restoreAfterFinish: true 1164 1215 }), 1165 new Effect.Move(element, {1216 new MochiKit.Effect.Move(element, { 1166 1217 x: moveX, y: moveY, sync: true, transition: options.moveTransition 1167 1218 }) … … 1170 1221 }; 1171 1222 1172 Effect.Pulsate = function (element, options) {1223 MochiKit.Effect.Pulsate = function (element, options) { 1173 1224 /*** 1174 1225 … … 1185 1236 }, options || {}); 1186 1237 var oldOpacity = MochiKit.DOM.getInlineOpacity(element); 1187 var transition = options.transition || Effect.Transitions.sinoidal;1238 var transition = options.transition || MochiKit.Effect.Transitions.sinoidal; 1188 1239 var reverser = MochiKit.Base.bind(function (pos) { 1189 return transition(1 - Effect.Transitions.pulse(pos));1240 return transition(1 - MochiKit.Effect.Transitions.pulse(pos)); 1190 1241 }, transition); 1191 1242 MochiKit.Base.bind(reverser, transition); 1192 return new Effect.Opacity(element, MochiKit.Base.update({1243 return new MochiKit.Effect.Opacity(element, MochiKit.Base.update({ 1193 1244 transition: reverser}, options)); 1194 1245 }; 1195 1246 1196 Effect.Fold = function (element, options) {1247 MochiKit.Effect.Fold = function (element, options) { 1197 1248 /*** 1198 1249 … … 1212 1263 scaleX: false, 1213 1264 afterFinishInternal: function (effect) { 1214 new Effect.Scale(element, 1, {1265 new MochiKit.Effect.Scale(element, 1, { 1215 1266 scaleContent: false, 1216 1267 scaleY: false, … … 1223 1274 } 1224 1275 }, 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 11 11 } 12 12 13 var camelizedString = str.indexOf('-') == 013 var camelizedString = str.indexOf('-') === 0 14 14 ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) 15 15 : oStringList[0]; … … 543 543 if (parameter) { 544 544 var key = encodeURIComponent(parameter[0]); 545 if (key.length == 0) {545 if (key.length === 0) { 546 546 return; 547 547 } … … 669 669 responseIsSuccess: function () { 670 670 return this.transport.status == undefined 671 || this.transport.status == 0671 || this.transport.status === 0 672 672 || (this.transport.status >= 200 && this.transport.status < 300); 673 673 },
