Skip to content
This repository
Browse code

Update to script.aculo.us 1.6

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 34db8e8939510fcdc5ad14f482b1dc9561e3326c 1 parent 91ea353
Thomas Fuchs authored March 26, 2006
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Update to script.aculo.us 1.6 [Thomas Fuchs]
  4
+
3 5
 * Enable application/x-yaml processing by default [Jamis Buck]
4 6
 
5 7
 * Fix double url escaping of remote_function. Add :escape => false option to ActionView's url_for. [Nicholas Seckar]
73  actionpack/lib/action_view/helpers/javascripts/dragdrop.js
@@ -212,7 +212,8 @@ Draggable.prototype = {
212 212
     if(!this.handle) this.handle = $(options.handle);
213 213
     if(!this.handle) this.handle = this.element;
214 214
     
215  
-    if(options.scroll) options.scroll = $(options.scroll);
  215
+    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML)
  216
+      options.scroll = $(options.scroll);
216 217
 
217 218
     Element.makePositioned(this.element); // fix IE    
218 219
 
@@ -277,8 +278,14 @@ Draggable.prototype = {
277 278
     }
278 279
     
279 280
     if(this.options.scroll) {
280  
-      this.originalScrollLeft = this.options.scroll.scrollLeft;
281  
-      this.originalScrollTop = this.options.scroll.scrollTop;
  281
+      if (this.options.scroll == window) {
  282
+        var where = this._getWindowScroll(this.options.scroll);
  283
+        this.originalScrollLeft = where.left;
  284
+        this.originalScrollTop = where.top;
  285
+      } else {
  286
+        this.originalScrollLeft = this.options.scroll.scrollLeft;
  287
+        this.originalScrollTop = this.options.scroll.scrollTop;
  288
+      }
282 289
     }
283 290
     
284 291
     Draggables.notify('onStart', this, event);
@@ -294,13 +301,18 @@ Draggable.prototype = {
294 301
     if(this.options.change) this.options.change(this);
295 302
     
296 303
     if(this.options.scroll) {
297  
-      //if(this.scrollInterval) this.scroll();
298 304
       this.stopScrolling();
299  
-      var p = Position.page(this.options.scroll);
300  
-      p[0] += this.options.scroll.scrollLeft;
301  
-      p[1] += this.options.scroll.scrollTop;
302  
-      p.push(p[0]+this.options.scroll.offsetWidth);
303  
-      p.push(p[1]+this.options.scroll.offsetHeight);
  305
+      
  306
+      var p;
  307
+      if (this.options.scroll == window) {
  308
+        with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
  309
+      } else {
  310
+        p = Position.page(this.options.scroll);
  311
+        p[0] += this.options.scroll.scrollLeft;
  312
+        p[1] += this.options.scroll.scrollTop;
  313
+        p.push(p[0]+this.options.scroll.offsetWidth);
  314
+        p.push(p[1]+this.options.scroll.offsetHeight);
  315
+      }
304 316
       var speed = [0,0];
305 317
       if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
306 318
       if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
@@ -366,7 +378,7 @@ Draggable.prototype = {
366 378
     var d = this.currentDelta();
367 379
     pos[0] -= d[0]; pos[1] -= d[1];
368 380
     
369  
-    if(this.options.scroll) {
  381
+    if(this.options.scroll && (this.options.scroll != window)) {
370 382
       pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
371 383
       pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
372 384
     }
@@ -413,8 +425,17 @@ Draggable.prototype = {
413 425
     var current = new Date();
414 426
     var delta = current - this.lastScrolled;
415 427
     this.lastScrolled = current;
416  
-    this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
417  
-    this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
  428
+    if(this.options.scroll == window) {
  429
+      with (this._getWindowScroll(this.options.scroll)) {
  430
+        if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
  431
+          var d = delta / 1000;
  432
+          this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
  433
+        }
  434
+      }
  435
+    } else {
  436
+      this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
  437
+      this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
  438
+    }
418 439
     
419 440
     Position.prepare();
420 441
     Droppables.show(Draggables._lastPointer, this.element);
@@ -422,6 +443,30 @@ Draggable.prototype = {
422 443
     this.draw(Draggables._lastPointer);    
423 444
     
424 445
     if(this.options.change) this.options.change(this);
  446
+  },
  447
+  
  448
+  _getWindowScroll: function(w) {
  449
+    var T, L, W, H;
  450
+    with (w.document) {
  451
+      if (w.document.documentElement && documentElement.scrollTop) {
  452
+        T = documentElement.scrollTop;
  453
+        L = documentElement.scrollLeft;
  454
+      } else if (w.document.body) {
  455
+        T = body.scrollTop;
  456
+        L = body.scrollLeft;
  457
+      }
  458
+      if (w.innerWidth) {
  459
+        W = w.innerWidth;
  460
+        H = w.innerHeight;
  461
+      } else if (w.document.documentElement && documentElement.clientWidth) {
  462
+        W = documentElement.clientWidth;
  463
+        H = documentElement.clientHeight;
  464
+      } else {
  465
+        W = body.offsetWidth;
  466
+        H = body.offsetHeight
  467
+      }
  468
+    }
  469
+    return { top: T, left: L, width: W, height: H };
425 470
   }
426 471
 }
427 472
 
@@ -479,6 +524,8 @@ var Sortable = {
479 524
       hoverclass:  null,
480 525
       ghosting:    false,
481 526
       scroll:      false,
  527
+      scrollSensitivity: 20,
  528
+      scrollSpeed: 15,
482 529
       format:      /^[^_]*_(.*)$/,
483 530
       onChange:    Prototype.emptyFunction,
484 531
       onUpdate:    Prototype.emptyFunction
@@ -491,6 +538,8 @@ var Sortable = {
491 538
     var options_for_draggable = {
492 539
       revert:      true,
493 540
       scroll:      options.scroll,
  541
+      scrollSpeed: options.scrollSpeed,
  542
+      scrollSensitivity: options.scrollSensitivity,
494 543
       ghosting:    options.ghosting,
495 544
       constraint:  options.constraint,
496 545
       handle:      options.handle };
355  actionpack/lib/action_view/helpers/javascripts/effects.js
@@ -6,8 +6,6 @@
6 6
 // 
7 7
 // See scriptaculous.js for full license.  
8 8
 
9  
-/* ------------- element ext -------------- */  
10  
- 
11 9
 // converts rgb() and #xxx to #xxxxxx format,  
12 10
 // returns self (or first argument) if not convertable  
13 11
 String.prototype.parseColor = function() {  
@@ -24,6 +22,8 @@ String.prototype.parseColor = function() {
24 22
   return(color.length==7 ? color : (arguments[0] || this));  
25 23
 }
26 24
 
  25
+/*--------------------------------------------------------------------------*/
  26
+
27 27
 Element.collectTextNodes = function(element) {  
28 28
   return $A($(element).childNodes).collect( function(node) {
29 29
     return (node.nodeType==3 ? node.nodeValue : 
@@ -39,14 +39,10 @@ Element.collectTextNodesIgnoreClass = function(element, className) {
39 39
   }).flatten().join('');
40 40
 }
41 41
 
42  
-Element.setStyle = function(element, style) {
43  
-  element = $(element);
44  
-  for(k in style) element.style[k.camelize()] = style[k];
45  
-}
46  
-
47  
-Element.setContentZoom = function(element, percent) {  
  42
+Element.setContentZoom = function(element, percent) {
  43
+  element = $(element);  
48 44
   Element.setStyle(element, {fontSize: (percent/100) + 'em'});   
49  
-  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);  
  45
+  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
50 46
 }
51 47
 
52 48
 Element.getOpacity = function(element){  
@@ -73,7 +69,7 @@ Element.setOpacity = function(element, value){
73 69
      Element.setStyle(element, 
74 70
        { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
75 71
                  'alpha(opacity='+value*100+')' });  
76  
-  }   
  72
+  }
77 73
 }  
78 74
  
79 75
 Element.getInlineOpacity = function(element){  
@@ -91,8 +87,15 @@ Element.forceRerendering = function(element) {
91 87
     var n = document.createTextNode(' ');
92 88
     element.appendChild(n);
93 89
     element.removeChild(n);
94  
-  } catch(e) {}
95  
-}
  90
+  } catch(e) { }
  91
+};
  92
+
  93
+['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
  94
+ 'collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each( 
  95
+  function(f) { Element.Methods[f] = Element[f]; } 
  96
+);
  97
+
  98
+/*--------------------------------------------------------------------------*/
96 99
 
97 100
 Array.prototype.call = function() {
98 101
   var args = arguments;
@@ -148,7 +151,7 @@ var Effect = {
148 151
     var options = Object.extend({
149 152
       queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
150 153
     }, arguments[2] || {});
151  
-    Effect[Element.visible(element) ? 
  154
+    Effect[element.visible() ? 
152 155
       Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
153 156
   }
154 157
 };
@@ -352,15 +355,15 @@ Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
352 355
     this.element = $(element);
353 356
     // make this work on IE on elements without 'layout'
354 357
     if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
355  
-      Element.setStyle(this.element, {zoom: 1});
  358
+      this.element.setStyle({zoom: 1});
356 359
     var options = Object.extend({
357  
-      from: Element.getOpacity(this.element) || 0.0,
  360
+      from: this.element.getOpacity() || 0.0,
358 361
       to:   1.0
359 362
     }, arguments[1] || {});
360 363
     this.start(options);
361 364
   },
362 365
   update: function(position) {
363  
-    Element.setOpacity(this.element, position);
  366
+    this.element.setOpacity(position);
364 367
   }
365 368
 });
366 369
 
@@ -380,9 +383,9 @@ Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
380 383
     // relative element that does not have top/left explicitly set.
381 384
     // ==> Always set top and left for position relative elements in your stylesheets 
382 385
     // (to 0 if you do not need them) 
383  
-    Element.makePositioned(this.element);
384  
-    this.originalLeft = parseFloat(Element.getStyle(this.element,'left') || '0');
385  
-    this.originalTop  = parseFloat(Element.getStyle(this.element,'top')  || '0');
  386
+    this.element.makePositioned();
  387
+    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
  388
+    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
386 389
     if(this.options.mode == 'absolute') {
387 390
       // absolute movement, so we need to calc deltaX and deltaY
388 391
       this.options.x = this.options.x - this.originalLeft;
@@ -390,7 +393,7 @@ Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
390 393
     }
391 394
   },
392 395
   update: function(position) {
393  
-    Element.setStyle(this.element, {
  396
+    this.element.setStyle({
394 397
       left: this.options.x  * position + this.originalLeft + 'px',
395 398
       top:  this.options.y  * position + this.originalTop  + 'px'
396 399
     });
@@ -420,7 +423,7 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
420 423
   },
421 424
   setup: function() {
422 425
     this.restoreAfterFinish = this.options.restoreAfterFinish || false;
423  
-    this.elementPositioning = Element.getStyle(this.element,'position');
  426
+    this.elementPositioning = this.element.getStyle('position');
424 427
     
425 428
     this.originalStyle = {};
426 429
     ['top','left','width','height','fontSize'].each( function(k) {
@@ -430,7 +433,7 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
430 433
     this.originalTop  = this.element.offsetTop;
431 434
     this.originalLeft = this.element.offsetLeft;
432 435
     
433  
-    var fontSize = Element.getStyle(this.element,'font-size') || '100%';
  436
+    var fontSize = this.element.getStyle('font-size') || '100%';
434 437
     ['em','px','%'].each( function(fontSizeType) {
435 438
       if(fontSize.indexOf(fontSizeType)>0) {
436 439
         this.fontSize     = parseFloat(fontSize);
@@ -452,11 +455,11 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
452 455
   update: function(position) {
453 456
     var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
454 457
     if(this.options.scaleContent && this.fontSize)
455  
-      Element.setStyle(this.element, {fontSize: this.fontSize * currentScale + this.fontSizeType });
  458
+      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
456 459
     this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
457 460
   },
458 461
   finish: function(position) {
459  
-    if (this.restoreAfterFinish) Element.setStyle(this.element, this.originalStyle);
  462
+    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
460 463
   },
461 464
   setDimensions: function(height, width) {
462 465
     var d = {};
@@ -473,7 +476,7 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
473 476
         if(this.options.scaleX) d.left = -leftd + 'px';
474 477
       }
475 478
     }
476  
-    Element.setStyle(this.element, d);
  479
+    this.element.setStyle(d);
477 480
   }
478 481
 });
479 482
 
@@ -486,25 +489,25 @@ Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype),
486 489
   },
487 490
   setup: function() {
488 491
     // Prevent executing on elements not in the layout flow
489  
-    if(Element.getStyle(this.element, 'display')=='none') { this.cancel(); return; }
  492
+    if(this.element.getStyle('display')=='none') { this.cancel(); return; }
490 493
     // Disable background image during the effect
491 494
     this.oldStyle = {
492  
-      backgroundImage: Element.getStyle(this.element, 'background-image') };
493  
-    Element.setStyle(this.element, {backgroundImage: 'none'});
  495
+      backgroundImage: this.element.getStyle('background-image') };
  496
+    this.element.setStyle({backgroundImage: 'none'});
494 497
     if(!this.options.endcolor)
495  
-      this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff');
  498
+      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
496 499
     if(!this.options.restorecolor)
497  
-      this.options.restorecolor = Element.getStyle(this.element, 'background-color');
  500
+      this.options.restorecolor = this.element.getStyle('background-color');
498 501
     // init color calculations
499 502
     this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
500 503
     this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
501 504
   },
502 505
   update: function(position) {
503  
-    Element.setStyle(this.element,{backgroundColor: $R(0,2).inject('#',function(m,v,i){
  506
+    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
504 507
       return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
505 508
   },
506 509
   finish: function() {
507  
-    Element.setStyle(this.element, Object.extend(this.oldStyle, {
  510
+    this.element.setStyle(Object.extend(this.oldStyle, {
508 511
       backgroundColor: this.options.restorecolor
509 512
     }));
510 513
   }
@@ -538,79 +541,82 @@ Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
538 541
 /* ------------- combination effects ------------- */
539 542
 
540 543
 Effect.Fade = function(element) {
541  
-  var oldOpacity = Element.getInlineOpacity(element);
  544
+  element = $(element);
  545
+  var oldOpacity = element.getInlineOpacity();
542 546
   var options = Object.extend({
543  
-  from: Element.getOpacity(element) || 1.0,
  547
+  from: element.getOpacity() || 1.0,
544 548
   to:   0.0,
545  
-  afterFinishInternal: function(effect) { with(Element) { 
  549
+  afterFinishInternal: function(effect) { 
546 550
     if(effect.options.to!=0) return;
547  
-    hide(effect.element);
548  
-    setStyle(effect.element, {opacity: oldOpacity}); }}
549  
-  }, arguments[1] || {});
  551
+    effect.element.hide();
  552
+    effect.element.setStyle({opacity: oldOpacity}); 
  553
+  }}, arguments[1] || {});
550 554
   return new Effect.Opacity(element,options);
551 555
 }
552 556
 
553 557
 Effect.Appear = function(element) {
  558
+  element = $(element);
554 559
   var options = Object.extend({
555  
-  from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0),
  560
+  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
556 561
   to:   1.0,
557 562
   // force Safari to render floated elements properly
558 563
   afterFinishInternal: function(effect) {
559  
-    Element.forceRerendering(effect.element);
  564
+    effect.element.forceRerendering();
560 565
   },
561  
-  beforeSetup: function(effect) { with(Element) {
562  
-    setOpacity(effect.element, effect.options.from);
563  
-    show(effect.element); }}
564  
-  }, arguments[1] || {});
  566
+  beforeSetup: function(effect) {
  567
+    effect.element.setOpacity(effect.options.from);
  568
+    effect.element.show(); 
  569
+  }}, arguments[1] || {});
565 570
   return new Effect.Opacity(element,options);
566 571
 }
567 572
 
568 573
 Effect.Puff = function(element) {
569 574
   element = $(element);
570  
-  var oldStyle = { opacity: Element.getInlineOpacity(element), position: Element.getStyle(element, 'position') };
  575
+  var oldStyle = { opacity: element.getInlineOpacity(), position: element.getStyle('position') };
571 576
   return new Effect.Parallel(
572 577
    [ new Effect.Scale(element, 200, 
573 578
       { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
574 579
      new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
575 580
      Object.extend({ duration: 1.0, 
576  
-      beforeSetupInternal: function(effect) { with(Element) {
577  
-        setStyle(effect.effects[0].element, {position: 'absolute'}); }},
578  
-      afterFinishInternal: function(effect) { with(Element) {
579  
-         hide(effect.effects[0].element);
580  
-         setStyle(effect.effects[0].element, oldStyle); }}
  581
+      beforeSetupInternal: function(effect) {
  582
+        effect.effects[0].element.setStyle({position: 'absolute'}); },
  583
+      afterFinishInternal: function(effect) {
  584
+         effect.effects[0].element.hide().setStyle(oldStyle); }
581 585
      }, arguments[1] || {})
582 586
    );
583 587
 }
584 588
 
585 589
 Effect.BlindUp = function(element) {
586 590
   element = $(element);
587  
-  Element.makeClipping(element);
  591
+  element.makeClipping();
588 592
   return new Effect.Scale(element, 0, 
589 593
     Object.extend({ scaleContent: false, 
590 594
       scaleX: false, 
591 595
       restoreAfterFinish: true,
592  
-      afterFinishInternal: function(effect) { with(Element) {
593  
-        [hide, undoClipping].call(effect.element); }} 
  596
+      afterFinishInternal: function(effect) {
  597
+        effect.element.hide();
  598
+        effect.element.undoClipping();
  599
+      } 
594 600
     }, arguments[1] || {})
595 601
   );
596 602
 }
597 603
 
598 604
 Effect.BlindDown = function(element) {
599 605
   element = $(element);
600  
-  var elementDimensions = Element.getDimensions(element);
  606
+  var elementDimensions = element.getDimensions();
601 607
   return new Effect.Scale(element, 100, 
602 608
     Object.extend({ scaleContent: false, 
603 609
       scaleX: false,
604 610
       scaleFrom: 0,
605 611
       scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
606 612
       restoreAfterFinish: true,
607  
-      afterSetup: function(effect) { with(Element) {
608  
-        makeClipping(effect.element);
609  
-        setStyle(effect.element, {height: '0px'});
610  
-        show(effect.element); 
611  
-      }},  
  613
+      afterSetup: function(effect) {
  614
+        effect.element.makeClipping();
  615
+        effect.element.setStyle({height: '0px'});
  616
+        effect.element.show(); 
  617
+      },  
612 618
       afterFinishInternal: function(effect) {
613  
-        Element.undoClipping(effect.element);
  619
+        effect.element.undoClipping();
614 620
       }
615 621
     }, arguments[1] || {})
616 622
   );
@@ -618,7 +624,7 @@ Effect.BlindDown = function(element) {
618 624
 
619 625
 Effect.SwitchOff = function(element) {
620 626
   element = $(element);
621  
-  var oldOpacity = Element.getInlineOpacity(element);
  627
+  var oldOpacity = element.getInlineOpacity();
622 628
   return new Effect.Appear(element, { 
623 629
     duration: 0.4,
624 630
     from: 0,
@@ -627,13 +633,16 @@ Effect.SwitchOff = function(element) {
627 633
       new Effect.Scale(effect.element, 1, { 
628 634
         duration: 0.3, scaleFromCenter: true,
629 635
         scaleX: false, scaleContent: false, restoreAfterFinish: true,
630  
-        beforeSetup: function(effect) { with(Element) {
631  
-          [makePositioned,makeClipping].call(effect.element);
632  
-        }},
633  
-        afterFinishInternal: function(effect) { with(Element) {
634  
-          [hide,undoClipping,undoPositioned].call(effect.element);
635  
-          setStyle(effect.element, {opacity: oldOpacity});
636  
-        }}
  636
+        beforeSetup: function(effect) { 
  637
+          effect.element.makePositioned();
  638
+          effect.element.makeClipping();
  639
+        },
  640
+        afterFinishInternal: function(effect) {
  641
+          effect.element.hide();
  642
+          effect.element.undoClipping();
  643
+          effect.element.undoPositionend();
  644
+          effect.element.setStyle({opacity: oldOpacity});
  645
+        }
637 646
       })
638 647
     }
639 648
   });
@@ -642,105 +651,110 @@ Effect.SwitchOff = function(element) {
642 651
 Effect.DropOut = function(element) {
643 652
   element = $(element);
644 653
   var oldStyle = {
645  
-    top: Element.getStyle(element, 'top'),
646  
-    left: Element.getStyle(element, 'left'),
647  
-    opacity: Element.getInlineOpacity(element) };
  654
+    top: element.getStyle('top'),
  655
+    left: element.getStyle('left'),
  656
+    opacity: element.getInlineOpacity() };
648 657
   return new Effect.Parallel(
649 658
     [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
650 659
       new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
651 660
     Object.extend(
652 661
       { duration: 0.5,
653  
-        beforeSetup: function(effect) { with(Element) {
654  
-          makePositioned(effect.effects[0].element); }},
655  
-        afterFinishInternal: function(effect) { with(Element) {
656  
-          [hide, undoPositioned].call(effect.effects[0].element);
657  
-          setStyle(effect.effects[0].element, oldStyle); }} 
  662
+        beforeSetup: function(effect) {
  663
+          effect.effects[0].element.makePositioned(); 
  664
+        },
  665
+        afterFinishInternal: function(effect) {
  666
+          effect.effects[0].element.hide();
  667
+          effect.effects[0].element.undoPositioned();
  668
+          effect.effects[0].element.setStyle(oldStyle);
  669
+        } 
658 670
       }, arguments[1] || {}));
659 671
 }
660 672
 
661 673
 Effect.Shake = function(element) {
662 674
   element = $(element);
663 675
   var oldStyle = {
664  
-    top: Element.getStyle(element, 'top'),
665  
-    left: Element.getStyle(element, 'left') };
666  
-	  return new Effect.Move(element, 
667  
-	    { x:  20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
668  
-	  new Effect.Move(effect.element,
669  
-	    { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
670  
-	  new Effect.Move(effect.element,
671  
-	    { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
672  
-	  new Effect.Move(effect.element,
673  
-	    { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
674  
-	  new Effect.Move(effect.element,
675  
-	    { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
676  
-	  new Effect.Move(effect.element,
677  
-	    { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { with(Element) {
678  
-        undoPositioned(effect.element);
679  
-        setStyle(effect.element, oldStyle);
680  
-  }}}) }}) }}) }}) }}) }});
  676
+    top: element.getStyle('top'),
  677
+    left: element.getStyle('left') };
  678
+    return new Effect.Move(element, 
  679
+      { x:  20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
  680
+    new Effect.Move(effect.element,
  681
+      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
  682
+    new Effect.Move(effect.element,
  683
+      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
  684
+    new Effect.Move(effect.element,
  685
+      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
  686
+    new Effect.Move(effect.element,
  687
+      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
  688
+    new Effect.Move(effect.element,
  689
+      { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
  690
+        effect.element.undoPositioned();
  691
+        effect.element.setStyle(oldStyle);
  692
+  }}) }}) }}) }}) }}) }});
681 693
 }
682 694
 
683 695
 Effect.SlideDown = function(element) {
684 696
   element = $(element);
685  
-  Element.cleanWhitespace(element);
  697
+  element.cleanWhitespace();
686 698
   // SlideDown need to have the content of the element wrapped in a container element with fixed height!
687  
-  var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
688  
-  var elementDimensions = Element.getDimensions(element);
  699
+  var oldInnerBottom = $(element.firstChild).getStyle('bottom');
  700
+  var elementDimensions = element.getDimensions();
689 701
   return new Effect.Scale(element, 100, Object.extend({ 
690 702
     scaleContent: false, 
691 703
     scaleX: false, 
692 704
     scaleFrom: 0,
693 705
     scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
694 706
     restoreAfterFinish: true,
695  
-    afterSetup: function(effect) { with(Element) {
696  
-      makePositioned(effect.element);
697  
-      makePositioned(effect.element.firstChild);
698  
-      if(window.opera) setStyle(effect.element, {top: ''});
699  
-      makeClipping(effect.element);
700  
-      setStyle(effect.element, {height: '0px'});
701  
-      show(element); }},
702  
-    afterUpdateInternal: function(effect) { with(Element) {
703  
-      setStyle(effect.element.firstChild, {bottom:
704  
-        (effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
705  
-    afterFinishInternal: function(effect) { with(Element) {
706  
-      undoClipping(effect.element); 
  707
+    afterSetup: function(effect) {
  708
+      effect.element.makePositioned();
  709
+      effect.element.firstChild.makePositioned();
  710
+      if(window.opera) effect.element.setStyle({top: ''});
  711
+      effect.element.makeClipping();
  712
+      effect.element.setStyle({height: '0px'});
  713
+      effect.element.show(); },
  714
+    afterUpdateInternal: function(effect) {
  715
+      effect.element.firstChild.setStyle({bottom:
  716
+        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
  717
+    },
  718
+    afterFinishInternal: function(effect) {
  719
+      effect.element.undoClipping(); 
707 720
       // IE will crash if child is undoPositioned first
708 721
       if(/MSIE/.test(navigator.userAgent)){
709  
-        undoPositioned(effect.element);
710  
-        undoPositioned(effect.element.firstChild);
  722
+        effect.element.undoPositioned();
  723
+        effect.element.firstChild.undoPositioned();
711 724
       }else{
712  
-        undoPositioned(effect.element.firstChild);
713  
-        undoPositioned(effect.element);
  725
+        effect.element.firstChild.undoPositioned();
  726
+        effect.element.undoPositioned();
714 727
       }
715  
-      setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
  728
+      effect.element.firstChild.setStyle({bottom: oldInnerBottom}); }
716 729
     }, arguments[1] || {})
717 730
   );
718 731
 }
719 732
   
720 733
 Effect.SlideUp = function(element) {
721 734
   element = $(element);
722  
-  Element.cleanWhitespace(element);
723  
-  var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
  735
+  element.cleanWhitespace();
  736
+  var oldInnerBottom = $(element.firstChild).getStyle('bottom');
724 737
   return new Effect.Scale(element, 0, 
725 738
    Object.extend({ scaleContent: false, 
726 739
     scaleX: false, 
727 740
     scaleMode: 'box',
728 741
     scaleFrom: 100,
729 742
     restoreAfterFinish: true,
730  
-    beforeStartInternal: function(effect) { with(Element) {
731  
-      makePositioned(effect.element);
732  
-      makePositioned(effect.element.firstChild);
733  
-      if(window.opera) setStyle(effect.element, {top: ''});
734  
-      makeClipping(effect.element);
735  
-      show(element); }},  
736  
-    afterUpdateInternal: function(effect) { with(Element) {
737  
-      setStyle(effect.element.firstChild, {bottom:
738  
-        (effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
739  
-    afterFinishInternal: function(effect) { with(Element) {
740  
-        [hide, undoClipping].call(effect.element); 
741  
-        undoPositioned(effect.element.firstChild);
742  
-        undoPositioned(effect.element);
743  
-        setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
  743
+    beforeStartInternal: function(effect) {
  744
+      effect.element.makePositioned();
  745
+      effect.element.firstChild.makePositioned();
  746
+      if(window.opera) effect.element.setStyle({top: ''});
  747
+      effect.element.makeClipping();
  748
+      effect.element.show(); },  
  749
+    afterUpdateInternal: function(effect) {
  750
+      effect.element.firstChild.setStyle({bottom:
  751
+        (effect.dims[0] - effect.element.clientHeight) + 'px' }); },
  752
+    afterFinishInternal: function(effect) {
  753
+      effect.element.hide();
  754
+      effect.element.undoClipping();
  755
+      effect.element.firstChild.undoPositioned();
  756
+      effect.element.undoPositioned();
  757
+      effect.element.setStyle({bottom: oldInnerBottom}); }
744 758
    }, arguments[1] || {})
745 759
   );
746 760
 }
@@ -749,11 +763,11 @@ Effect.SlideUp = function(element) {
749 763
 Effect.Squish = function(element) {
750 764
   return new Effect.Scale(element, window.opera ? 1 : 0, 
751 765
     { restoreAfterFinish: true,
752  
-      beforeSetup: function(effect) { with(Element) {
753  
-        makeClipping(effect.element); }},  
754  
-      afterFinishInternal: function(effect) { with(Element) {
755  
-        hide(effect.element); 
756  
-        undoClipping(effect.element); }}
  766
+      beforeSetup: function(effect) {
  767
+        effect.element.makeClipping(effect.element); },  
  768
+      afterFinishInternal: function(effect) {
  769
+        effect.element.hide(effect.element); 
  770
+        effect.element.undoClipping(effect.element); }
757 771
   });
758 772
 }
759 773
 
@@ -770,9 +784,9 @@ Effect.Grow = function(element) {
770 784
     left: element.style.left,
771 785
     height: element.style.height,
772 786
     width: element.style.width,
773  
-    opacity: Element.getInlineOpacity(element) };
  787
+    opacity: element.getInlineOpacity() };
774 788
 
775  
-  var dims = Element.getDimensions(element);    
  789
+  var dims = element.getDimensions();    
776 790
   var initialMoveX, initialMoveY;
777 791
   var moveX, moveY;
778 792
   
@@ -808,11 +822,11 @@ Effect.Grow = function(element) {
808 822
     x: initialMoveX,
809 823
     y: initialMoveY,
810 824
     duration: 0.01, 
811  
-    beforeSetup: function(effect) { with(Element) {
812  
-      hide(effect.element);
813  
-      makeClipping(effect.element);
814  
-      makePositioned(effect.element);
815  
-    }},
  825
+    beforeSetup: function(effect) {
  826
+      effect.element.hide();
  827
+      effect.element.makeClipping();
  828
+      effect.element.makePositioned();
  829
+    },
816 830
     afterFinishInternal: function(effect) {
817 831
       new Effect.Parallel(
818 832
         [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
@@ -821,12 +835,15 @@ Effect.Grow = function(element) {
821 835
             scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
822 836
             sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
823 837
         ], Object.extend({
824  
-             beforeSetup: function(effect) { with(Element) {
825  
-               setStyle(effect.effects[0].element, {height: '0px'});
826  
-               show(effect.effects[0].element); }},
827  
-             afterFinishInternal: function(effect) { with(Element) {
828  
-               [undoClipping, undoPositioned].call(effect.effects[0].element); 
829  
-               setStyle(effect.effects[0].element, oldStyle); }}
  838
+             beforeSetup: function(effect) {
  839
+               effect.effects[0].element.setStyle({height: '0px'});
  840
+               effect.effects[0].element.show(); 
  841
+             },
  842
+             afterFinishInternal: function(effect) {
  843
+               effect.effects[0].element.undoClipping();
  844
+               effect.effects[0].element.undoPositioned();
  845
+               effect.effects[0].element.setStyle(oldStyle); 
  846
+             }
830 847
            }, options)
831 848
       )
832 849
     }
@@ -846,9 +863,9 @@ Effect.Shrink = function(element) {
846 863
     left: element.style.left,
847 864
     height: element.style.height,
848 865
     width: element.style.width,
849  
-    opacity: Element.getInlineOpacity(element) };
  866
+    opacity: element.getInlineOpacity() };
850 867
 
851  
-  var dims = Element.getDimensions(element);
  868
+  var dims = element.getDimensions();
852 869
   var moveX, moveY;
853 870
   
854 871
   switch (options.direction) {
@@ -878,11 +895,14 @@ Effect.Shrink = function(element) {
878 895
       new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
879 896
       new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
880 897
     ], Object.extend({            
881  
-         beforeStartInternal: function(effect) { with(Element) {
882  
-           [makePositioned, makeClipping].call(effect.effects[0].element) }},
883  
-         afterFinishInternal: function(effect) { with(Element) {
884  
-           [hide, undoClipping, undoPositioned].call(effect.effects[0].element);
885  
-           setStyle(effect.effects[0].element, oldStyle); }}
  898
+         beforeStartInternal: function(effect) {
  899
+           effect.effects[0].element.makePositioned();
  900
+           effect.effects[0].element.makeClipping(); },
  901
+         afterFinishInternal: function(effect) {
  902
+           effect.effects[0].element.hide();
  903
+           effect.effects[0].element.undoClipping();
  904
+           effect.effects[0].element.undoPositioned();
  905
+           effect.effects[0].element.setStyle(oldStyle); }
886 906
        }, options)
887 907
   );
888 908
 }
@@ -890,13 +910,13 @@ Effect.Shrink = function(element) {
890 910
 Effect.Pulsate = function(element) {
891 911
   element = $(element);
892 912
   var options    = arguments[1] || {};
893  
-  var oldOpacity = Element.getInlineOpacity(element);
  913
+  var oldOpacity = element.getInlineOpacity();
894 914
   var transition = options.transition || Effect.Transitions.sinoidal;
895 915
   var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
896 916
   reverser.bind(transition);
897 917
   return new Effect.Opacity(element, 
898 918
     Object.extend(Object.extend({  duration: 3.0, from: 0,
899  
-      afterFinishInternal: function(effect) { Element.setStyle(effect.element, {opacity: oldOpacity}); }
  919
+      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
900 920
     }, options), {transition: reverser}));
901 921
 }
902 922
 
@@ -915,18 +935,17 @@ Effect.Fold = function(element) {
915 935
     new Effect.Scale(element, 1, { 
916 936
       scaleContent: false, 
917 937
       scaleY: false,
918  
-      afterFinishInternal: function(effect) { with(Element) {
919  
-        [hide, undoClipping].call(effect.element); 
920  
-        setStyle(effect.element, oldStyle);
921  
-      }} });
  938
+      afterFinishInternal: function(effect) {
  939
+        effect.element.hide();
  940
+        effect.element.undoClipping(); 
  941
+        effect.element.setStyle(oldStyle);
  942
+      } });
922 943
   }}, arguments[1] || {}));
923 944
 }
924 945
 
925  
-if(Element.Methods) {
926  
-  Element.Methods.visualEffect = function(element, effect, options) {
927  
-    s = effect.gsub(/_/, '-').camelize();
928  
-    effect_class = s.charAt(0).toUpperCase() + s.substring(1);
929  
-    new Effect[effect_class](element, options);
930  
-    return $(element);
931  
-  }
932  
-}
  946
+Element.Methods.visualEffect = function(element, effect, options) {
  947
+  s = effect.gsub(/_/, '-').camelize();
  948
+  effect_class = s.charAt(0).toUpperCase() + s.substring(1);
  949
+  new Effect[effect_class](element, options);
  950
+  return $(element);
  951
+};
2  railties/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Update to script.aculo.us 1.6 [Thomas Fuchs]
  4
+
3 5
 * Add an integration_test generator [Jamis Buck]
4 6
 
5 7
 * Make all ActionView helpers available in the console from the helper method for debugging purposes. n.b.: Only an 80% solution. Some stuff won't work, most will. [Marcel Molina Jr.]
2  railties/Rakefile
@@ -83,7 +83,7 @@ end
83 83
 
84 84
 # Make directory structure ----------------------------------------------------------------
85 85
 
86  
-def make_dest_dirs(dirs, path = nil)
  86
+def make_dest_dirs(dirs, path = '')
87 87
   mkdir_p dirs.map { |dir| File.join(PKG_DESTINATION, path, dir) }
88 88
 end
89 89
 
73  railties/html/javascripts/dragdrop.js
@@ -212,7 +212,8 @@ Draggable.prototype = {
212 212
     if(!this.handle) this.handle = $(options.handle);
213 213
     if(!this.handle) this.handle = this.element;
214 214
     
215  
-    if(options.scroll) options.scroll = $(options.scroll);
  215
+    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML)
  216
+      options.scroll = $(options.scroll);
216 217
 
217 218
     Element.makePositioned(this.element); // fix IE    
218 219
 
@@ -277,8 +278,14 @@ Draggable.prototype = {
277 278
     }
278 279
     
279 280
     if(this.options.scroll) {
280  
-      this.originalScrollLeft = this.options.scroll.scrollLeft;
281  
-      this.originalScrollTop = this.options.scroll.scrollTop;
  281
+      if (this.options.scroll == window) {
  282
+        var where = this._getWindowScroll(this.options.scroll);
  283
+        this.originalScrollLeft = where.left;
  284
+        this.originalScrollTop = where.top;
  285
+      } else {
  286
+        this.originalScrollLeft = this.options.scroll.scrollLeft;
  287
+        this.originalScrollTop = this.options.scroll.scrollTop;
  288
+      }
282 289
     }
283 290
     
284 291
     Draggables.notify('onStart', this, event);
@@ -294,13 +301,18 @@ Draggable.prototype = {
294 301
     if(this.options.change) this.options.change(this);
295 302
     
296 303
     if(this.options.scroll) {
297  
-      //if(this.scrollInterval) this.scroll();
298 304
       this.stopScrolling();
299  
-      var p = Position.page(this.options.scroll);
300  
-      p[0] += this.options.scroll.scrollLeft;
301  
-      p[1] += this.options.scroll.scrollTop;
302  
-      p.push(p[0]+this.options.scroll.offsetWidth);
303  
-      p.push(p[1]+this.options.scroll.offsetHeight);
  305
+      
  306
+      var p;
  307
+      if (this.options.scroll == window) {
  308
+        with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
  309
+      } else {
  310
+        p = Position.page(this.options.scroll);
  311
+        p[0] += this.options.scroll.scrollLeft;
  312
+        p[1] += this.options.scroll.scrollTop;
  313
+        p.push(p[0]+this.options.scroll.offsetWidth);
  314
+        p.push(p[1]+this.options.scroll.offsetHeight);
  315
+      }
304 316
       var speed = [0,0];
305 317
       if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
306 318
       if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
@@ -366,7 +378,7 @@ Draggable.prototype = {
366 378
     var d = this.currentDelta();
367 379
     pos[0] -= d[0]; pos[1] -= d[1];
368 380
     
369  
-    if(this.options.scroll) {
  381
+    if(this.options.scroll && (this.options.scroll != window)) {
370 382
       pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
371 383
       pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
372 384
     }
@@ -413,8 +425,17 @@ Draggable.prototype = {
413 425
     var current = new Date();
414 426
     var delta = current - this.lastScrolled;
415 427
     this.lastScrolled = current;
416  
-    this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
417  
-    this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
  428
+    if(this.options.scroll == window) {
  429
+      with (this._getWindowScroll(this.options.scroll)) {
  430
+        if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
  431
+          var d = delta / 1000;
  432
+          this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
  433
+        }
  434
+      }
  435
+    } else {
  436
+      this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
  437
+      this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
  438
+    }
418 439
     
419 440
     Position.prepare();
420 441
     Droppables.show(Draggables._lastPointer, this.element);
@@ -422,6 +443,30 @@ Draggable.prototype = {
422 443
     this.draw(Draggables._lastPointer);    
423 444
     
424 445
     if(this.options.change) this.options.change(this);
  446
+  },
  447
+  
  448
+  _getWindowScroll: function(w) {
  449
+    var T, L, W, H;
  450
+    with (w.document) {
  451
+      if (w.document.documentElement && documentElement.scrollTop) {
  452
+        T = documentElement.scrollTop;
  453
+        L = documentElement.scrollLeft;
  454
+      } else if (w.document.body) {
  455
+        T = body.scrollTop;
  456
+        L = body.scrollLeft;
  457
+      }
  458
+      if (w.innerWidth) {
  459
+        W = w.innerWidth;
  460
+        H = w.innerHeight;
  461
+      } else if (w.document.documentElement && documentElement.clientWidth) {
  462
+        W = documentElement.clientWidth;
  463
+        H = documentElement.clientHeight;
  464
+      } else {
  465
+        W = body.offsetWidth;
  466
+        H = body.offsetHeight
  467
+      }
  468
+    }
  469
+    return { top: T, left: L, width: W, height: H };
425 470
   }
426 471
 }
427 472
 
@@ -479,6 +524,8 @@ var Sortable = {
479 524
       hoverclass:  null,
480 525
       ghosting:    false,
481 526
       scroll:      false,
  527
+      scrollSensitivity: 20,
  528
+      scrollSpeed: 15,
482 529
       format:      /^[^_]*_(.*)$/,
483 530
       onChange:    Prototype.emptyFunction,
484 531
       onUpdate:    Prototype.emptyFunction
@@ -491,6 +538,8 @@ var Sortable = {
491 538
     var options_for_draggable = {
492 539
       revert:      true,
493 540
       scroll:      options.scroll,
  541
+      scrollSpeed: options.scrollSpeed,
  542
+      scrollSensitivity: options.scrollSensitivity,
494 543
       ghosting:    options.ghosting,
495 544
       constraint:  options.constraint,
496 545
       handle:      options.handle };
355  railties/html/javascripts/effects.js
@@ -6,8 +6,6 @@
6 6
 // 
7 7
 // See scriptaculous.js for full license.  
8 8
 
9  
-/* ------------- element ext -------------- */  
10  
- 
11 9
 // converts rgb() and #xxx to #xxxxxx format,  
12 10
 // returns self (or first argument) if not convertable  
13 11
 String.prototype.parseColor = function() {  
@@ -24,6 +22,8 @@ String.prototype.parseColor = function() {
24 22
   return(color.length==7 ? color : (arguments[0] || this));  
25 23
 }
26 24
 
  25
+/*--------------------------------------------------------------------------*/
  26
+
27 27
 Element.collectTextNodes = function(element) {  
28 28
   return $A($(element).childNodes).collect( function(node) {
29 29
     return (node.nodeType==3 ? node.nodeValue : 
@@ -39,14 +39,10 @@ Element.collectTextNodesIgnoreClass = function(element, className) {
39 39
   }).flatten().join('');
40 40
 }
41 41
 
42  
-Element.setStyle = function(element, style) {
43  
-  element = $(element);
44  
-  for(k in style) element.style[k.camelize()] = style[k];
45  
-}
46  
-
47  
-Element.setContentZoom = function(element, percent) {  
  42
+Element.setContentZoom = function(element, percent) {
  43
+  element = $(element);  
48 44
   Element.setStyle(element, {fontSize: (percent/100) + 'em'});   
49  
-  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);  
  45
+  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
50 46
 }
51 47
 
52 48
 Element.getOpacity = function(element){  
@@ -73,7 +69,7 @@ Element.setOpacity = function(element, value){
73 69
      Element.setStyle(element, 
74 70
        { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
75 71
                  'alpha(opacity='+value*100+')' });  
76  
-  }   
  72
+  }
77 73
 }  
78 74
  
79 75
 Element.getInlineOpacity = function(element){  
@@ -91,8 +87,15 @@ Element.forceRerendering = function(element) {
91 87
     var n = document.createTextNode(' ');
92 88
     element.appendChild(n);
93 89
     element.removeChild(n);
94  
-  } catch(e) {}
95  
-}
  90
+  } catch(e) { }
  91
+};
  92
+
  93
+['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
  94
+ 'collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each( 
  95
+  function(f) { Element.Methods[f] = Element[f]; } 
  96
+);
  97
+
  98
+/*--------------------------------------------------------------------------*/
96 99
 
97 100
 Array.prototype.call = function() {
98 101
   var args = arguments;
@@ -148,7 +151,7 @@ var Effect = {
148 151
     var options = Object.extend({
149 152
       queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
150 153
     }, arguments[2] || {});
151  
-    Effect[Element.visible(element) ? 
  154