| 40 | | create: (function() { |
|---|
| 41 | | var extending = { }; |
|---|
| 42 | | |
|---|
| 43 | | return function(parent, properties) { |
|---|
| 44 | | if (arguments.length == 1 && !Object.isFunction(parent)) |
|---|
| 45 | | properties = parent, parent = null; |
|---|
| 46 | | |
|---|
| 47 | | function klass() { |
|---|
| 48 | | if (arguments[0] !== extending) |
|---|
| 49 | | this.initialize.apply(this, arguments); |
|---|
| 50 | | } |
|---|
| 51 | | |
|---|
| 52 | | klass.superclass = parent; |
|---|
| 53 | | klass.subclasses = []; |
|---|
| 54 | | |
|---|
| 55 | | if (parent) { |
|---|
| 56 | | klass.prototype = new parent(extending); |
|---|
| 57 | | parent.subclasses.push(klass); |
|---|
| 58 | | } |
|---|
| 59 | | |
|---|
| 60 | | if (properties) Class.extend(klass, properties); |
|---|
| 61 | | klass.prototype.constructor = klass; |
|---|
| 62 | | |
|---|
| 63 | | return klass; |
|---|
| 64 | | }; |
|---|
| 65 | | })(), |
|---|
| 66 | | |
|---|
| 67 | | extend: function(destination, source) { |
|---|
| 68 | | var ancestor = destination.superclass && destination.superclass.prototype; |
|---|
| | 40 | create: function() { |
|---|
| | 41 | var parent = null, properties = $A(arguments); |
|---|
| | 42 | if (Object.isFunction(properties[0])) |
|---|
| | 43 | parent = properties.shift(); |
|---|
| | 44 | |
|---|
| | 45 | function klass() { |
|---|
| | 46 | this.initialize.apply(this, arguments); |
|---|
| | 47 | } |
|---|
| | 48 | |
|---|
| | 49 | Object.extend(klass, Class.Methods); |
|---|
| | 50 | klass.superclass = parent; |
|---|
| | 51 | klass.subclasses = []; |
|---|
| | 52 | |
|---|
| | 53 | if (parent) { |
|---|
| | 54 | var subclass = function() { }; |
|---|
| | 55 | subclass.prototype = parent.prototype; |
|---|
| | 56 | klass.prototype = new subclass; |
|---|
| | 57 | parent.subclasses.push(klass); |
|---|
| | 58 | } |
|---|
| | 59 | |
|---|
| | 60 | for (var i = 0; i < properties.length; i++) |
|---|
| | 61 | klass.addMethods(properties[i]); |
|---|
| | 62 | |
|---|
| | 63 | if (!klass.prototype.initialize) |
|---|
| | 64 | klass.prototype.initialize = Prototype.emptyFunction; |
|---|
| | 65 | |
|---|
| | 66 | klass.prototype.constructor = klass; |
|---|
| | 67 | |
|---|
| | 68 | return klass; |
|---|
| | 69 | } |
|---|
| | 70 | }; |
|---|
| | 71 | |
|---|
| | 72 | Class.Methods = { |
|---|
| | 73 | addMethods: function(source) { |
|---|
| | 74 | var ancestor = this.superclass && this.superclass.prototype; |
|---|
| 237 | | return '"' + this.getFullYear() + '-' + |
|---|
| 238 | | (this.getMonth() + 1).toPaddedString(2) + '-' + |
|---|
| 239 | | this.getDate().toPaddedString(2) + 'T' + |
|---|
| 240 | | this.getHours().toPaddedString(2) + ':' + |
|---|
| 241 | | this.getMinutes().toPaddedString(2) + ':' + |
|---|
| 242 | | this.getSeconds().toPaddedString(2) + '"'; |
|---|
| | 239 | return '"' + this.getUTCFullYear() + '-' + |
|---|
| | 240 | (this.getUTCMonth() + 1).toPaddedString(2) + '-' + |
|---|
| | 241 | this.getUTCDate().toPaddedString(2) + 'T' + |
|---|
| | 242 | this.getUTCHours().toPaddedString(2) + ':' + |
|---|
| | 243 | this.getUTCMinutes().toPaddedString(2) + ':' + |
|---|
| | 244 | this.getUTCSeconds().toPaddedString(2) + 'Z"'; |
|---|
| 2147 | | if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ |
|---|
| 2148 | | function iter(name) { |
|---|
| 2149 | | return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; |
|---|
| 2150 | | } |
|---|
| 2151 | | |
|---|
| 2152 | | instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? |
|---|
| 2153 | | function(element, className) { |
|---|
| 2154 | | className = className.toString().strip(); |
|---|
| 2155 | | var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); |
|---|
| 2156 | | return cond ? document._getElementsByXPath('.//*' + cond, element) : []; |
|---|
| 2157 | | } : function(element, className) { |
|---|
| 2158 | | className = className.toString().strip(); |
|---|
| 2159 | | var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); |
|---|
| 2160 | | if (!classNames && !className) return elements; |
|---|
| 2161 | | |
|---|
| 2162 | | var nodes = $(element).getElementsByTagName('*'); |
|---|
| 2163 | | className = ' ' + className + ' '; |
|---|
| 2164 | | |
|---|
| 2165 | | for (var i = 0, child, cn; child = nodes[i]; i++) { |
|---|
| 2166 | | if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || |
|---|
| 2167 | | (classNames && classNames.all(function(name) { |
|---|
| 2168 | | return !name.toString().blank() && cn.include(' ' + name + ' '); |
|---|
| 2169 | | })))) |
|---|
| 2170 | | elements.push(Element.extend(child)); |
|---|
| 2171 | | } |
|---|
| 2172 | | return elements; |
|---|
| 2173 | | }; |
|---|
| 2174 | | |
|---|
| 2175 | | return function(className, parentElement) { |
|---|
| 2176 | | return $(parentElement || document.body).getElementsByClassName(className); |
|---|
| 2177 | | }; |
|---|
| 2178 | | }(Element.Methods); |
|---|
| 2179 | | |
|---|
| 3715 | | DOMEvents: ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', |
|---|
| 3716 | | 'mousemove', 'mouseout', 'keypress', 'keydown', 'keyup', |
|---|
| 3717 | | 'load', 'unload', 'abort', 'error', 'resize', 'scroll', |
|---|
| 3718 | | 'select', 'change', 'submit', 'reset', 'focus', 'blur', |
|---|
| 3719 | | 'contextmenu'], |
|---|
| 3720 | | |
|---|
| | 4070 | if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ |
|---|
| | 4071 | function iter(name) { |
|---|
| | 4072 | return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; |
|---|
| | 4073 | } |
|---|
| | 4074 | |
|---|
| | 4075 | instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? |
|---|
| | 4076 | function(element, className) { |
|---|
| | 4077 | className = className.toString().strip(); |
|---|
| | 4078 | var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); |
|---|
| | 4079 | return cond ? document._getElementsByXPath('.//*' + cond, element) : []; |
|---|
| | 4080 | } : function(element, className) { |
|---|
| | 4081 | className = className.toString().strip(); |
|---|
| | 4082 | var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); |
|---|
| | 4083 | if (!classNames && !className) return elements; |
|---|
| | 4084 | |
|---|
| | 4085 | var nodes = $(element).getElementsByTagName('*'); |
|---|
| | 4086 | className = ' ' + className + ' '; |
|---|
| | 4087 | |
|---|
| | 4088 | for (var i = 0, child, cn; child = nodes[i]; i++) { |
|---|
| | 4089 | if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || |
|---|
| | 4090 | (classNames && classNames.all(function(name) { |
|---|
| | 4091 | return !name.toString().blank() && cn.include(' ' + name + ' '); |
|---|
| | 4092 | })))) |
|---|
| | 4093 | elements.push(Element.extend(child)); |
|---|
| | 4094 | } |
|---|
| | 4095 | return elements; |
|---|
| | 4096 | }; |
|---|
| | 4097 | |
|---|
| | 4098 | return function(className, parentElement) { |
|---|
| | 4099 | return $(parentElement || document.body).getElementsByClassName(className); |
|---|
| | 4100 | }; |
|---|
| | 4101 | }(Element.Methods); |
|---|
| | 4102 | |
|---|
| | 4103 | /*--------------------------------------------------------------------------*/ |
|---|
| | 4104 | |
|---|