[ Index ] |
PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09) |
[Summary view] [Print] [Text view]
1 $A = function(iterable, start, length){ 2 if (Browser.Engine.trident && $type(iterable) == 'collection'){ 3 start = start || 0; 4 if (start < 0) start = iterable.length + start; 5 length = length || (iterable.length - start); 6 var array = []; 7 for (var i = 0; i < length; i++) array[i] = iterable[start++]; 8 return array; 9 } 10 start = (start || 0) + ((start < 0) ? iterable.length : 0); 11 var end = ((!$chk(length)) ? iterable.length : length) + start; 12 return Array.prototype.slice.call(iterable, start, end); 13 }; 14 15 (function(){ 16 var natives = [Array, Function, String, RegExp, Number]; 17 for (var i = 0, l = natives.length; i < l; i++) natives[i].extend = natives[i].implement; 18 })(); 19 20 window.extend = document.extend = function(properties){ 21 for (var property in properties) this[property] = properties[property]; 22 }; 23 24 window[Browser.Engine.name] = window[Browser.Engine.name + Browser.Engine.version] = true; 25 26 window.ie = window.trident; 27 window.ie6 = window.trident4; 28 window.ie7 = window.trident5; 29 30 Class.empty = $empty; 31 32 //legacy .extend support 33 34 Class.prototype.extend = function(properties){ 35 properties.Extends = this; 36 return new Class(properties); 37 }; 38 39 Array.implement({ 40 41 copy: function(start, length){ 42 return $A(this, start, length); 43 } 44 45 }); 46 47 Array.alias({erase: 'remove', combine: 'merge'}); 48 49 Function.extend({ 50 51 bindAsEventListener: function(bind, args){ 52 return this.create({'bind': bind, 'event': true, 'arguments': args}); 53 } 54 55 }); 56 57 Function.empty = $empty; 58 59 Hash.alias({getKeys: 'keys', getValues: 'values', has: 'hasKey', combine: 'merge'}); 60 var Abstract = Hash; 61 62 Element.extend = Element.implement; 63 64 Elements.extend = Elements.implement; 65 66 Element.implement({ 67 68 getFormElements: function(){ 69 return this.getElements('input, textarea, select'); 70 }, 71 72 replaceWith: function(el){ 73 el = $(el); 74 this.parentNode.replaceChild(el, this); 75 return el; 76 }, 77 78 removeElements: function(){ 79 return this.dispose(); 80 } 81 82 }); 83 84 Element.alias({'dispose': 'remove', 'getLast': 'getLastChild'}); 85 86 Element.implement({ 87 88 getText: function(){ 89 return this.get('text'); 90 }, 91 92 setText: function(text){ 93 return this.set('text', text); 94 }, 95 96 setHTML: function(){ 97 return this.set('html', arguments); 98 }, 99 100 getHTML: function(){ 101 return this.get('html'); 102 }, 103 104 getTag: function(){ 105 return this.get('tag'); 106 } 107 108 }); 109 110 Event.keys = Event.Keys; 111 112 Element.implement({ 113 114 setOpacity: function(op){ 115 return this.set('opacity', op); 116 } 117 118 }); 119 120 Object.toQueryString = Hash.toQueryString; 121 122 var XHR = new Class({ 123 124 Extends: Request, 125 126 options: { 127 update: false 128 }, 129 130 initialize: function(url, options){ 131 this.parent(options); 132 this.url = url; 133 }, 134 135 request: function(data){ 136 return this.send(this.url, data || this.options.data); 137 }, 138 139 send: function(url, data){ 140 if (!this.check(arguments.callee, url, data)) return this; 141 return this.parent({url: url, data: data}); 142 }, 143 144 success: function(text, xml){ 145 text = this.processScripts(text); 146 if (this.options.update) $(this.options.update).empty().set('html', text); 147 this.onSuccess(text, xml); 148 }, 149 150 failure: function(){ 151 this.fireEvent('failure', this.xhr); 152 } 153 154 }); 155 156 var Ajax = XHR; 157 158 JSON.Remote = new Class({ 159 160 options: { 161 key: 'json' 162 }, 163 164 Extends: Request.JSON, 165 166 initialize: function(url, options){ 167 this.parent(options); 168 this.onComplete = $empty; 169 this.url = url; 170 }, 171 172 send: function(data){ 173 if (!this.check(arguments.callee, data)) return this; 174 return this.parent({url: this.url, data: {json: Json.encode(data)}}); 175 }, 176 177 failure: function(){ 178 this.fireEvent('failure', this.xhr); 179 } 180 181 }); 182 183 Fx.implement({ 184 185 custom: function(from, to){ 186 return this.start(from, to); 187 }, 188 189 clearTimer: function(){ 190 return this.cancel(); 191 }, 192 193 stop: function(){ 194 return this.cancel(); 195 } 196 197 }); 198 199 Fx.Base = Fx; 200 201 Fx.Style = function(element, property, options){ 202 return new Fx.Tween(element, $extend({property: property}, options)); 203 }; 204 205 Element.implement({ 206 207 effect: function(property, options){ 208 return new Fx.Tween(this, $extend({property: property}, options)); 209 } 210 211 }); 212 213 Fx.Styles = Fx.Morph; 214 215 Element.implement({ 216 217 effects: function(options){ 218 return new Fx.Morph(this, options); 219 } 220 221 }); 222 223 Native.implement([Element, Document], { 224 225 getElementsByClassName: function(className){ 226 return this.getElements('.' + className); 227 }, 228 229 getElementsBySelector: function(selector){ 230 return this.getElements(selector); 231 } 232 233 }); 234 235 Elements.implement({ 236 237 filterByTag: function(tag){ 238 return this.filter(tag); 239 }, 240 241 filterByClass: function(className){ 242 return this.filter('.' + className); 243 }, 244 245 filterById: function(id){ 246 return this.filter('#' + id); 247 }, 248 249 filterByAttribute: function(name, operator, value){ 250 return this.filter('[' + name + (operator || '') + (value || '') + ']'); 251 } 252 253 }); 254 255 var $E = function(selector, filter){ 256 return ($(filter) || document).getElement(selector); 257 }; 258 259 var $ES = function(selector, filter){ 260 return ($(filter) || document).getElements(selector); 261 }; 262 263 var Json = JSON; 264 265 JSON.toString = JSON.encode; 266 JSON.evaluate = JSON.decode; 267 268 Cookie.set = function(key, value, options){ 269 return new Cookie(key, options).write(value); 270 }; 271 272 Cookie.get = function(key){ 273 return new Cookie(key).read(); 274 }; 275 276 Cookie.remove = function(key, options){ 277 return new Cookie(key, options).dispose(); 278 };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 30 05:55:15 2009 | Cross-referenced by PHPXref 0.7 |