Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4766

Show
Ignore:
Timestamp:
08/15/06 14:20:55 (2 years ago)
Author:
madrobby
Message:

Updated trunk to script.aculo.us 1.6.2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r4764 r4766  
    11*SVN* 
     2 
     3* Updated to script.aculo.us 1.6.2 [Thomas Fuchs] 
    24 
    35* Relax Routing's anchor pattern warning; it was preventing use of [^/] inside restrictions. [Nicholas Seckar] 
  • trunk/actionpack/lib/action_view/helpers/javascripts/controls.js

    r4053 r4766  
    3333// useful when one of the tokens is \n (a newline), as it  
    3434// allows smart autocompletion after linebreaks. 
     35 
     36if(typeof Effect == 'undefined') 
     37  throw("controls.js requires including script.aculo.us' effects.js library"); 
    3538 
    3639var Autocompleter = {} 
     
    9598   
    9699  fixIEOverlapping: function() { 
    97     Position.clone(this.update, this.iefix); 
     100    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); 
    98101    this.iefix.style.zIndex = 1; 
    99102    this.update.style.zIndex = 2; 
     
    203206    if(this.index > 0) this.index-- 
    204207      else this.index = this.entryCount-1; 
     208    this.getEntry(this.index).scrollIntoView(true); 
    205209  }, 
    206210   
     
    208212    if(this.index < this.entryCount-1) this.index++ 
    209213      else this.index = 0; 
     214    this.getEntry(this.index).scrollIntoView(false); 
    210215  }, 
    211216   
     
    532537    this.createForm(); 
    533538    this.element.parentNode.insertBefore(this.form, this.element); 
    534     Field.scrollFreeActivate(this.editField); 
     539    if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField); 
    535540    // stop the event to avoid a page refresh in Safari 
    536541    if (evt) { 
     
    637642    this.editField.disabled = false; 
    638643    this.editField.value = transport.responseText.stripTags(); 
     644    Field.scrollFreeActivate(this.editField); 
    639645  }, 
    640646  onclickCancel: function() { 
  • trunk/actionpack/lib/action_view/helpers/javascripts/dragdrop.js

    r4122 r4766  
    55 
    66/*--------------------------------------------------------------------------*/ 
     7 
     8if(typeof Effect == 'undefined') 
     9  throw("dragdrop.js requires including script.aculo.us' effects.js library"); 
    710 
    811var Droppables = { 
     
    205208 
    206209var Draggable = Class.create(); 
     210Draggable._revertCache = {}; 
     211Draggable._dragging    = {}; 
     212 
    207213Draggable.prototype = { 
    208214  initialize: function(element) { 
    209215    var options = Object.extend({ 
    210216      handle: false, 
    211       starteffect: function(element) {  
    212         new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7});  
     217      starteffect: function(element) { 
     218        element._opacity = Element.getOpacity(element); 
     219        Draggable._dragging[element] = true; 
     220        new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});  
    213221      }, 
    214222      reverteffect: function(element, top_offset, left_offset) { 
    215223        var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; 
    216         element._revert = new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur}); 
     224        Draggable._revertCache[element] = 
     225          new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, 
     226            queue: {scope:'_draggable', position:'end'} 
     227          }); 
    217228      }, 
    218       endeffect: function(element) {  
    219         new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0});  
     229      endeffect: function(element) { 
     230        var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0; 
     231        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,  
     232          queue: {scope:'_draggable', position:'end'}, 
     233          afterFinish: function(){ Draggable._dragging[element] = false } 
     234        });  
    220235      }, 
    221236      zindex: 1000, 
     
    263278   
    264279  initDrag: function(event) { 
     280    if(typeof Draggable._dragging[this.element] != undefined && 
     281      Draggable._dragging[this.element]) return; 
    265282    if(Event.isLeftClick(event)) {     
    266283      // abort on form elements, fixes a Firefox issue 
     
    273290        src.tagName=='TEXTAREA')) return; 
    274291         
    275       if(this.element._revert) { 
    276         this.element._revert.cancel(); 
    277         this.element._revert = null; 
     292      if(Draggable._revertCache[this.element]) { 
     293        Draggable._revertCache[this.element].cancel(); 
     294        Draggable._revertCache[this.element] = null; 
    278295      } 
    279296       
     
    413430    if(this.options.snap) { 
    414431      if(typeof this.options.snap == 'function') { 
    415         p = this.options.snap(p[0],p[1]); 
     432        p = this.options.snap(p[0],p[1],this); 
    416433      } else { 
    417434      if(this.options.snap instanceof Array) { 
     
    441458   
    442459  startScrolling: function(speed) { 
     460    if(!(speed[0] || speed[1])) return; 
    443461    this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; 
    444462    this.lastScrolled = new Date(); 
     
    707725      var index; 
    708726       
    709       var children = Sortable.findElements(dropon, {tag: droponOptions.tag}); 
     727      var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); 
    710728      var child = null; 
    711729             
     
    868886    if (options.tree) { 
    869887      return Sortable.tree(element, arguments[1]).children.map( function (item) { 
    870         return [name + Sortable._constructIndex(item) + "=" +  
     888        return [name + Sortable._constructIndex(item) + "[id]=" +  
    871889                encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); 
    872890      }).flatten().join('&'); 
  • trunk/actionpack/lib/action_view/helpers/javascripts/effects.js

    r4122 r4766  
    106106var Effect = { 
    107107  tagifyText: function(element) { 
     108    if(typeof Builder == 'undefined') 
     109      throw("Effect.tagifyText requires including script.aculo.us' builder.js library"); 
     110       
    108111    var tagifyStyle = 'position:relative'; 
    109112    if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1'; 
     
    162165Effect.Transitions = {} 
    163166 
    164 Effect.Transitions.linear = function(pos) { 
    165   return pos; 
    166 
     167Effect.Transitions.linear = Prototype.K; 
     168 
    167169Effect.Transitions.sinoidal = function(pos) { 
    168170  return (-Math.cos(pos*Math.PI)/2) + 0.5; 
     
    354356    this.element = $(element); 
    355357    // make this work on IE on elements without 'layout' 
    356     if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout)) 
     358    if(/MSIE/.test(navigator.userAgent) && (!this.element.currentStyle.hasLayout)) 
    357359      this.element.setStyle({zoom: 1}); 
    358360    var options = Object.extend({ 
     
    394396  update: function(position) { 
    395397    this.element.setStyle({ 
    396       left: this.options.x  * position + this.originalLeft + 'px', 
    397       top:  this.options.y  * position + this.originalTop  + 'px' 
     398      left: Math.round(this.options.x  * position + this.originalLeft) + 'px', 
     399      top:  Math.round(this.options.y  * position + this.originalTop)  + 'px' 
    398400    }); 
    399401  } 
     
    434436     
    435437    var fontSize = this.element.getStyle('font-size') || '100%'; 
    436     ['em','px','%'].each( function(fontSizeType) { 
     438    ['em','px','%','pt'].each( function(fontSizeType) { 
    437439      if(fontSize.indexOf(fontSizeType)>0) { 
    438440        this.fontSize     = parseFloat(fontSize); 
     
    463465  setDimensions: function(height, width) { 
    464466    var d = {}; 
    465     if(this.options.scaleX) d.width = width + 'px'; 
    466     if(this.options.scaleY) d.height = height + 'px'; 
     467    if(this.options.scaleX) d.width = Math.round(width) + 'px'; 
     468    if(this.options.scaleY) d.height = Math.round(height) + 'px'; 
    467469    if(this.options.scaleFromCenter) { 
    468470      var topd  = (height - this.dims[0])/2; 
     
    590592  element = $(element); 
    591593  element.makeClipping(); 
    592   return new Effect.Scale(element, 0,  
     594  return new Effect.Scale(element, 0, 
    593595    Object.extend({ scaleContent: false,  
    594596      scaleX: false,  
     
    605607  element = $(element); 
    606608  var elementDimensions = element.getDimensions(); 
    607   return new Effect.Scale(element, 100,  
    608     Object.extend({ scaleContent: false,  
    609       scaleX: false, 
    610       scaleFrom: 0, 
    611       scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 
    612       restoreAfterFinish: true, 
    613       afterSetup: function(effect) { 
    614         effect.element.makeClipping(); 
    615         effect.element.setStyle({height: '0px'}); 
    616         effect.element.show();  
    617       },   
    618       afterFinishInternal: function(effect) { 
    619         effect.element.undoClipping(); 
    620       } 
    621     }, arguments[1] || {}) 
    622   ); 
     609  return new Effect.Scale(element, 100, Object.extend({  
     610    scaleContent: false,  
     611    scaleX: false, 
     612    scaleFrom: 0, 
     613    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 
     614    restoreAfterFinish: true, 
     615    afterSetup: function(effect) { 
     616      effect.element.makeClipping(); 
     617      effect.element.setStyle({height: '0px'}); 
     618      effect.element.show();  
     619    },   
     620    afterFinishInternal: function(effect) { 
     621      effect.element.undoClipping(); 
     622    } 
     623  }, arguments[1] || {})); 
    623624} 
    624625 
     
    626627  element = $(element); 
    627628  var oldOpacity = element.getInlineOpacity(); 
    628   return new Effect.Appear(element, {  
     629  return new Effect.Appear(element, Object.extend({ 
    629630    duration: 0.4, 
    630631    from: 0, 
     
    646647      }) 
    647648    } 
    648   }); 
     649  }, arguments[1] || {})); 
    649650} 
    650651 
     
    702703    scaleContent: false,  
    703704    scaleX: false,  
    704     scaleFrom: 0
     705    scaleFrom: window.opera ? 0 : 1
    705706    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 
    706707    restoreAfterFinish: true, 
     
    730731  ); 
    731732} 
    732    
     733 
    733734Effect.SlideUp = function(element) { 
    734735  element = $(element); 
    735736  element.cleanWhitespace(); 
    736737  var oldInnerBottom = $(element.firstChild).getStyle('bottom'); 
    737   return new Effect.Scale(element, 0,  
     738  return new Effect.Scale(element, window.opera ? 0 : 1, 
    738739   Object.extend({ scaleContent: false,  
    739740    scaleX: false,  
  • trunk/railties/CHANGELOG

    r4762 r4766  
    11*SVN* 
     2 
     3* Updated to script.aculo.us 1.6.2 [Thomas Fuchs] 
    24 
    35* Assign Routing.controller_paths; fix script/about and rails info controller. [Nicholas Seckar] 
  • trunk/railties/html/javascripts/controls.js

    r4053 r4766  
    3333// useful when one of the tokens is \n (a newline), as it  
    3434// allows smart autocompletion after linebreaks. 
     35 
     36if(typeof Effect == 'undefined') 
     37  throw("controls.js requires including script.aculo.us' effects.js library"); 
    3538 
    3639var Autocompleter = {} 
     
    9598   
    9699  fixIEOverlapping: function() { 
    97     Position.clone(this.update, this.iefix); 
     100    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); 
    98101    this.iefix.style.zIndex = 1; 
    99102    this.update.style.zIndex = 2; 
     
    203206    if(this.index > 0) this.index-- 
    204207      else this.index = this.entryCount-1; 
     208    this.getEntry(this.index).scrollIntoView(true); 
    205209  }, 
    206210   
     
    208212    if(this.index < this.entryCount-1) this.index++ 
    209213      else this.index = 0; 
     214    this.getEntry(this.index).scrollIntoView(false); 
    210215  }, 
    211216   
     
    532537    this.createForm(); 
    533538    this.element.parentNode.insertBefore(this.form, this.element); 
    534     Field.scrollFreeActivate(this.editField); 
     539    if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField); 
    535540    // stop the event to avoid a page refresh in Safari 
    536541    if (evt) { 
     
    637642    this.editField.disabled = false; 
    638643    this.editField.value = transport.responseText.stripTags(); 
     644    Field.scrollFreeActivate(this.editField); 
    639645  }, 
    640646  onclickCancel: function() { 
  • trunk/railties/html/javascripts/dragdrop.js

    r4122 r4766  
    55 
    66/*--------------------------------------------------------------------------*/ 
     7 
     8if(typeof Effect == 'undefined') 
     9  throw("dragdrop.js requires including script.aculo.us' effects.js library"); 
    710 
    811var Droppables = { 
     
    205208 
    206209var Draggable = Class.create(); 
     210Draggable._revertCache = {}; 
     211Draggable._dragging    = {}; 
     212 
    207213Draggable.prototype = { 
    208214  initialize: function(element) { 
    209215    var options = Object.extend({ 
    210216      handle: false, 
    211       starteffect: function(element) {  
    212         new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7});  
     217      starteffect: function(element) { 
     218        element._opacity = Element.getOpacity(element); 
     219        Draggable._dragging[element] = true; 
     220        new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});  
    213221      }, 
    214222      reverteffect: function(element, top_offset, left_offset) { 
    215223        var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; 
    216         element._revert = new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur}); 
     224        Draggable._revertCache[element] = 
     225          new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, 
     226            queue: {scope:'_draggable', position:'end'} 
     227          }); 
    217228      }, 
    218       endeffect: function(element) {  
    219         new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0});  
     229      endeffect: function(element) { 
     230        var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0; 
     231        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,  
     232          queue: {scope:'_draggable', position:'end'}, 
     233          afterFinish: function(){ Draggable._dragging[element] = false } 
     234        });  
    220235      }, 
    221236      zindex: 1000, 
     
    263278   
    264279  initDrag: function(event) { 
     280    if(typeof Draggable._dragging[this.element] != undefined && 
     281      Draggable._dragging[this.element]) return; 
    265282    if(Event.isLeftClick(event)) {     
    266283      // abort on form elements, fixes a Firefox issue 
     
    273290        src.tagName=='TEXTAREA')) return; 
    274291         
    275       if(this.element._revert) { 
    276         this.element._revert.cancel(); 
    277         this.element._revert = null; 
     292      if(Draggable._revertCache[this.element]) { 
     293        Draggable._revertCache[this.element].cancel(); 
     294        Draggable._revertCache[this.element] = null; 
    278295      } 
    279296       
     
    413430    if(this.options.snap) { 
    414431      if(typeof this.options.snap == 'function') { 
    415         p = this.options.snap(p[0],p[1]); 
     432        p = this.options.snap(p[0],p[1],this); 
    416433      } else { 
    417434      if(this.options.snap instanceof Array) { 
     
    441458   
    442459  startScrolling: function(speed) { 
     460    if(!(speed[0] || speed[1])) return; 
    443461    this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; 
    444462    this.lastScrolled = new Date(); 
     
    707725      var index; 
    708726       
    709       var children = Sortable.findElements(dropon, {tag: droponOptions.tag}); 
     727      var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); 
    710728      var child = null; 
    711729             
     
    868886    if (options.tree) { 
    869887      return Sortable.tree(element, arguments[1]).children.map( function (item) { 
    870         return [name + Sortable._constructIndex(item) + "=" +  
     888        return [name + Sortable._constructIndex(item) + "[id]=" +  
    871889                encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); 
    872890      }).flatten().join('&'); 
  • trunk/railties/html/javascripts/effects.js

    r4122 r4766  
    106106var Effect = { 
    107107  tagifyText: function(element) { 
     108    if(typeof Builder == 'undefined') 
     109      throw("Effect.tagifyText requires including script.aculo.us' builder.js library"); 
     110       
    108111    var tagifyStyle = 'position:relative'; 
    109112    if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1'; 
     
    162165Effect.Transitions = {} 
    163166 
    164 Effect.Transitions.linear = function(pos) { 
    165   return pos; 
    166 
     167Effect.Transitions.linear = Prototype.K; 
     168 
    167169Effect.Transitions.sinoidal = function(pos) { 
    168170  return (-Math.cos(pos*Math.PI)/2) + 0.5; 
     
    354356    this.element = $(element); 
    355357    // make this work on IE on elements without 'layout' 
    356     if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout)) 
     358    if(/MSIE/.test(navigator.userAgent) && (!this.element.currentStyle.hasLayout)) 
    357359      this.element.setStyle({zoom: 1}); 
    358360    var options = Object.extend({ 
     
    394396  update: function(position) { 
    395397    this.element.setStyle({ 
    396       left: this.options.x  * position + this.originalLeft + 'px', 
    397       top:  this.options.y  * position + this.originalTop  + 'px' 
     398      left: Math.round(this.options.x  * position + this.originalLeft) + 'px', 
     399      top:  Math.round(this.options.y  * position + this.originalTop)  + 'px' 
    398400    }); 
    399401  } 
     
    434436     
    435437    var fontSize = this.element.getStyle('font-size') || '100%'; 
    436     ['em','px','%'].each( function(fontSizeType) { 
     438    ['em','px','%','pt'].each( function(fontSizeType) { 
    437439      if(fontSize.indexOf(fontSizeType)>0) { 
    438440        this.fontSize     = parseFloat(fontSize); 
     
    463465  setDimensions: function(height, width) { 
    464466    var d = {}; 
    465     if(this.options.scaleX) d.width = width + 'px'; 
    466     if(this.options.scaleY) d.height = height + 'px'; 
     467    if(this.options.scaleX) d.width = Math.round(width) + 'px'; 
     468    if(this.options.scaleY) d.height = Math.round(height) + 'px'; 
    467469    if(this.options.scaleFromCenter) { 
    468470      var topd  = (height - this.dims[0])/2; 
     
    590592  element = $(element); 
    591593  element.makeClipping(); 
    592   return new Effect.Scale(element, 0,  
     594  return new Effect.Scale(element, 0, 
    593595    Object.extend({ scaleContent: false,  
    594596      scaleX: false,  
     
    605607  element = $(element); 
    606608  var elementDimensions = element.getDimensions(); 
    607   return new Effect.Scale(element, 100,  
    608     Object.extend({ scaleContent: false,  
    609       scaleX: false, 
    610       scaleFrom: 0, 
    611       scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 
    612       restoreAfterFinish: true, 
    613       afterSetup: function(effect) { 
    614         effect.element.makeClipping(); 
    615         effect.element.setStyle({height: '0px'}); 
    616         effect.element.show();  
    617       },   
    618       afterFinishInternal: function(effect) { 
    619         effect.element.undoClipping(); 
    620       } 
    621     }, arguments[1] || {}) 
    622   ); 
     609  return new Effect.Scale(element, 100, Object.extend({  
     610    scaleContent: false,  
     611    scaleX: false, 
     612    scaleFrom: 0, 
     613    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 
     614    restoreAfterFinish: true, 
     615    afterSetup: function(effect) { 
     616      effect.element.makeClipping(); 
     617      effect.element.setStyle({height: '0px'}); 
     618      effect.element.show();  
     619    },   
     620    afterFinishInternal: function(effect) { 
     621      effect.element.undoClipping(); 
     622    } 
     623  }, arguments[1] || {})); 
    623624} 
    624625 
     
    626627  element = $(element); 
    627628  var oldOpacity = element.getInlineOpacity(); 
    628   return new Effect.Appear(element, {  
     629  return new Effect.Appear(element, Object.extend({ 
    629630    duration: 0.4, 
    630631    from: 0, 
     
    646647      }) 
    647648    } 
    648   }); 
     649  }, arguments[1] || {})); 
    649650} 
    650651 
     
    702703    scaleContent: false,  
    703704    scaleX: false,  
    704     scaleFrom: 0
     705    scaleFrom: window.opera ? 0 : 1
    705706    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 
    706707    restoreAfterFinish: true, 
     
    730731  ); 
    731732} 
    732    
     733 
    733734Effect.SlideUp = function(element) { 
    734735  element = $(element); 
    735736  element.cleanWhitespace(); 
    736737  var oldInnerBottom = $(element.firstChild).getStyle('bottom'); 
    737   return new Effect.Scale(element, 0,  
     738  return new Effect.Scale(element, window.opera ? 0 : 1, 
    738739   Object.extend({ scaleContent: false,  
    739740    scaleX: false,