Changeset 372


Ignore:
Timestamp:
Dec 10, 2009, 6:17:17 PM (14 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #74 archetype
rails updated

Location:
ruby/trunk
Files:
1 added
1 deleted
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • ruby/trunk/config/boot.rb

    r164 r372  
    4545      require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
    4646      Rails::Initializer.run(:install_gem_spec_stubs)
     47      Rails::GemDependency.add_frozen_gem_path
    4748    end
    4849  end
     
    6869    class << self
    6970      def rubygems_version
    70         Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
     71        Gem::RubyGemsVersion rescue nil
    7172      end
    7273
     
    8283
    8384      def load_rubygems
     85        min_version = '1.3.2'
    8486        require 'rubygems'
    85 
    86         unless rubygems_version >= '0.9.4'
    87           $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
     87        unless rubygems_version >= min_version
     88          $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
    8889          exit 1
    8990        end
    9091
    9192      rescue LoadError
    92         $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
     93        $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
    9394        exit 1
    9495      end
  • ruby/trunk/lib/open_ehr/am/archetype.rb

    r369 r372  
    1 require 'rm/support/terminology.rb'
     1include OpenEHR::RM::Common::Resource
    22
    3 module OpenEhr
     3module OpenEHR
    44  module AM
    55    module Archetype
    6       module ADL_Definition
     6      module ADLDefinition
     7        include OpenEHR::RM::Support::Terminology
    78#        include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
    8         include OpenEhr::RM::Support::Terminology
    99        CURRENT_ADL_VERSION = "1.4"
    1010      end
    1111
    12       class ARCHETYPE < OpenEhr::RM::Common::Resource::AuthoredResource
    13         include ADL_Definition
    14         attr_accessor :archetype_id, :concept_code, :is_controlled, :original_language, :parent_archtype_id, :uid
    15 
    16         attr_reader :parent_id,:concept, :definition, :ontology
    17         attr_accessor :adl_version,:description,:original_language
    18         attr_accessor :revision_history, :translation
     12      class Archetype < AuthoredResource
     13        include ADLDefinition
     14        attr_reader :archetype_id, :concept, :definition, :ontology
     15        attr_accessor :uid, :adl_version, :parent_archetype_id, :invariants
    1916
    2017        def initialize(args = {})
    21           @adl_version = args[:adl_version] if args[:adl_version]
    22           @archetype_id = args[:archetype_id] ? args[:archetype_id] : nil
    23           @parent_id = args[:parent_id] if args[:parent_id]
    24           @concept = args[:concept] if args[:concept]
    25           @is_controled = args[:is_controled] if args[:is_controled]
    26           @definition = args[:definition] if args[:definition]
    27           @ontology = args[:ontology] if args[:ontology]
    28  #         loadMaps(definition)
    29           super
     18          super(args)
     19          self.adl_version = args[:adl_version]
     20          self.archetype_id = args[:archetype_id]
     21          self.uid = args[:uid]
     22          self.concept = args[:concept]
     23          self.parent_archetype_id = args[:parent_archetype_id]
     24          self.definition = args[:definition]
     25          self.ontology = args[:ontology]
     26          self.invariants = args[:invariants]
     27        end
     28
     29        def archetype_id=(archetype_id)
     30          if archetype_id.nil?
     31            raise ArgumentError, 'archetype_id is mandatory'
     32          end
     33          @archetype_id = archetype_id
     34        end
     35
     36        def concept=(concept)
     37          if concept.nil?
     38            raise ArgumentError, 'concept is mandatory'
     39          end
     40          @concept = concept
     41        end
     42
     43        def definition=(definition)
     44          if definition.nil?
     45            raise ArgumentError, 'definition is mandatory'
     46          end
     47          @definition = definition
     48        end
     49
     50        def ontology=(ontology)
     51          if ontology.nil?
     52            raise ArgumentError, 'ontology is mandatory'
     53          end
     54          @ontology = ontology
     55        end
     56
     57        def version
     58          return @archetype_id.version_id
     59        end
     60
     61        def short_concept_name
     62          return @archetype_id.concept_name
    3063        end
    3164
     
    6598        end
    6699
    67         def short_concept_name
    68         end
    69 
    70100        def specialisation_depth
    71101        end
    72102       
    73         def version
    74         end
    75       end # end of ARCHETYPE
     103      end # end of Archetype
    76104      # original file:
    77105      # ref_imple_eiffel/components/adl_parser/src/interface/adl_definition.e
     
    80108      end
    81109    end
    82 
    83 
    84   end # end of AM
    85 end # end of OpenEHR
     110  end # of AM
     111end # of OpenEHR
  • ruby/trunk/lib/open_ehr/am/archetype/constraint_model.rb

    r369 r372  
    11
    2 module OpenEhr
     2module OpenEHR
    33  module AM
    44    module Archetype
    5       module Constraint_Model
    6         class ARCHETYPE_CONSTRAINT
    7          
     5      module ConstraintModel
     6        class ArchetypeConstraint
     7
    88        end
    99
    10         class CARDINALITY
     10        class Cardinality
    1111          attr_accessor :interval, :is_ordered, :is_unique
    1212
     
    1818        end
    1919
    20         class C_OBJECT < ARCHETYPE_CONSTRAINT
     20        class CObject < ArchetypeConstraint
    2121          attr_accessor :node_id, :occurrences, :rm_type_name
    2222
     
    3636        end
    3737
    38         class C_ATTRIBUTE < ARCHETYPE_CONSTRAINT
     38        class CAttribute < ArchetypeConstraint
    3939          attr_accessor :rm_attribute_name, :existence, :children
    4040
     
    4747        end
    4848
    49         class C_DEFINED_OBJECT < C_OBJECT
     49        class CDefinedObject < CObject
    5050          attr_accessor :assumed_value
    5151         
     
    5656        end
    5757
    58         class C_PRIMITIVE_OBJECT < C_DEFINED_OBJECT
     58        class CPrimitiveObject < CDefinedObject
    5959          attr_accessor :item
    6060
     
    6565        end
    6666
    67         class C_COMPLEX_OBJECT < C_DEFINED_OBJECT
     67        class CComplexObject < CDefinedObject
    6868          attr_accessor :attributes, :attributes_valid
    6969
     
    8282        end
    8383
    84         class C_DOMAIN_TYPE < C_DEFINED_OBJECT
     84        class CDomainType < CDefinedObject
    8585         
    8686        end
    8787
    88         class C_REFERENCE_OBJECT < C_OBJECT
     88        class CReferenceObject < CObject
    8989        end
    9090
    91         class ARCHETYPE_INTERNAL_REF < C_REFERENCE_OBJECT
     91        class ArchetypeInternalRef < CReferenceObject
    9292          attr_accessor :target_path
    9393        end
    9494
    95         class ARCHETYPE_SLOT < C_REFERENCE_OBJECT
     95        class ArchetypeSlot < CReferenceObject
    9696          attr_accessor :includes, :excludes
    9797
     
    107107        end
    108108
    109         class CONSTRAINT_REF < C_REFERENCE_OBJECT
     109        class ConstantRef < CReferenceObject
    110110          attr_accessor :reference
    111111
     
    120120        end
    121121
    122         class C_SINGLE_ATTRIBUTE < C_ATTRIBUTE
     122        class CSingleAttribute < CAttribute
    123123          attr_accessor :alternatives
    124124
     
    129129        end
    130130
    131         class C_MULTIPLE_ATTRIBUTE < C_ATTRIBUTE
     131        class CMultipleAttribute < CAttribute
    132132          attr_accessor :members, :cardinality
    133133         
  • ruby/trunk/lib/open_ehr/am/archetype/ontology.rb

    r167 r372  
    1 module OpenEhr
     1module OpenEHR
    22  module AM
    33    module Archetype
    44      module Ontology
    5         class ARCHETYPE_ONTOLOGY
     5        class ArchetypeOntology
    66          attr_accessor :constraint_codes, :specialisation_depth
    77          attr_accessor :term_attribute_names, :term_codes
  • ruby/trunk/public/javascripts/controls.js

    r164 r372  
    11// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    2 //           (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
    3 //           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
     2//           (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
     3//           (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
    44// Contributors:
    55//  Richard Livsey
    66//  Rahul Bhargava
    77//  Rob Wills
    8 // 
     8//
    99// script.aculo.us is freely distributable under the terms of an MIT-style license.
    1010// For details, see the script.aculo.us web site: http://script.aculo.us/
    1111
    12 // Autocompleter.Base handles all the autocompletion functionality 
     12// Autocompleter.Base handles all the autocompletion functionality
    1313// that's independent of the data source for autocompletion. This
    1414// includes drawing the autocompletion menu, observing keyboard
    1515// and mouse events, and similar.
    1616//
    17 // Specific autocompleters need to provide, at the very least, 
     17// Specific autocompleters need to provide, at the very least,
    1818// a getUpdatedChoices function that will be invoked every time
    19 // the text inside the monitored textbox changes. This method 
     19// the text inside the monitored textbox changes. This method
    2020// should get the text for which to provide autocompletion by
    2121// invoking this.getToken(), NOT by directly accessing
     
    3131// Additionally, ',' in the above example can be replaced with
    3232// a token array, e.g. { tokens: [',', '\n'] } which
    33 // enables autocompletion on multiple tokens. This is most 
    34 // useful when one of the tokens is \n (a newline), as it 
     33// enables autocompletion on multiple tokens. This is most
     34// useful when one of the tokens is \n (a newline), as it
    3535// allows smart autocompletion after linebreaks.
    3636
     
    3838  throw("controls.js requires including script.aculo.us' effects.js library");
    3939
    40 var Autocompleter = { }
     40var Autocompleter = { };
    4141Autocompleter.Base = Class.create({
    4242  baseInitialize: function(element, update, options) {
    43     element          = $(element)
    44     this.element     = element; 
    45     this.update      = $(update); 
    46     this.hasFocus    = false; 
    47     this.changed     = false; 
    48     this.active      = false; 
    49     this.index       = 0;     
     43    element          = $(element);
     44    this.element     = element;
     45    this.update      = $(update);
     46    this.hasFocus    = false;
     47    this.changed     = false;
     48    this.active      = false;
     49    this.index       = 0;
    5050    this.entryCount  = 0;
    5151    this.oldElementValue = this.element.value;
     
    6060    this.options.frequency    = this.options.frequency || 0.4;
    6161    this.options.minChars     = this.options.minChars || 1;
    62     this.options.onShow       = this.options.onShow || 
    63       function(element, update){ 
     62    this.options.onShow       = this.options.onShow ||
     63      function(element, update){
    6464        if(!update.style.position || update.style.position=='absolute') {
    6565          update.style.position = 'absolute';
    6666          Position.clone(element, update, {
    67             setHeight: false, 
     67            setHeight: false,
    6868            offsetTop: element.offsetHeight
    6969          });
     
    7171        Effect.Appear(update,{duration:0.15});
    7272      };
    73     this.options.onHide = this.options.onHide || 
     73    this.options.onHide = this.options.onHide ||
    7474      function(element, update){ new Effect.Fade(update,{duration:0.15}) };
    7575
    76     if(typeof(this.options.tokens) == 'string') 
     76    if(typeof(this.options.tokens) == 'string')
    7777      this.options.tokens = new Array(this.options.tokens);
    7878    // Force carriage returns as token delimiters anyway
     
    8181
    8282    this.observer = null;
    83    
     83
    8484    this.element.setAttribute('autocomplete','off');
    8585
     
    9292  show: function() {
    9393    if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
    94     if(!this.iefix && 
     94    if(!this.iefix &&
    9595      (Prototype.Browser.IE) &&
    9696      (Element.getStyle(this.update, 'position')=='absolute')) {
    97       new Insertion.After(this.update, 
     97      new Insertion.After(this.update,
    9898       '<iframe id="' + this.update.id + '_iefix" '+
    9999       'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
     
    103103    if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
    104104  },
    105  
     105
    106106  fixIEOverlapping: function() {
    107107    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
     
    151151         return;
    152152      }
    153      else 
    154        if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 
     153     else
     154       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
    155155         (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
    156156
     
    159159
    160160    if(this.observer) clearTimeout(this.observer);
    161       this.observer = 
     161      this.observer =
    162162        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
    163163  },
     
    171171  onHover: function(event) {
    172172    var element = Event.findElement(event, 'LI');
    173     if(this.index != element.autocompleteIndex) 
     173    if(this.index != element.autocompleteIndex)
    174174    {
    175175        this.index = element.autocompleteIndex;
     
    178178    Event.stop(event);
    179179  },
    180  
     180
    181181  onClick: function(event) {
    182182    var element = Event.findElement(event, 'LI');
     
    185185    this.hide();
    186186  },
    187  
     187
    188188  onBlur: function(event) {
    189189    // needed to make click events working
    190190    setTimeout(this.hide.bind(this), 250);
    191191    this.hasFocus = false;
    192     this.active = false;     
    193   }, 
    194  
     192    this.active = false;
     193  },
     194
    195195  render: function() {
    196196    if(this.entryCount > 0) {
    197197      for (var i = 0; i < this.entryCount; i++)
    198         this.index==i ? 
    199           Element.addClassName(this.getEntry(i),"selected") : 
     198        this.index==i ?
     199          Element.addClassName(this.getEntry(i),"selected") :
    200200          Element.removeClassName(this.getEntry(i),"selected");
    201       if(this.hasFocus) { 
     201      if(this.hasFocus) {
    202202        this.show();
    203203        this.active = true;
     
    208208    }
    209209  },
    210  
     210
    211211  markPrevious: function() {
    212     if(this.index > 0) this.index--
     212    if(this.index > 0) this.index--;
    213213      else this.index = this.entryCount-1;
    214214    this.getEntry(this.index).scrollIntoView(true);
    215215  },
    216  
     216
    217217  markNext: function() {
    218     if(this.index < this.entryCount-1) this.index++
     218    if(this.index < this.entryCount-1) this.index++;
    219219      else this.index = 0;
    220220    this.getEntry(this.index).scrollIntoView(false);
    221221  },
    222  
     222
    223223  getEntry: function(index) {
    224224    return this.update.firstChild.childNodes[index];
    225225  },
    226  
     226
    227227  getCurrentEntry: function() {
    228228    return this.getEntry(this.index);
    229229  },
    230  
     230
    231231  selectEntry: function() {
    232232    this.active = false;
     
    245245    } else
    246246      value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
    247    
     247
    248248    var bounds = this.getTokenBounds();
    249249    if (bounds[0] != -1) {
     
    258258    this.oldElementValue = this.element.value;
    259259    this.element.focus();
    260    
     260
    261261    if (this.options.afterUpdateElement)
    262262      this.options.afterUpdateElement(this.element, selectedElement);
     
    270270
    271271      if(this.update.firstChild && this.update.down().childNodes) {
    272         this.entryCount = 
     272        this.entryCount =
    273273          this.update.down().childNodes.length;
    274274        for (var i = 0; i < this.entryCount; i++) {
     
    277277          this.addObservers(entry);
    278278        }
    279       } else { 
     279      } else {
    280280        this.entryCount = 0;
    281281      }
     
    283283      this.stopIndicator();
    284284      this.index = 0;
    285      
     285
    286286      if(this.entryCount==1 && this.options.autoSelect) {
    287287        this.selectEntry();
     
    299299
    300300  onObserverEvent: function() {
    301     this.changed = false;   
     301    this.changed = false;
    302302    this.tokenBounds = null;
    303303    if(this.getToken().length>=this.options.minChars) {
     
    352352  getUpdatedChoices: function() {
    353353    this.startIndicator();
    354    
    355     var entry = encodeURIComponent(this.options.paramName) + '=' + 
     354
     355    var entry = encodeURIComponent(this.options.paramName) + '=' +
    356356      encodeURIComponent(this.getToken());
    357357
     
    359359      this.options.callback(this.element, entry) : entry;
    360360
    361     if(this.options.defaultParams) 
     361    if(this.options.defaultParams)
    362362      this.options.parameters += '&' + this.options.defaultParams;
    363    
     363
    364364    new Ajax.Request(this.url, this.options);
    365365  },
     
    383383//
    384384// - partialSearch - If false, the autocompleter will match entered
    385 //                    text only at the beginning of strings in the 
     385//                    text only at the beginning of strings in the
    386386//                    autocomplete array. Defaults to true, which will
    387387//                    match text at the beginning of any *word* in the
     
    400400//                 Defaults to true.
    401401//
    402 // It's possible to pass in a custom function as the 'selector' 
     402// It's possible to pass in a custom function as the 'selector'
    403403// option, if you prefer to write your own autocompletion logic.
    404404// In that case, the other options above will not apply unless
     
    428428        var count     = 0;
    429429
    430         for (var i = 0; i < instance.options.array.length && 
    431           ret.length < instance.options.choices ; i++) { 
     430        for (var i = 0; i < instance.options.array.length &&
     431          ret.length < instance.options.choices ; i++) {
    432432
    433433          var elem = instance.options.array[i];
    434           var foundPos = instance.options.ignoreCase ? 
    435             elem.toLowerCase().indexOf(entry.toLowerCase()) : 
     434          var foundPos = instance.options.ignoreCase ?
     435            elem.toLowerCase().indexOf(entry.toLowerCase()) :
    436436            elem.indexOf(entry);
    437437
    438438          while (foundPos != -1) {
    439             if (foundPos == 0 && elem.length != entry.length) { 
    440               ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 
     439            if (foundPos == 0 && elem.length != entry.length) {
     440              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
    441441                elem.substr(entry.length) + "</li>");
    442442              break;
    443             } else if (entry.length >= instance.options.partialChars && 
     443            } else if (entry.length >= instance.options.partialChars &&
    444444              instance.options.partialSearch && foundPos != -1) {
    445445              if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
     
    451451            }
    452452
    453             foundPos = instance.options.ignoreCase ? 
    454               elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 
     453            foundPos = instance.options.ignoreCase ?
     454              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
    455455              elem.indexOf(entry, foundPos + 1);
    456456
     
    458458        }
    459459        if (partial.length)
    460           ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
     460          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
    461461        return "<ul>" + ret.join('') + "</ul>";
    462462      }
     
    475475    Field.activate(field);
    476476  }, 1);
    477 }
     477};
    478478
    479479Ajax.InPlaceEditor = Class.create({
     
    605605  },
    606606  getText: function() {
    607     return this.element.innerHTML;
     607    return this.element.innerHTML.unescapeHTML();
    608608  },
    609609  handleAJAXFailure: function(transport) {
     
    781781        var js = transport.responseText.strip();
    782782        if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
    783           throw 'Server returned an invalid collection representation.';
     783          throw('Server returned an invalid collection representation.');
    784784        this._collection = eval(js);
    785785        this.checkForExternalText();
     
    938938};
    939939
    940 // Delayed observer, like Form.Element.Observer, 
     940// Delayed observer, like Form.Element.Observer,
    941941// but waits for delay after last key input
    942942// Ideal for live-search fields
     
    948948    this.callback  = callback;
    949949    this.timer     = null;
    950     this.lastValue = $F(this.element); 
     950    this.lastValue = $F(this.element);
    951951    Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
    952952  },
  • ruby/trunk/public/javascripts/dragdrop.js

    r164 r372  
    11// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    2 //           (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
    3 // 
     2//           (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
     3//
    44// script.aculo.us is freely distributable under the terms of an MIT-style license.
    55// For details, see the script.aculo.us web site: http://script.aculo.us/
     
    3333      }
    3434    }
    35    
     35
    3636    if(options.accept) options.accept = [options.accept].flatten();
    3737
     
    4141    this.drops.push(options);
    4242  },
    43  
     43
    4444  findDeepestChild: function(drops) {
    4545    deepest = drops[0];
    46      
     46
    4747    for (i = 1; i < drops.length; ++i)
    4848      if (Element.isParent(drops[i].element, deepest.element))
    4949        deepest = drops[i];
    50    
     50
    5151    return deepest;
    5252  },
     
    5555    var containmentNode;
    5656    if(drop.tree) {
    57       containmentNode = element.treeNode; 
     57      containmentNode = element.treeNode;
    5858    } else {
    5959      containmentNode = element.parentNode;
     
    6161    return drop._containers.detect(function(c) { return containmentNode == c });
    6262  },
    63  
     63
    6464  isAffected: function(point, element, drop) {
    6565    return (
     
    6868        this.isContained(element, drop)) &&
    6969      ((!drop.accept) ||
    70         (Element.classNames(element).detect( 
     70        (Element.classNames(element).detect(
    7171          function(v) { return drop.accept.include(v) } ) )) &&
    7272      Position.within(drop.element, point[0], point[1]) );
     
    8888    if(!this.drops.length) return;
    8989    var drop, affected = [];
    90    
     90
    9191    this.drops.each( function(drop) {
    9292      if(Droppables.isAffected(point, element, drop))
    9393        affected.push(drop);
    9494    });
    95        
     95
    9696    if(affected.length>0)
    9797      drop = Droppables.findDeepestChild(affected);
     
    102102      if(drop.onHover)
    103103        drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
    104      
     104
    105105      if (drop != this.last_active) Droppables.activate(drop);
    106106    }
     
    113113    if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
    114114      if (this.last_active.onDrop) {
    115         this.last_active.onDrop(element, this.last_active.element, event); 
    116         return true; 
     115        this.last_active.onDrop(element, this.last_active.element, event);
     116        return true;
    117117      }
    118118  },
     
    122122      this.deactivate(this.last_active);
    123123  }
    124 }
     124};
    125125
    126126var Draggables = {
    127127  drags: [],
    128128  observers: [],
    129  
     129
    130130  register: function(draggable) {
    131131    if(this.drags.length == 0) {
     
    133133      this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
    134134      this.eventKeypress  = this.keyPress.bindAsEventListener(this);
    135      
     135
    136136      Event.observe(document, "mouseup", this.eventMouseUp);
    137137      Event.observe(document, "mousemove", this.eventMouseMove);
     
    140140    this.drags.push(draggable);
    141141  },
    142  
     142
    143143  unregister: function(draggable) {
    144144    this.drags = this.drags.reject(function(d) { return d==draggable });
     
    149149    }
    150150  },
    151  
     151
    152152  activate: function(draggable) {
    153     if(draggable.options.delay) { 
    154       this._timeout = setTimeout(function() { 
    155         Draggables._timeout = null; 
    156         window.focus(); 
    157         Draggables.activeDraggable = draggable; 
    158       }.bind(this), draggable.options.delay); 
     153    if(draggable.options.delay) {
     154      this._timeout = setTimeout(function() {
     155        Draggables._timeout = null;
     156        window.focus();
     157        Draggables.activeDraggable = draggable;
     158      }.bind(this), draggable.options.delay);
    159159    } else {
    160160      window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
     
    162162    }
    163163  },
    164  
     164
    165165  deactivate: function() {
    166166    this.activeDraggable = null;
    167167  },
    168  
     168
    169169  updateDrag: function(event) {
    170170    if(!this.activeDraggable) return;
     
    174174    if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
    175175    this._lastPointer = pointer;
    176    
     176
    177177    this.activeDraggable.updateDrag(event, pointer);
    178178  },
    179  
     179
    180180  endDrag: function(event) {
    181     if(this._timeout) { 
    182       clearTimeout(this._timeout); 
    183       this._timeout = null; 
     181    if(this._timeout) {
     182      clearTimeout(this._timeout);
     183      this._timeout = null;
    184184    }
    185185    if(!this.activeDraggable) return;
     
    188188    this.activeDraggable = null;
    189189  },
    190  
     190
    191191  keyPress: function(event) {
    192192    if(this.activeDraggable)
    193193      this.activeDraggable.keyPress(event);
    194194  },
    195  
     195
    196196  addObserver: function(observer) {
    197197    this.observers.push(observer);
    198198    this._cacheObserverCallbacks();
    199199  },
    200  
     200
    201201  removeObserver: function(element) {  // element instead of observer fixes mem leaks
    202202    this.observers = this.observers.reject( function(o) { return o.element==element });
    203203    this._cacheObserverCallbacks();
    204204  },
    205  
     205
    206206  notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
    207207    if(this[eventName+'Count'] > 0)
     
    211211    if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
    212212  },
    213  
     213
    214214  _cacheObserverCallbacks: function() {
    215215    ['onStart','onEnd','onDrag'].each( function(eventName) {
     
    219219    });
    220220  }
    221 }
     221};
    222222
    223223/*--------------------------------------------------------------------------*/
     
    235235      endeffect: function(element) {
    236236        var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
    237         new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 
     237        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
    238238          queue: {scope:'_draggable', position:'end'},
    239           afterFinish: function(){ 
    240             Draggable._dragging[element] = false 
     239          afterFinish: function(){
     240            Draggable._dragging[element] = false
    241241          }
    242         }); 
     242        });
    243243      },
    244244      zindex: 1000,
     
    251251      delay: 0
    252252    };
    253    
     253
    254254    if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
    255255      Object.extend(defaults, {
     
    257257          element._opacity = Element.getOpacity(element);
    258258          Draggable._dragging[element] = true;
    259           new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 
     259          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
    260260        }
    261261      });
    262    
     262
    263263    var options = Object.extend(defaults, arguments[1] || { });
    264264
    265265    this.element = $(element);
    266    
     266
    267267    if(options.handle && Object.isString(options.handle))
    268268      this.handle = this.element.down('.'+options.handle, 0);
    269    
     269
    270270    if(!this.handle) this.handle = $(options.handle);
    271271    if(!this.handle) this.handle = this.element;
    272    
     272
    273273    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
    274274      options.scroll = $(options.scroll);
     
    276276    }
    277277
    278     Element.makePositioned(this.element); // fix IE   
     278    Element.makePositioned(this.element); // fix IE
    279279
    280280    this.options  = options;
    281     this.dragging = false;   
     281    this.dragging = false;
    282282
    283283    this.eventMouseDown = this.initDrag.bindAsEventListener(this);
    284284    Event.observe(this.handle, "mousedown", this.eventMouseDown);
    285    
     285
    286286    Draggables.register(this);
    287287  },
    288  
     288
    289289  destroy: function() {
    290290    Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
    291291    Draggables.unregister(this);
    292292  },
    293  
     293
    294294  currentDelta: function() {
    295295    return([
     
    297297      parseInt(Element.getStyle(this.element,'top') || '0')]);
    298298  },
    299  
     299
    300300  initDrag: function(event) {
    301301    if(!Object.isUndefined(Draggable._dragging[this.element]) &&
    302302      Draggable._dragging[this.element]) return;
    303     if(Event.isLeftClick(event)) {   
     303    if(Event.isLeftClick(event)) {
    304304      // abort on form elements, fixes a Firefox issue
    305305      var src = Event.element(event);
     
    310310        tag_name=='BUTTON' ||
    311311        tag_name=='TEXTAREA')) return;
    312        
     312
    313313      var pointer = [Event.pointerX(event), Event.pointerY(event)];
    314314      var pos     = Position.cumulativeOffset(this.element);
    315315      this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
    316      
     316
    317317      Draggables.activate(this);
    318318      Event.stop(event);
    319319    }
    320320  },
    321  
     321
    322322  startDrag: function(event) {
    323323    this.dragging = true;
    324324    if(!this.delta)
    325325      this.delta = this.currentDelta();
    326    
     326
    327327    if(this.options.zindex) {
    328328      this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
    329329      this.element.style.zIndex = this.options.zindex;
    330330    }
    331    
     331
    332332    if(this.options.ghosting) {
    333333      this._clone = this.element.cloneNode(true);
    334       this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
    335       if (!this.element._originallyAbsolute)
     334      this._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
     335      if (!this._originallyAbsolute)
    336336        Position.absolutize(this.element);
    337337      this.element.parentNode.insertBefore(this._clone, this.element);
    338338    }
    339    
     339
    340340    if(this.options.scroll) {
    341341      if (this.options.scroll == window) {
     
    348348      }
    349349    }
    350    
     350
    351351    Draggables.notify('onStart', this, event);
    352        
     352
    353353    if(this.options.starteffect) this.options.starteffect(this.element);
    354354  },
    355  
     355
    356356  updateDrag: function(event, pointer) {
    357357    if(!this.dragging) this.startDrag(event);
    358    
     358
    359359    if(!this.options.quiet){
    360360      Position.prepare();
    361361      Droppables.show(pointer, this.element);
    362362    }
    363    
     363
    364364    Draggables.notify('onDrag', this, event);
    365    
     365
    366366    this.draw(pointer);
    367367    if(this.options.change) this.options.change(this);
    368    
     368
    369369    if(this.options.scroll) {
    370370      this.stopScrolling();
    371      
     371
    372372      var p;
    373373      if (this.options.scroll == window) {
     
    387387      this.startScrolling(speed);
    388388    }
    389    
     389
    390390    // fix AppleWebKit rendering
    391391    if(Prototype.Browser.WebKit) window.scrollBy(0,0);
    392    
     392
    393393    Event.stop(event);
    394394  },
    395  
     395
    396396  finishDrag: function(event, success) {
    397397    this.dragging = false;
    398    
     398
    399399    if(this.options.quiet){
    400400      Position.prepare();
     
    404404
    405405    if(this.options.ghosting) {
    406       if (!this.element._originallyAbsolute)
     406      if (!this._originallyAbsolute)
    407407        Position.relativize(this.element);
    408       delete this.element._originallyAbsolute;
     408      delete this._originallyAbsolute;
    409409      Element.remove(this._clone);
    410410      this._clone = null;
    411411    }
    412412
    413     var dropped = false; 
    414     if(success) { 
    415       dropped = Droppables.fire(event, this.element); 
    416       if (!dropped) dropped = false; 
     413    var dropped = false;
     414    if(success) {
     415      dropped = Droppables.fire(event, this.element);
     416      if (!dropped) dropped = false;
    417417    }
    418418    if(dropped && this.options.onDropped) this.options.onDropped(this.element);
     
    421421    var revert = this.options.revert;
    422422    if(revert && Object.isFunction(revert)) revert = revert(this.element);
    423    
     423
    424424    var d = this.currentDelta();
    425425    if(revert && this.options.reverteffect) {
     
    434434      this.element.style.zIndex = this.originalZ;
    435435
    436     if(this.options.endeffect) 
     436    if(this.options.endeffect)
    437437      this.options.endeffect(this.element);
    438      
     438
    439439    Draggables.deactivate(this);
    440440    Droppables.reset();
    441441  },
    442  
     442
    443443  keyPress: function(event) {
    444444    if(event.keyCode!=Event.KEY_ESC) return;
     
    446446    Event.stop(event);
    447447  },
    448  
     448
    449449  endDrag: function(event) {
    450450    if(!this.dragging) return;
     
    453453    Event.stop(event);
    454454  },
    455  
     455
    456456  draw: function(point) {
    457457    var pos = Position.cumulativeOffset(this.element);
     
    460460      pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
    461461    }
    462    
     462
    463463    var d = this.currentDelta();
    464464    pos[0] -= d[0]; pos[1] -= d[1];
    465    
     465
    466466    if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
    467467      pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
    468468      pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
    469469    }
    470    
    471     var p = [0,1].map(function(i){ 
    472       return (point[i]-pos[i]-this.offset[i]) 
     470
     471    var p = [0,1].map(function(i){
     472      return (point[i]-pos[i]-this.offset[i])
    473473    }.bind(this));
    474    
     474
    475475    if(this.options.snap) {
    476476      if(Object.isFunction(this.options.snap)) {
     
    479479      if(Object.isArray(this.options.snap)) {
    480480        p = p.map( function(v, i) {
    481           return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
     481          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this));
    482482      } else {
    483483        p = p.map( function(v) {
    484           return (v/this.options.snap).round()*this.options.snap }.bind(this))
     484          return (v/this.options.snap).round()*this.options.snap }.bind(this));
    485485      }
    486486    }}
    487    
     487
    488488    var style = this.element.style;
    489489    if((!this.options.constraint) || (this.options.constraint=='horizontal'))
     
    491491    if((!this.options.constraint) || (this.options.constraint=='vertical'))
    492492      style.top  = p[1] + "px";
    493    
     493
    494494    if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
    495495  },
    496  
     496
    497497  stopScrolling: function() {
    498498    if(this.scrollInterval) {
     
    502502    }
    503503  },
    504  
     504
    505505  startScrolling: function(speed) {
    506506    if(!(speed[0] || speed[1])) return;
     
    509509    this.scrollInterval = setInterval(this.scroll.bind(this), 10);
    510510  },
    511  
     511
    512512  scroll: function() {
    513513    var current = new Date();
     
    525525      this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
    526526    }
    527    
     527
    528528    Position.prepare();
    529529    Droppables.show(Draggables._lastPointer, this.element);
     
    539539      this.draw(Draggables._lastScrollPointer);
    540540    }
    541    
     541
    542542    if(this.options.change) this.options.change(this);
    543543  },
    544  
     544
    545545  _getWindowScroll: function(w) {
    546546    var T, L, W, H;
     
    561561      } else {
    562562        W = body.offsetWidth;
    563         H = body.offsetHeight
     563        H = body.offsetHeight;
    564564      }
    565565    }
     
    578578    this.lastValue = Sortable.serialize(this.element);
    579579  },
    580  
     580
    581581  onStart: function() {
    582582    this.lastValue = Sortable.serialize(this.element);
    583583  },
    584  
     584
    585585  onEnd: function() {
    586586    Sortable.unmark();
     
    592592var Sortable = {
    593593  SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
    594  
     594
    595595  sortables: { },
    596  
     596
    597597  _findRootElement: function(element) {
    598     while (element.tagName.toUpperCase() != "BODY") { 
     598    while (element.tagName.toUpperCase() != "BODY") {
    599599      if(element.id && Sortable.sortables[element.id]) return element;
    600600      element = element.parentNode;
     
    607607    return Sortable.sortables[element.id];
    608608  },
    609  
     609
    610610  destroy: function(element){
    611     var s = Sortable.options(element);
    612    
     611    element = $(element);
     612    var s = Sortable.sortables[element.id];
     613
    613614    if(s) {
    614615      Draggables.removeObserver(s.element);
    615616      s.droppables.each(function(d){ Droppables.remove(d) });
    616617      s.draggables.invoke('destroy');
    617      
     618
    618619      delete Sortable.sortables[s.element.id];
    619620    }
     
    622623  create: function(element) {
    623624    element = $(element);
    624     var options = Object.extend({ 
     625    var options = Object.extend({
    625626      element:     element,
    626627      tag:         'li',       // assumes li children, override with tag: 'tagname'
     
    636637      hoverclass:  null,
    637638      ghosting:    false,
    638       quiet:       false, 
     639      quiet:       false,
    639640      scroll:      false,
    640641      scrollSensitivity: 20,
    641642      scrollSpeed: 15,
    642643      format:      this.SERIALIZE_RULE,
    643      
    644       // these take arrays of elements or ids and can be 
     644
     645      // these take arrays of elements or ids and can be
    645646      // used for better initialization performance
    646647      elements:    false,
    647648      handles:     false,
    648      
     649
    649650      onChange:    Prototype.emptyFunction,
    650651      onUpdate:    Prototype.emptyFunction
     
    683684      options_for_draggable.zindex = options.zindex;
    684685
    685     // build options for the droppables 
     686    // build options for the droppables
    686687    var options_for_droppable = {
    687688      overlap:     options.overlap,
     
    690691      hoverclass:  options.hoverclass,
    691692      onHover:     Sortable.onHover
    692     }
    693    
     693    };
     694
    694695    var options_for_tree = {
    695696      onHover:      Sortable.onEmptyHover,
     
    697698      containment:  options.containment,
    698699      hoverclass:   options.hoverclass
    699     }
     700    };
    700701
    701702    // fix for gecko engine
    702     Element.cleanWhitespace(element); 
     703    Element.cleanWhitespace(element);
    703704
    704705    options.draggables = [];
     
    713714    (options.elements || this.findElements(element, options) || []).each( function(e,i) {
    714715      var handle = options.handles ? $(options.handles[i]) :
    715         (options.handle ? $(e).select('.' + options.handle)[0] : e); 
     716        (options.handle ? $(e).select('.' + options.handle)[0] : e);
    716717      options.draggables.push(
    717718        new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
    718719      Droppables.add(e, options_for_droppable);
    719720      if(options.tree) e.treeNode = element;
    720       options.droppables.push(e);     
     721      options.droppables.push(e);
    721722    });
    722    
     723
    723724    if(options.tree) {
    724725      (Sortable.findTreeElements(element, options) || []).each( function(e) {
     
    742743      element, options.only, options.tree ? true : false, options.tag);
    743744  },
    744  
     745
    745746  findTreeElements: function(element, options) {
    746747    return Element.findChildren(
     
    759760        element.style.visibility = "hidden"; // fix gecko rendering
    760761        dropon.parentNode.insertBefore(element, dropon);
    761         if(dropon.parentNode!=oldParentNode) 
     762        if(dropon.parentNode!=oldParentNode)
    762763          Sortable.options(oldParentNode).onChange(element);
    763764        Sortable.options(dropon.parentNode).onChange(element);
     
    770771        element.style.visibility = "hidden"; // fix gecko rendering
    771772        dropon.parentNode.insertBefore(element, nextElement);
    772         if(dropon.parentNode!=oldParentNode) 
     773        if(dropon.parentNode!=oldParentNode)
    773774          Sortable.options(oldParentNode).onChange(element);
    774775        Sortable.options(dropon.parentNode).onChange(element);
     
    776777    }
    777778  },
    778  
     779
    779780  onEmptyHover: function(element, dropon, overlap) {
    780781    var oldParentNode = element.parentNode;
    781782    var droponOptions = Sortable.options(dropon);
    782        
     783
    783784    if(!Element.isParent(dropon, element)) {
    784785      var index;
    785      
     786
    786787      var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
    787788      var child = null;
    788            
     789
    789790      if(children) {
    790791        var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
    791        
     792
    792793        for (index = 0; index < children.length; index += 1) {
    793794          if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
     
    802803        }
    803804      }
    804      
     805
    805806      dropon.insertBefore(element, child);
    806      
     807
    807808      Sortable.options(oldParentNode).onChange(element);
    808809      droponOptions.onChange(element);
     
    817818    // mark on ghosting only
    818819    var sortable = Sortable.options(dropon.parentNode);
    819     if(sortable && !sortable.ghosting) return; 
     820    if(sortable && !sortable.ghosting) return;
    820821
    821822    if(!Sortable._marker) {
    822       Sortable._marker = 
     823      Sortable._marker =
    823824        ($('dropmarker') || Element.extend(document.createElement('DIV'))).
    824825          hide().addClassName('dropmarker').setStyle({position:'absolute'});
    825826      document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
    826     }   
     827    }
    827828    var offsets = Position.cumulativeOffset(dropon);
    828829    Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
    829    
     830
    830831    if(position=='after')
    831       if(sortable.overlap == 'horizontal') 
     832      if(sortable.overlap == 'horizontal')
    832833        Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
    833834      else
    834835        Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
    835    
     836
    836837    Sortable._marker.show();
    837838  },
    838  
     839
    839840  _tree: function(element, options, parent) {
    840841    var children = Sortable.findElements(element, options) || [];
    841  
     842
    842843    for (var i = 0; i < children.length; ++i) {
    843844      var match = children[i].id.match(options.format);
    844845
    845846      if (!match) continue;
    846      
     847
    847848      var child = {
    848849        id: encodeURIComponent(match ? match[1] : null),
     
    852853        position: parent.children.length,
    853854        container: $(children[i]).down(options.treeTag)
    854       }
    855      
     855      };
     856
    856857      /* Get the element containing the children and recurse over it */
    857858      if (child.container)
    858         this._tree(child.container, options, child)
    859      
     859        this._tree(child.container, options, child);
     860
    860861      parent.children.push (child);
    861862    }
    862863
    863     return parent; 
     864    return parent;
    864865  },
    865866
     
    874875      format: sortableOptions.format
    875876    }, arguments[1] || { });
    876    
     877
    877878    var root = {
    878879      id: null,
     
    881882      container: element,
    882883      position: 0
    883     }
    884    
     884    };
     885
    885886    return Sortable._tree(element, options, root);
    886887  },
     
    898899    element = $(element);
    899900    var options = Object.extend(this.options(element), arguments[1] || { });
    900    
     901
    901902    return $(this.findElements(element, options) || []).map( function(item) {
    902903      return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
     
    907908    element = $(element);
    908909    var options = Object.extend(this.options(element), arguments[2] || { });
    909    
     910
    910911    var nodeMap = { };
    911912    this.findElements(element, options).each( function(n) {
     
    914915        n.parentNode.removeChild(n);
    915916    });
    916    
     917
    917918    new_sequence.each(function(ident) {
    918919      var n = nodeMap[ident];
     
    923924    });
    924925  },
    925  
     926
    926927  serialize: function(element) {
    927928    element = $(element);
     
    929930    var name = encodeURIComponent(
    930931      (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
    931    
     932
    932933    if (options.tree) {
    933934      return Sortable.tree(element, arguments[1]).children.map( function (item) {
    934         return [name + Sortable._constructIndex(item) + "[id]=" + 
     935        return [name + Sortable._constructIndex(item) + "[id]=" +
    935936                encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
    936937      }).flatten().join('&');
     
    941942    }
    942943  }
    943 }
     944};
    944945
    945946// Returns true if child is contained within element
     
    948949  if (child.parentNode == element) return true;
    949950  return Element.isParent(child.parentNode, element);
    950 }
    951 
    952 Element.findChildren = function(element, only, recursive, tagName) {   
     951};
     952
     953Element.findChildren = function(element, only, recursive, tagName) {
    953954  if(!element.hasChildNodes()) return null;
    954955  tagName = tagName.toUpperCase();
     
    966967
    967968  return (elements.length>0 ? elements.flatten() : []);
    968 }
     969};
    969970
    970971Element.offsetSize = function (element, type) {
    971972  return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
    972 }
     973};
  • ruby/trunk/public/javascripts/effects.js

    r164 r372  
    44//  Mark Pilgrim (http://diveintomark.org/)
    55//  Martin Bialasinki
    6 // 
     6//
    77// script.aculo.us is freely distributable under the terms of an MIT-style license.
    8 // For details, see the script.aculo.us web site: http://script.aculo.us/ 
    9 
    10 // converts rgb() and #xxx to #xxxxxx format, 
    11 // returns self (or first argument) if not convertable 
    12 String.prototype.parseColor = function() { 
     8// For details, see the script.aculo.us web site: http://script.aculo.us/
     9
     10// converts rgb() and #xxx to #xxxxxx format,
     11// returns self (or first argument) if not convertable
     12String.prototype.parseColor = function() {
    1313  var color = '#';
    14   if (this.slice(0,4) == 'rgb(') { 
    15     var cols = this.slice(4,this.length-1).split(','); 
    16     var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); 
    17   } else { 
    18     if (this.slice(0,1) == '#') { 
    19       if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); 
    20       if (this.length==7) color = this.toLowerCase(); 
    21     } 
    22   } 
    23   return (color.length==7 ? color : (arguments[0] || this)); 
     14  if (this.slice(0,4) == 'rgb(') {
     15    var cols = this.slice(4,this.length-1).split(',');
     16    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
     17  } else {
     18    if (this.slice(0,1) == '#') {
     19      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
     20      if (this.length==7) color = this.toLowerCase();
     21    }
     22  }
     23  return (color.length==7 ? color : (arguments[0] || this));
    2424};
    2525
    2626/*--------------------------------------------------------------------------*/
    2727
    28 Element.collectTextNodes = function(element) { 
     28Element.collectTextNodes = function(element) {
    2929  return $A($(element).childNodes).collect( function(node) {
    30     return (node.nodeType==3 ? node.nodeValue : 
     30    return (node.nodeType==3 ? node.nodeValue :
    3131      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
    3232  }).flatten().join('');
    3333};
    3434
    35 Element.collectTextNodesIgnoreClass = function(element, className) { 
     35Element.collectTextNodesIgnoreClass = function(element, className) {
    3636  return $A($(element).childNodes).collect( function(node) {
    37     return (node.nodeType==3 ? node.nodeValue : 
    38       ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
     37    return (node.nodeType==3 ? node.nodeValue :
     38      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
    3939        Element.collectTextNodesIgnoreClass(node, className) : ''));
    4040  }).flatten().join('');
     
    4242
    4343Element.setContentZoom = function(element, percent) {
    44   element = $(element); 
    45   element.setStyle({fontSize: (percent/100) + 'em'});   
     44  element = $(element);
     45  element.setStyle({fontSize: (percent/100) + 'em'});
    4646  if (Prototype.Browser.WebKit) window.scrollBy(0,0);
    4747  return element;
     
    7171    linear: Prototype.K,
    7272    sinoidal: function(pos) {
    73       return (-Math.cos(pos*Math.PI)/2) + 0.5;
     73      return (-Math.cos(pos*Math.PI)/2) + .5;
    7474    },
    7575    reverse: function(pos) {
     
    7777    },
    7878    flicker: function(pos) {
    79       var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
     79      var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
    8080      return pos > 1 ? 1 : pos;
    8181    },
    8282    wobble: function(pos) {
    83       return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
    84     },
    85     pulse: function(pos, pulses) {
    86       pulses = pulses || 5;
    87       return (
    88         ((pos % (1/pulses)) * pulses).round() == 0 ?
    89               ((pos * pulses * 2) - (pos * pulses * 2).floor()) :
    90           1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
    91         );
    92     },
    93     spring: function(pos) {
    94       return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
     83      return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
     84    },
     85    pulse: function(pos, pulses) {
     86      return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
     87    },
     88    spring: function(pos) {
     89      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
    9590    },
    9691    none: function(pos) {
     
    113108    var tagifyStyle = 'position:relative';
    114109    if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
    115    
     110
    116111    element = $(element);
    117112    $A(element.childNodes).each( function(child) {
     
    120115          element.insertBefore(
    121116            new Element('span', {style: tagifyStyle}).update(
    122               character == ' ' ? String.fromCharCode(160) : character), 
     117              character == ' ' ? String.fromCharCode(160) : character),
    123118              child);
    124119        });
     
    129124  multiple: function(element, effect) {
    130125    var elements;
    131     if (((typeof element == 'object') || 
    132         Object.isFunction(element)) && 
     126    if (((typeof element == 'object') ||
     127        Object.isFunction(element)) &&
    133128       (element.length))
    134129      elements = element;
    135130    else
    136131      elements = $(element).childNodes;
    137      
     132
    138133    var options = Object.extend({
    139134      speed: 0.1,
     
    157152      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
    158153    }, arguments[2] || { });
    159     Effect[element.visible() ? 
     154    Effect[element.visible() ?
    160155      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
    161156  }
     
    169164  initialize: function() {
    170165    this.effects  = [];
    171     this.interval = null;   
     166    this.interval = null;
    172167  },
    173168  _each: function(iterator) {
     
    176171  add: function(effect) {
    177172    var timestamp = new Date().getTime();
    178    
    179     var position = Object.isString(effect.options.queue) ? 
     173
     174    var position = Object.isString(effect.options.queue) ?
    180175      effect.options.queue : effect.options.queue.position;
    181    
     176
    182177    switch(position) {
    183178      case 'front':
    184         // move unstarted effects after this effect 
     179        // move unstarted effects after this effect
    185180        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
    186181            e.startOn  += effect.finishOn;
     
    196191        break;
    197192    }
    198    
     193
    199194    effect.startOn  += timestamp;
    200195    effect.finishOn += timestamp;
     
    202197    if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
    203198      this.effects.push(effect);
    204    
     199
    205200    if (!this.interval)
    206201      this.interval = setInterval(this.loop.bind(this), 15);
     
    215210  loop: function() {
    216211    var timePos = new Date().getTime();
    217     for(var i=0, len=this.effects.length;i<len;i++) 
     212    for(var i=0, len=this.effects.length;i<len;i++)
    218213      this.effects[i] && this.effects[i].loop(timePos);
    219214  }
     
    224219  get: function(queueName) {
    225220    if (!Object.isString(queueName)) return queueName;
    226    
     221
    227222    return this.instances.get(queueName) ||
    228223      this.instances.set(queueName, new Effect.ScopedQueue());
     
    249244    this.totalTime    = this.finishOn-this.startOn;
    250245    this.totalFrames  = this.options.fps*this.options.duration;
    251    
    252     eval('this.render = function(pos){ '+
    253       'if (this.state=="idle"){this.state="running";'+
    254       codeForEvent(this.options,'beforeSetup')+
    255       (this.setup ? 'this.setup();':'')+
    256       codeForEvent(this.options,'afterSetup')+
    257       '};if (this.state=="running"){'+
    258       'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
    259       'this.position=pos;'+
    260       codeForEvent(this.options,'beforeUpdate')+
    261       (this.update ? 'this.update(pos);':'')+
    262       codeForEvent(this.options,'afterUpdate')+
    263       '}}');
    264    
     246
     247    this.render = (function() {
     248      function dispatch(effect, eventName) {
     249        if (effect.options[eventName + 'Internal'])
     250          effect.options[eventName + 'Internal'](effect);
     251        if (effect.options[eventName])
     252          effect.options[eventName](effect);
     253      }
     254
     255      return function(pos) {
     256        if (this.state === "idle") {
     257          this.state = "running";
     258          dispatch(this, 'beforeSetup');
     259          if (this.setup) this.setup();
     260          dispatch(this, 'afterSetup');
     261        }
     262        if (this.state === "running") {
     263          pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
     264          this.position = pos;
     265          dispatch(this, 'beforeUpdate');
     266          if (this.update) this.update(pos);
     267          dispatch(this, 'afterUpdate');
     268        }
     269      };
     270    })();
     271
    265272    this.event('beforeStart');
    266273    if (!this.options.sync)
    267       Effect.Queues.get(Object.isString(this.options.queue) ? 
     274      Effect.Queues.get(Object.isString(this.options.queue) ?
    268275        'global' : this.options.queue.scope).add(this);
    269276  },
     
    274281        this.cancel();
    275282        this.event('beforeFinish');
    276         if (this.finish) this.finish(); 
     283        if (this.finish) this.finish();
    277284        this.event('afterFinish');
    278         return; 
     285        return;
    279286      }
    280287      var pos   = (timePos - this.startOn) / this.totalTime,
     
    288295  cancel: function() {
    289296    if (!this.options.sync)
    290       Effect.Queues.get(Object.isString(this.options.queue) ? 
     297      Effect.Queues.get(Object.isString(this.options.queue) ?
    291298        'global' : this.options.queue.scope).remove(this);
    292299    this.state = 'finished';
     
    326333  initialize: function(object, from, to) {
    327334    object = Object.isString(object) ? $(object) : object;
    328     var args = $A(arguments), method = args.last(), 
     335    var args = $A(arguments), method = args.last(),
    329336      options = args.length == 5 ? args[3] : null;
    330337    this.method = Object.isFunction(method) ? method.bind(object) :
    331       Object.isFunction(object[method]) ? object[method].bind(object) : 
     338      Object.isFunction(object[method]) ? object[method].bind(object) :
    332339      function(value) { object[method] = value };
    333340    this.start(Object.extend({ from: from, to: to }, options || { }));
     
    393400// for backwards compatibility
    394401Effect.MoveBy = function(element, toTop, toLeft) {
    395   return new Effect.Move(element, 
     402  return new Effect.Move(element,
    396403    Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
    397404};
     
    415422    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
    416423    this.elementPositioning = this.element.getStyle('position');
    417    
     424
    418425    this.originalStyle = { };
    419426    ['top','left','width','height','fontSize'].each( function(k) {
    420427      this.originalStyle[k] = this.element.style[k];
    421428    }.bind(this));
    422      
     429
    423430    this.originalTop  = this.element.offsetTop;
    424431    this.originalLeft = this.element.offsetLeft;
    425    
     432
    426433    var fontSize = this.element.getStyle('font-size') || '100%';
    427434    ['em','px','%','pt'].each( function(fontSizeType) {
     
    431438      }
    432439    }.bind(this));
    433    
     440
    434441    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
    435    
     442
    436443    this.dims = null;
    437444    if (this.options.scaleMode=='box')
     
    508515Effect.ScrollTo = function(element) {
    509516  var options = arguments[1] || { },
    510     scrollOffsets = document.viewport.getScrollOffsets(),
    511     elementOffsets = $(element).cumulativeOffset(),
    512     max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); 
     517  scrollOffsets = document.viewport.getScrollOffsets(),
     518  elementOffsets = $(element).cumulativeOffset();
    513519
    514520  if (options.offset) elementOffsets[1] += options.offset;
     
    516522  return new Effect.Tween(null,
    517523    scrollOffsets.top,
    518     elementOffsets[1] > max ? max : elementOffsets[1],
     524    elementOffsets[1],
    519525    options,
    520     function(p){ scrollTo(scrollOffsets.left, p.round()) }
     526    function(p){ scrollTo(scrollOffsets.left, p.round()); }
    521527  );
    522528};
     
    530536    from: element.getOpacity() || 1.0,
    531537    to:   0.0,
    532     afterFinishInternal: function(effect) { 
     538    afterFinishInternal: function(effect) {
    533539      if (effect.options.to!=0) return;
    534       effect.element.hide().setStyle({opacity: oldOpacity}); 
     540      effect.element.hide().setStyle({opacity: oldOpacity});
    535541    }
    536542  }, arguments[1] || { });
     
    548554  },
    549555  beforeSetup: function(effect) {
    550     effect.element.setOpacity(effect.options.from).show(); 
     556    effect.element.setOpacity(effect.options.from).show();
    551557  }}, arguments[1] || { });
    552558  return new Effect.Opacity(element,options);
     
    555561Effect.Puff = function(element) {
    556562  element = $(element);
    557   var oldStyle = { 
    558     opacity: element.getInlineOpacity(), 
     563  var oldStyle = {
     564    opacity: element.getInlineOpacity(),
    559565    position: element.getStyle('position'),
    560566    top:  element.style.top,
     
    564570  };
    565571  return new Effect.Parallel(
    566    [ new Effect.Scale(element, 200, 
    567       { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
    568      new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
    569      Object.extend({ duration: 1.0, 
     572   [ new Effect.Scale(element, 200,
     573      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
     574     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
     575     Object.extend({ duration: 1.0,
    570576      beforeSetupInternal: function(effect) {
    571         Position.absolutize(effect.effects[0].element)
     577        Position.absolutize(effect.effects[0].element);
    572578      },
    573579      afterFinishInternal: function(effect) {
     
    581587  element.makeClipping();
    582588  return new Effect.Scale(element, 0,
    583     Object.extend({ scaleContent: false, 
    584       scaleX: false, 
     589    Object.extend({ scaleContent: false,
     590      scaleX: false,
    585591      restoreAfterFinish: true,
    586592      afterFinishInternal: function(effect) {
    587593        effect.element.hide().undoClipping();
    588       } 
     594      }
    589595    }, arguments[1] || { })
    590596  );
     
    594600  element = $(element);
    595601  var elementDimensions = element.getDimensions();
    596   return new Effect.Scale(element, 100, Object.extend({ 
    597     scaleContent: false, 
     602  return new Effect.Scale(element, 100, Object.extend({
     603    scaleContent: false,
    598604    scaleX: false,
    599605    scaleFrom: 0,
     
    601607    restoreAfterFinish: true,
    602608    afterSetup: function(effect) {
    603       effect.element.makeClipping().setStyle({height: '0px'}).show(); 
    604     }, 
     609      effect.element.makeClipping().setStyle({height: '0px'}).show();
     610    },
    605611    afterFinishInternal: function(effect) {
    606612      effect.element.undoClipping();
     
    617623    transition: Effect.Transitions.flicker,
    618624    afterFinishInternal: function(effect) {
    619       new Effect.Scale(effect.element, 1, { 
     625      new Effect.Scale(effect.element, 1, {
    620626        duration: 0.3, scaleFromCenter: true,
    621627        scaleX: false, scaleContent: false, restoreAfterFinish: true,
    622         beforeSetup: function(effect) { 
     628        beforeSetup: function(effect) {
    623629          effect.element.makePositioned().makeClipping();
    624630        },
     
    626632          effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
    627633        }
    628       })
     634      });
    629635    }
    630636  }, arguments[1] || { }));
     
    638644    opacity: element.getInlineOpacity() };
    639645  return new Effect.Parallel(
    640     [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
     646    [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
    641647      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
    642648    Object.extend(
    643649      { duration: 0.5,
    644650        beforeSetup: function(effect) {
    645           effect.effects[0].element.makePositioned(); 
     651          effect.effects[0].element.makePositioned();
    646652        },
    647653        afterFinishInternal: function(effect) {
    648654          effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
    649         } 
     655        }
    650656      }, arguments[1] || { }));
    651657};
     
    675681      { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
    676682        effect.element.undoPositioned().setStyle(oldStyle);
    677   }}) }}) }}) }}) }}) }});
     683  }}); }}); }}); }}); }}); }});
    678684};
    679685
     
    683689  var oldInnerBottom = element.down().getStyle('bottom');
    684690  var elementDimensions = element.getDimensions();
    685   return new Effect.Scale(element, 100, Object.extend({ 
    686     scaleContent: false, 
    687     scaleX: false, 
     691  return new Effect.Scale(element, 100, Object.extend({
     692    scaleContent: false,
     693    scaleX: false,
    688694    scaleFrom: window.opera ? 0 : 1,
    689695    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
     
    693699      effect.element.down().makePositioned();
    694700      if (window.opera) effect.element.setStyle({top: ''});
    695       effect.element.makeClipping().setStyle({height: '0px'}).show(); 
     701      effect.element.makeClipping().setStyle({height: '0px'}).show();
    696702    },
    697703    afterUpdateInternal: function(effect) {
    698704      effect.element.down().setStyle({bottom:
    699         (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
     705        (effect.dims[0] - effect.element.clientHeight) + 'px' });
    700706    },
    701707    afterFinishInternal: function(effect) {
     
    711717  var elementDimensions = element.getDimensions();
    712718  return new Effect.Scale(element, window.opera ? 0 : 1,
    713    Object.extend({ scaleContent: false, 
    714     scaleX: false, 
     719   Object.extend({ scaleContent: false,
     720    scaleX: false,
    715721    scaleMode: 'box',
    716722    scaleFrom: 100,
     
    722728      if (window.opera) effect.element.setStyle({top: ''});
    723729      effect.element.makeClipping().show();
    724     }, 
     730    },
    725731    afterUpdateInternal: function(effect) {
    726732      effect.element.down().setStyle({bottom:
     
    735741};
    736742
    737 // Bug in opera makes the TD containing this element expand for a instance after finish 
     743// Bug in opera makes the TD containing this element expand for a instance after finish
    738744Effect.Squish = function(element) {
    739   return new Effect.Scale(element, window.opera ? 1 : 0, { 
     745  return new Effect.Scale(element, window.opera ? 1 : 0, {
    740746    restoreAfterFinish: true,
    741747    beforeSetup: function(effect) {
    742       effect.element.makeClipping(); 
    743     }, 
     748      effect.element.makeClipping();
     749    },
    744750    afterFinishInternal: function(effect) {
    745       effect.element.hide().undoClipping(); 
     751      effect.element.hide().undoClipping();
    746752    }
    747753  });
     
    763769    opacity: element.getInlineOpacity() };
    764770
    765   var dims = element.getDimensions();   
     771  var dims = element.getDimensions();
    766772  var initialMoveX, initialMoveY;
    767773  var moveX, moveY;
    768  
     774
    769775  switch (options.direction) {
    770776    case 'top-left':
    771       initialMoveX = initialMoveY = moveX = moveY = 0; 
     777      initialMoveX = initialMoveY = moveX = moveY = 0;
    772778      break;
    773779    case 'top-right':
     
    794800      break;
    795801  }
    796  
     802
    797803  return new Effect.Move(element, {
    798804    x: initialMoveX,
    799805    y: initialMoveY,
    800     duration: 0.01, 
     806    duration: 0.01,
    801807    beforeSetup: function(effect) {
    802808      effect.element.hide().makeClipping().makePositioned();
     
    807813          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
    808814          new Effect.Scale(effect.element, 100, {
    809             scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
     815            scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
    810816            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
    811817        ], Object.extend({
    812818             beforeSetup: function(effect) {
    813                effect.effects[0].element.setStyle({height: '0px'}).show(); 
     819               effect.effects[0].element.setStyle({height: '0px'}).show();
    814820             },
    815821             afterFinishInternal: function(effect) {
    816                effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
     822               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
    817823             }
    818824           }, options)
    819       )
     825      );
    820826    }
    821827  });
     
    839845  var dims = element.getDimensions();
    840846  var moveX, moveY;
    841  
     847
    842848  switch (options.direction) {
    843849    case 'top-left':
     
    856862      moveY = dims.height;
    857863      break;
    858     case 'center': 
     864    case 'center':
    859865      moveX = dims.width / 2;
    860866      moveY = dims.height / 2;
    861867      break;
    862868  }
    863  
     869
    864870  return new Effect.Parallel(
    865871    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
    866872      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
    867873      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
    868     ], Object.extend({           
     874    ], Object.extend({
    869875         beforeStartInternal: function(effect) {
    870            effect.effects[0].element.makePositioned().makeClipping(); 
     876           effect.effects[0].element.makePositioned().makeClipping();
    871877         },
    872878         afterFinishInternal: function(effect) {
     
    878884Effect.Pulsate = function(element) {
    879885  element = $(element);
    880   var options    = arguments[1] || { };
    881   var oldOpacity = element.getInlineOpacity();
    882   var transition = options.transition || Effect.Transitions.sinoidal;
    883   var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
    884   reverser.bind(transition);
    885   return new Effect.Opacity(element,
     886  var options    = arguments[1] || { },
     887    oldOpacity = element.getInlineOpacity(),
     888    transition = options.transition || Effect.Transitions.linear,
     889    reverser   = function(pos){
     890      return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
     891    };
     892
     893  return new Effect.Opacity(element,
    886894    Object.extend(Object.extend({  duration: 2.0, from: 0,
    887895      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
     
    897905    height: element.style.height };
    898906  element.makeClipping();
    899   return new Effect.Scale(element, 5, Object.extend({   
     907  return new Effect.Scale(element, 5, Object.extend({
    900908    scaleContent: false,
    901909    scaleX: false,
    902910    afterFinishInternal: function(effect) {
    903     new Effect.Scale(element, 1, { 
    904       scaleContent: false, 
     911    new Effect.Scale(element, 1, {
     912      scaleContent: false,
    905913      scaleY: false,
    906914      afterFinishInternal: function(effect) {
     
    917925      style: { }
    918926    }, arguments[1] || { });
    919    
     927
    920928    if (!Object.isString(options.style)) this.style = $H(options.style);
    921929    else {
     
    935943            effect.element.style[transform.style] = '';
    936944          });
    937         }
     945        };
    938946      }
    939947    }
    940948    this.start(options);
    941949  },
    942  
     950
    943951  setup: function(){
    944952    function parseColor(color){
     
    946954      color = color.parseColor();
    947955      return $R(0,2).map(function(i){
    948         return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
     956        return parseInt( color.slice(i*2+1,i*2+3), 16 );
    949957      });
    950958    }
     
    966974
    967975      var originalValue = this.element.getStyle(property);
    968       return { 
    969         style: property.camelize(), 
    970         originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
     976      return {
     977        style: property.camelize(),
     978        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
    971979        targetValue: unit=='color' ? parseColor(value) : value,
    972980        unit: unit
     
    979987          (isNaN(transform.originalValue) || isNaN(transform.targetValue))
    980988        )
    981       )
     989      );
    982990    });
    983991  },
     
    985993    var style = { }, transform, i = this.transforms.length;
    986994    while(i--)
    987       style[(transform = this.transforms[i]).style] = 
     995      style[(transform = this.transforms[i]).style] =
    988996        transform.unit=='color' ? '#'+
    989997          (Math.round(transform.originalValue[0]+
     
    9941002            (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
    9951003        (transform.originalValue +
    996           (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
     1004          (transform.targetValue - transform.originalValue) * position).toFixed(3) +
    9971005            (transform.unit === null ? '' : transform.unit);
    9981006    this.element.setStyle(style, true);
     
    10311039
    10321040Element.CSS_PROPERTIES = $w(
    1033   'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
     1041  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
    10341042  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
    10351043  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
     
    10401048  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
    10411049  'right textIndent top width wordSpacing zIndex');
    1042  
     1050
    10431051Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
    10441052
     
    10521060    style = String.__parseStyleElement.childNodes[0].style;
    10531061  }
    1054  
     1062
    10551063  Element.CSS_PROPERTIES.each(function(property){
    1056     if (style[property]) styleRules.set(property, style[property]); 
     1064    if (style[property]) styleRules.set(property, style[property]);
    10571065  });
    1058  
     1066
    10591067  if (Prototype.Browser.IE && this.include('opacity'))
    10601068    styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
     
    10751083    element = $(element);
    10761084    var css = element.currentStyle, styles;
    1077     styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) {
    1078       hash.set(property, css[property]);
    1079       return hash;
     1085    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
     1086      results[property] = css[property];
     1087      return results;
    10801088    });
    1081     if (!styles.opacity) styles.set('opacity', element.getOpacity());
     1089    if (!styles.opacity) styles.opacity = element.getOpacity();
    10821090    return styles;
    10831091  };
    1084 };
     1092}
    10851093
    10861094Effect.Methods = {
     
    10911099  },
    10921100  visualEffect: function(element, effect, options) {
    1093     element = $(element)
     1101    element = $(element);
    10941102    var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
    10951103    new Effect[klass](element, options);
     
    11051113$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
    11061114  'pulsate shake puff squish switchOff dropOut').each(
    1107   function(effect) { 
     1115  function(effect) {
    11081116    Effect.Methods[effect] = function(element, options){
    11091117      element = $(element);
    11101118      Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
    11111119      return element;
    1112     }
     1120    };
    11131121  }
    11141122);
    11151123
    1116 $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
     1124$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
    11171125  function(f) { Effect.Methods[f] = Element[f]; }
    11181126);
Note: See TracChangeset for help on using the changeset viewer.