2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
13 getViewWidth : function(full) {
\r
14 return full ? this.getDocumentWidth() : this.getViewportWidth();
\r
17 getViewHeight : function(full) {
\r
18 return full ? this.getDocumentHeight() : this.getViewportHeight();
\r
21 getDocumentHeight: function() {
\r
22 var scrollHeight = (document.compatMode != "CSS1Compat") ? document.body.scrollHeight : document.documentElement.scrollHeight;
\r
23 return Math.max(scrollHeight, this.getViewportHeight());
\r
26 getDocumentWidth: function() {
\r
27 var scrollWidth = (document.compatMode != "CSS1Compat") ? document.body.scrollWidth : document.documentElement.scrollWidth;
\r
28 return Math.max(scrollWidth, this.getViewportWidth());
\r
31 getViewportHeight: function(){
\r
33 return Ext.isStrict ? document.documentElement.clientHeight :
\r
34 document.body.clientHeight;
\r
36 return self.innerHeight;
\r
40 getViewportWidth: function() {
\r
42 return Ext.isStrict ? document.documentElement.clientWidth :
\r
43 document.body.clientWidth;
\r
45 return self.innerWidth;
\r
49 isAncestor : function(p, c) {
\r
56 if (p.contains && !Ext.isSafari) {
\r
57 return p.contains(c);
\r
58 } else if (p.compareDocumentPosition) {
\r
59 return !!(p.compareDocumentPosition(c) & 16);
\r
61 var parent = c.parentNode;
\r
66 else if (!parent.tagName || parent.tagName.toUpperCase() == "HTML") {
\r
69 parent = parent.parentNode;
\r
75 getRegion : function(el) {
\r
76 return Ext.lib.Region.getRegion(el);
\r
79 getY : function(el) {
\r
80 return this.getXY(el)[1];
\r
83 getX : function(el) {
\r
84 return this.getXY(el)[0];
\r
88 getXY : function(el) {
\r
89 var p, pe, b, scroll, bd = (document.body || document.documentElement);
\r
90 el = Ext.getDom(el);
\r
96 if (el.getBoundingClientRect) {
\r
97 b = el.getBoundingClientRect();
\r
98 scroll = fly(document).getScroll();
\r
99 return [b.left + scroll.left, b.top + scroll.top];
\r
105 var hasAbsolute = fly(el).getStyle("position") == "absolute";
\r
112 if (!hasAbsolute && fly(p).getStyle("position") == "absolute") {
\r
113 hasAbsolute = true;
\r
119 var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
\r
120 var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
\r
127 if (p != el && pe.getStyle('overflow') != 'visible') {
\r
132 p = p.offsetParent;
\r
135 if (Ext.isSafari && hasAbsolute) {
\r
136 x -= bd.offsetLeft;
\r
140 if (Ext.isGecko && !hasAbsolute) {
\r
142 x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
\r
143 y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
\r
147 while (p && p != bd) {
\r
148 if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) {
\r
157 setXY : function(el, xy) {
\r
158 el = Ext.fly(el, '_setXY');
\r
160 var pts = el.translatePoints(xy);
\r
161 if (xy[0] !== false) {
\r
162 el.dom.style.left = pts.left + "px";
\r
164 if (xy[1] !== false) {
\r
165 el.dom.style.top = pts.top + "px";
\r
169 setX : function(el, x) {
\r
170 this.setXY(el, [x, false]);
\r
173 setY : function(el, y) {
\r
174 this.setXY(el, [false, y]);
\r
179 * Portions of this file are based on pieces of Yahoo User Interface Library
\r
180 * Copyright (c) 2007, Yahoo! Inc. All rights reserved.
\r
181 * YUI licensed under the BSD License:
\r
182 * http://developer.yahoo.net/yui/license.txt
\r
184 Ext.lib.Event = function() {
\r
185 var loadComplete = false;
\r
186 var listeners = [];
\r
187 var unloadListeners = [];
\r
188 var retryCount = 0;
\r
189 var onAvailStack = [];
\r
191 var lastError = null;
\r
204 startInterval: function() {
\r
205 if (!this._interval) {
\r
207 var callback = function() {
\r
208 self._tryPreloadAttach();
\r
210 this._interval = setInterval(callback, this.POLL_INTERVAL);
\r
215 onAvailable: function(p_id, p_fn, p_obj, p_override) {
\r
216 onAvailStack.push({ id: p_id,
\r
219 override: p_override,
\r
220 checkReady: false });
\r
222 retryCount = this.POLL_RETRYS;
\r
223 this.startInterval();
\r
227 addListener: function(el, eventName, fn) {
\r
228 el = Ext.getDom(el);
\r
233 if ("unload" == eventName) {
\r
234 unloadListeners[unloadListeners.length] =
\r
235 [el, eventName, fn];
\r
239 // prevent unload errors with simple check
\r
240 var wrappedFn = function(e) {
\r
241 return typeof Ext != 'undefined' ? fn(Ext.lib.Event.getEvent(e)) : false;
\r
244 var li = [el, eventName, fn, wrappedFn];
\r
246 var index = listeners.length;
\r
247 listeners[index] = li;
\r
249 this.doAdd(el, eventName, wrappedFn, false);
\r
255 removeListener: function(el, eventName, fn) {
\r
258 el = Ext.getDom(el);
\r
261 return this.purgeElement(el, false, eventName);
\r
265 if ("unload" == eventName) {
\r
267 for (i = 0,len = unloadListeners.length; i < len; i++) {
\r
268 var li = unloadListeners[i];
\r
271 li[1] == eventName &&
\r
273 unloadListeners.splice(i, 1);
\r
281 var cacheItem = null;
\r
284 var index = arguments[3];
\r
286 if ("undefined" == typeof index) {
\r
287 index = this._getCacheIndex(el, eventName, fn);
\r
291 cacheItem = listeners[index];
\r
294 if (!el || !cacheItem) {
\r
298 this.doRemove(el, eventName, cacheItem[this.WFN], false);
\r
300 delete listeners[index][this.WFN];
\r
301 delete listeners[index][this.FN];
\r
302 listeners.splice(index, 1);
\r
309 getTarget: function(ev, resolveTextNode) {
\r
310 ev = ev.browserEvent || ev;
\r
311 var t = ev.target || ev.srcElement;
\r
312 return this.resolveTextNode(t);
\r
316 resolveTextNode: function(node) {
\r
317 if (Ext.isSafari && node && 3 == node.nodeType) {
\r
318 return node.parentNode;
\r
325 getPageX: function(ev) {
\r
326 ev = ev.browserEvent || ev;
\r
328 if (!x && 0 !== x) {
\r
329 x = ev.clientX || 0;
\r
332 x += this.getScroll()[1];
\r
340 getPageY: function(ev) {
\r
341 ev = ev.browserEvent || ev;
\r
343 if (!y && 0 !== y) {
\r
344 y = ev.clientY || 0;
\r
347 y += this.getScroll()[0];
\r
356 getXY: function(ev) {
\r
357 ev = ev.browserEvent || ev;
\r
358 return [this.getPageX(ev), this.getPageY(ev)];
\r
362 getRelatedTarget: function(ev) {
\r
363 ev = ev.browserEvent || ev;
\r
364 var t = ev.relatedTarget;
\r
366 if (ev.type == "mouseout") {
\r
368 } else if (ev.type == "mouseover") {
\r
369 t = ev.fromElement;
\r
373 return this.resolveTextNode(t);
\r
377 getTime: function(ev) {
\r
378 ev = ev.browserEvent || ev;
\r
380 var t = new Date().getTime();
\r
384 this.lastError = ex;
\r
393 stopEvent: function(ev) {
\r
394 this.stopPropagation(ev);
\r
395 this.preventDefault(ev);
\r
399 stopPropagation: function(ev) {
\r
400 ev = ev.browserEvent || ev;
\r
401 if (ev.stopPropagation) {
\r
402 ev.stopPropagation();
\r
404 ev.cancelBubble = true;
\r
409 preventDefault: function(ev) {
\r
410 ev = ev.browserEvent || ev;
\r
411 if(ev.preventDefault) {
\r
412 ev.preventDefault();
\r
414 ev.returnValue = false;
\r
419 getEvent: function(e) {
\r
420 var ev = e || window.event;
\r
422 var c = this.getEvent.caller;
\r
424 ev = c.arguments[0];
\r
425 if (ev && Event == ev.constructor) {
\r
435 getCharCode: function(ev) {
\r
436 ev = ev.browserEvent || ev;
\r
437 return ev.charCode || ev.keyCode || 0;
\r
441 _getCacheIndex: function(el, eventName, fn) {
\r
442 for (var i = 0,len = listeners.length; i < len; ++i) {
\r
443 var li = listeners[i];
\r
445 li[this.FN] == fn &&
\r
446 li[this.EL] == el &&
\r
447 li[this.TYPE] == eventName) {
\r
459 getEl: function(id) {
\r
460 return document.getElementById(id);
\r
464 clearCache: function() {
\r
468 _load: function(e) {
\r
469 loadComplete = true;
\r
470 var EU = Ext.lib.Event;
\r
474 EU.doRemove(window, "load", EU._load);
\r
479 _tryPreloadAttach: function() {
\r
485 this.locked = true;
\r
488 var tryAgain = !loadComplete;
\r
490 tryAgain = (retryCount > 0);
\r
495 for (var i = 0,len = onAvailStack.length; i < len; ++i) {
\r
496 var item = onAvailStack[i];
\r
498 var el = this.getEl(item.id);
\r
501 if (!item.checkReady ||
\r
504 (document && document.body)) {
\r
507 if (item.override) {
\r
508 if (item.override === true) {
\r
511 scope = item.override;
\r
514 item.fn.call(scope, item.obj);
\r
515 onAvailStack[i] = null;
\r
518 notAvail.push(item);
\r
523 retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;
\r
527 this.startInterval();
\r
529 clearInterval(this._interval);
\r
530 this._interval = null;
\r
533 this.locked = false;
\r
540 purgeElement: function(el, recurse, eventName) {
\r
541 var elListeners = this.getListeners(el, eventName);
\r
543 for (var i = 0,len = elListeners.length; i < len; ++i) {
\r
544 var l = elListeners[i];
\r
545 this.removeListener(el, l.type, l.fn);
\r
549 if (recurse && el && el.childNodes) {
\r
550 for (i = 0,len = el.childNodes.length; i < len; ++i) {
\r
551 this.purgeElement(el.childNodes[i], recurse, eventName);
\r
557 getListeners: function(el, eventName) {
\r
558 var results = [], searchLists;
\r
560 searchLists = [listeners, unloadListeners];
\r
561 } else if (eventName == "unload") {
\r
562 searchLists = [unloadListeners];
\r
564 searchLists = [listeners];
\r
567 for (var j = 0; j < searchLists.length; ++j) {
\r
568 var searchList = searchLists[j];
\r
569 if (searchList && searchList.length > 0) {
\r
570 for (var i = 0,len = searchList.length; i < len; ++i) {
\r
571 var l = searchList[i];
\r
572 if (l && l[this.EL] === el &&
\r
573 (!eventName || eventName === l[this.TYPE])) {
\r
575 type: l[this.TYPE],
\r
578 adjust: l[this.ADJ_SCOPE],
\r
586 return (results.length) ? results : null;
\r
590 _unload: function(e) {
\r
592 var EU = Ext.lib.Event, i, j, l, len, index;
\r
594 for (i = 0,len = unloadListeners.length; i < len; ++i) {
\r
595 l = unloadListeners[i];
\r
597 var scope = window;
\r
598 if (l[EU.ADJ_SCOPE]) {
\r
599 if (l[EU.ADJ_SCOPE] === true) {
\r
602 scope = l[EU.ADJ_SCOPE];
\r
605 l[EU.FN].call(scope, EU.getEvent(e), l[EU.OBJ]);
\r
606 unloadListeners[i] = null;
\r
612 unloadListeners = null;
\r
614 if (listeners && listeners.length > 0) {
\r
615 j = listeners.length;
\r
618 l = listeners[index];
\r
620 EU.removeListener(l[EU.EL], l[EU.TYPE],
\r
630 EU.doRemove(window, "unload", EU._unload);
\r
635 getScroll: function() {
\r
636 var dd = document.documentElement, db = document.body;
\r
637 if (dd && (dd.scrollTop || dd.scrollLeft)) {
\r
638 return [dd.scrollTop, dd.scrollLeft];
\r
640 return [db.scrollTop, db.scrollLeft];
\r
647 doAdd: function () {
\r
648 if (window.addEventListener) {
\r
649 return function(el, eventName, fn, capture) {
\r
650 el.addEventListener(eventName, fn, (capture));
\r
652 } else if (window.attachEvent) {
\r
653 return function(el, eventName, fn, capture) {
\r
654 el.attachEvent("on" + eventName, fn);
\r
657 return function() {
\r
663 doRemove: function() {
\r
664 if (window.removeEventListener) {
\r
665 return function (el, eventName, fn, capture) {
\r
666 el.removeEventListener(eventName, fn, (capture));
\r
668 } else if (window.detachEvent) {
\r
669 return function (el, eventName, fn) {
\r
670 el.detachEvent("on" + eventName, fn);
\r
673 return function() {
\r
681 var E = Ext.lib.Event;
\r
682 E.on = E.addListener;
\r
683 E.un = E.removeListener;
\r
684 if(document && document.body) {
\r
687 E.doAdd(window, "load", E._load);
\r
689 E.doAdd(window, "unload", E._unload);
\r
690 E._tryPreloadAttach();
\r
693 request : function(method, uri, cb, data, options) {
\r
695 var hs = options.headers;
\r
698 if(hs.hasOwnProperty(h)){
\r
699 this.initHeader(h, hs[h], false);
\r
703 if(options.xmlData){
\r
704 if (!hs || !hs['Content-Type']){
\r
705 this.initHeader('Content-Type', 'text/xml', false);
\r
707 method = (method ? method : (options.method ? options.method : 'POST'));
\r
708 data = options.xmlData;
\r
709 }else if(options.jsonData){
\r
710 if (!hs || !hs['Content-Type']){
\r
711 this.initHeader('Content-Type', 'application/json', false);
\r
713 method = (method ? method : (options.method ? options.method : 'POST'));
\r
714 data = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
\r
718 return this.asyncRequest(method, uri, cb, data);
\r
721 serializeForm : function(form) {
\r
722 if(typeof form == 'string') {
\r
723 form = (document.getElementById(form) || document.forms[form]);
\r
726 var el, name, val, disabled, data = '', hasSubmit = false;
\r
727 for (var i = 0; i < form.elements.length; i++) {
\r
728 el = form.elements[i];
\r
729 disabled = form.elements[i].disabled;
\r
730 name = form.elements[i].name;
\r
731 val = form.elements[i].value;
\r
733 if (!disabled && name){
\r
737 case 'select-multiple':
\r
738 for (var j = 0; j < el.options.length; j++) {
\r
739 if (el.options[j].selected) {
\r
741 data += encodeURIComponent(name) + '=' + encodeURIComponent(el.options[j].attributes['value'].specified ? el.options[j].value : el.options[j].text) + '&';
\r
744 data += encodeURIComponent(name) + '=' + encodeURIComponent(el.options[j].hasAttribute('value') ? el.options[j].value : el.options[j].text) + '&';
\r
752 data += encodeURIComponent(name) + '=' + encodeURIComponent(val) + '&';
\r
765 if(hasSubmit == false) {
\r
766 data += encodeURIComponent(name) + '=' + encodeURIComponent(val) + '&';
\r
771 data += encodeURIComponent(name) + '=' + encodeURIComponent(val) + '&';
\r
776 data = data.substr(0, data.length - 1);
\r
784 useDefaultHeader:true,
\r
786 defaultPostHeader:'application/x-www-form-urlencoded; charset=UTF-8',
\r
788 useDefaultXhrHeader:true,
\r
790 defaultXhrHeader:'XMLHttpRequest',
\r
792 hasDefaultHeaders:true,
\r
804 setProgId:function(id)
\r
806 this.activeX.unshift(id);
\r
809 setDefaultPostHeader:function(b)
\r
811 this.useDefaultHeader = b;
\r
814 setDefaultXhrHeader:function(b)
\r
816 this.useDefaultXhrHeader = b;
\r
819 setPollingInterval:function(i)
\r
821 if (typeof i == 'number' && isFinite(i)) {
\r
822 this.pollInterval = i;
\r
826 createXhrObject:function(transactionId)
\r
832 http = new XMLHttpRequest();
\r
834 obj = { conn:http, tId:transactionId };
\r
838 for (var i = 0; i < this.activeX.length; ++i) {
\r
842 http = new ActiveXObject(this.activeX[i]);
\r
844 obj = { conn:http, tId:transactionId };
\r
857 getConnectionObject:function()
\r
860 var tId = this.transactionId;
\r
864 o = this.createXhrObject(tId);
\r
866 this.transactionId++;
\r
877 asyncRequest:function(method, uri, callback, postData)
\r
879 var o = this.getConnectionObject();
\r
885 o.conn.open(method, uri, true);
\r
887 if (this.useDefaultXhrHeader) {
\r
888 if (!this.defaultHeaders['X-Requested-With']) {
\r
889 this.initHeader('X-Requested-With', this.defaultXhrHeader, true);
\r
893 if(postData && this.useDefaultHeader && (!this.hasHeaders || !this.headers['Content-Type'])){
\r
894 this.initHeader('Content-Type', this.defaultPostHeader);
\r
897 if (this.hasDefaultHeaders || this.hasHeaders) {
\r
901 this.handleReadyState(o, callback);
\r
902 o.conn.send(postData || null);
\r
908 handleReadyState:function(o, callback)
\r
912 if (callback && callback.timeout) {
\r
913 this.timeout[o.tId] = window.setTimeout(function() {
\r
914 oConn.abort(o, callback, true);
\r
915 }, callback.timeout);
\r
918 this.poll[o.tId] = window.setInterval(
\r
920 if (o.conn && o.conn.readyState == 4) {
\r
921 window.clearInterval(oConn.poll[o.tId]);
\r
922 delete oConn.poll[o.tId];
\r
924 if (callback && callback.timeout) {
\r
925 window.clearTimeout(oConn.timeout[o.tId]);
\r
926 delete oConn.timeout[o.tId];
\r
929 oConn.handleTransactionResponse(o, callback);
\r
932 , this.pollInterval);
\r
935 handleTransactionResponse:function(o, callback, isAbort)
\r
939 this.releaseObject(o);
\r
943 var httpStatus, responseObject;
\r
947 if (o.conn.status !== undefined && o.conn.status != 0) {
\r
948 httpStatus = o.conn.status;
\r
951 httpStatus = 13030;
\r
957 httpStatus = 13030;
\r
960 if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) {
\r
961 responseObject = this.createResponseObject(o, callback.argument);
\r
962 if (callback.success) {
\r
963 if (!callback.scope) {
\r
964 callback.success(responseObject);
\r
969 callback.success.apply(callback.scope, [responseObject]);
\r
974 switch (httpStatus) {
\r
982 responseObject = this.createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false));
\r
983 if (callback.failure) {
\r
984 if (!callback.scope) {
\r
985 callback.failure(responseObject);
\r
988 callback.failure.apply(callback.scope, [responseObject]);
\r
993 responseObject = this.createResponseObject(o, callback.argument);
\r
994 if (callback.failure) {
\r
995 if (!callback.scope) {
\r
996 callback.failure(responseObject);
\r
999 callback.failure.apply(callback.scope, [responseObject]);
\r
1005 this.releaseObject(o);
\r
1006 responseObject = null;
\r
1009 createResponseObject:function(o, callbackArg)
\r
1012 var headerObj = {};
\r
1016 var headerStr = o.conn.getAllResponseHeaders();
\r
1017 var header = headerStr.split('\n');
\r
1018 for (var i = 0; i < header.length; i++) {
\r
1019 var delimitPos = header[i].indexOf(':');
\r
1020 if (delimitPos != -1) {
\r
1021 headerObj[header[i].substring(0, delimitPos)] = header[i].substring(delimitPos + 2);
\r
1029 obj.status = o.conn.status;
\r
1030 obj.statusText = o.conn.statusText;
\r
1031 obj.getResponseHeader = headerObj;
\r
1032 obj.getAllResponseHeaders = headerStr;
\r
1033 obj.responseText = o.conn.responseText;
\r
1034 obj.responseXML = o.conn.responseXML;
\r
1036 if (typeof callbackArg !== undefined) {
\r
1037 obj.argument = callbackArg;
\r
1043 createExceptionObject:function(tId, callbackArg, isAbort)
\r
1045 var COMM_CODE = 0;
\r
1046 var COMM_ERROR = 'communication failure';
\r
1047 var ABORT_CODE = -1;
\r
1048 var ABORT_ERROR = 'transaction aborted';
\r
1054 obj.status = ABORT_CODE;
\r
1055 obj.statusText = ABORT_ERROR;
\r
1058 obj.status = COMM_CODE;
\r
1059 obj.statusText = COMM_ERROR;
\r
1062 if (callbackArg) {
\r
1063 obj.argument = callbackArg;
\r
1069 initHeader:function(label, value, isDefault)
\r
1071 var headerObj = (isDefault) ? this.defaultHeaders : this.headers;
\r
1073 if (headerObj[label] === undefined) {
\r
1074 headerObj[label] = value;
\r
1079 headerObj[label] = value + "," + headerObj[label];
\r
1083 this.hasDefaultHeaders = true;
\r
1086 this.hasHeaders = true;
\r
1091 setHeader:function(o)
\r
1093 if (this.hasDefaultHeaders) {
\r
1094 for (var prop in this.defaultHeaders) {
\r
1095 if (this.defaultHeaders.hasOwnProperty(prop)) {
\r
1096 o.conn.setRequestHeader(prop, this.defaultHeaders[prop]);
\r
1101 if (this.hasHeaders) {
\r
1102 for (var prop in this.headers) {
\r
1103 if (this.headers.hasOwnProperty(prop)) {
\r
1104 o.conn.setRequestHeader(prop, this.headers[prop]);
\r
1107 this.headers = {};
\r
1108 this.hasHeaders = false;
\r
1112 resetDefaultHeaders:function() {
\r
1113 delete this.defaultHeaders;
\r
1114 this.defaultHeaders = {};
\r
1115 this.hasDefaultHeaders = false;
\r
1118 abort:function(o, callback, isTimeout)
\r
1120 if (this.isCallInProgress(o)) {
\r
1122 window.clearInterval(this.poll[o.tId]);
\r
1123 delete this.poll[o.tId];
\r
1125 delete this.timeout[o.tId];
\r
1128 this.handleTransactionResponse(o, callback, true);
\r
1138 isCallInProgress:function(o)
\r
1143 return o.conn.readyState != 4 && o.conn.readyState != 0;
\r
1152 releaseObject:function(o)
\r
1161 'MSXML2.XMLHTTP.3.0',
\r
1163 'Microsoft.XMLHTTP'
\r
1170 Ext.lib.Region = function(t, r, b, l) {
\r
1179 Ext.lib.Region.prototype = {
\r
1180 contains : function(region) {
\r
1181 return ( region.left >= this.left &&
\r
1182 region.right <= this.right &&
\r
1183 region.top >= this.top &&
\r
1184 region.bottom <= this.bottom );
\r
1188 getArea : function() {
\r
1189 return ( (this.bottom - this.top) * (this.right - this.left) );
\r
1192 intersect : function(region) {
\r
1193 var t = Math.max(this.top, region.top);
\r
1194 var r = Math.min(this.right, region.right);
\r
1195 var b = Math.min(this.bottom, region.bottom);
\r
1196 var l = Math.max(this.left, region.left);
\r
1198 if (b >= t && r >= l) {
\r
1199 return new Ext.lib.Region(t, r, b, l);
\r
1204 union : function(region) {
\r
1205 var t = Math.min(this.top, region.top);
\r
1206 var r = Math.max(this.right, region.right);
\r
1207 var b = Math.max(this.bottom, region.bottom);
\r
1208 var l = Math.min(this.left, region.left);
\r
1210 return new Ext.lib.Region(t, r, b, l);
\r
1213 constrainTo : function(r) {
\r
1214 this.top = this.top.constrain(r.top, r.bottom);
\r
1215 this.bottom = this.bottom.constrain(r.top, r.bottom);
\r
1216 this.left = this.left.constrain(r.left, r.right);
\r
1217 this.right = this.right.constrain(r.left, r.right);
\r
1221 adjust : function(t, l, b, r) {
\r
1230 Ext.lib.Region.getRegion = function(el) {
\r
1231 var p = Ext.lib.Dom.getXY(el);
\r
1234 var r = p[0] + el.offsetWidth;
\r
1235 var b = p[1] + el.offsetHeight;
\r
1238 return new Ext.lib.Region(t, r, b, l);
\r
1241 Ext.lib.Point = function(x, y) {
\r
1242 if (Ext.isArray(x)) {
\r
1246 this.x = this.right = this.left = this[0] = x;
\r
1247 this.y = this.top = this.bottom = this[1] = y;
\r
1250 Ext.lib.Point.prototype = new Ext.lib.Region();
\r
1254 scroll : function(el, args, duration, easing, cb, scope) {
\r
1255 return this.run(el, args, duration, easing, cb, scope, Ext.lib.Scroll);
\r
1258 motion : function(el, args, duration, easing, cb, scope) {
\r
1259 return this.run(el, args, duration, easing, cb, scope, Ext.lib.Motion);
\r
1262 color : function(el, args, duration, easing, cb, scope) {
\r
1263 return this.run(el, args, duration, easing, cb, scope, Ext.lib.ColorAnim);
\r
1266 run : function(el, args, duration, easing, cb, scope, type) {
\r
1267 type = type || Ext.lib.AnimBase;
\r
1268 if (typeof easing == "string") {
\r
1269 easing = Ext.lib.Easing[easing];
\r
1271 var anim = new type(el, args, duration, easing);
\r
1272 anim.animateX(function() {
\r
1273 Ext.callback(cb, scope);
\r
1280 function fly(el) {
\r
1281 if (!libFlyweight) {
\r
1282 libFlyweight = new Ext.Element.Flyweight();
\r
1284 libFlyweight.dom = el;
\r
1285 return libFlyweight;
\r
1290 function fnCleanUp() {
\r
1291 var p = Function.prototype;
\r
1292 delete p.createSequence;
\r
1294 delete p.createDelegate;
\r
1295 delete p.createCallback;
\r
1296 delete p.createInterceptor;
\r
1298 window.detachEvent("onunload", fnCleanUp);
\r
1300 window.attachEvent("onunload", fnCleanUp);
\r
1303 Ext.lib.AnimBase = function(el, attributes, duration, method) {
\r
1305 this.init(el, attributes, duration, method);
\r
1309 Ext.lib.AnimBase.prototype = {
\r
1311 toString: function() {
\r
1312 var el = this.getEl();
\r
1313 var id = el.id || el.tagName;
\r
1314 return ("Anim " + id);
\r
1318 noNegatives: /width|height|opacity|padding/i,
\r
1319 offsetAttribute: /^((width|height)|(top|left))$/,
\r
1320 defaultUnit: /width|height|top$|bottom$|left$|right$/i,
\r
1321 offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i
\r
1325 doMethod: function(attr, start, end) {
\r
1326 return this.method(this.currentFrame, start, end - start, this.totalFrames);
\r
1330 setAttribute: function(attr, val, unit) {
\r
1331 if (this.patterns.noNegatives.test(attr)) {
\r
1332 val = (val > 0) ? val : 0;
\r
1335 Ext.fly(this.getEl(), '_anim').setStyle(attr, val + unit);
\r
1339 getAttribute: function(attr) {
\r
1340 var el = this.getEl();
\r
1341 var val = fly(el).getStyle(attr);
\r
1343 if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {
\r
1344 return parseFloat(val);
\r
1347 var a = this.patterns.offsetAttribute.exec(attr) || [];
\r
1348 var pos = !!( a[3] );
\r
1349 var box = !!( a[2] );
\r
1352 if (box || (fly(el).getStyle('position') == 'absolute' && pos)) {
\r
1353 val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];
\r
1362 getDefaultUnit: function(attr) {
\r
1363 if (this.patterns.defaultUnit.test(attr)) {
\r
1370 animateX : function(callback, scope) {
\r
1371 var f = function() {
\r
1372 this.onComplete.removeListener(f);
\r
1373 if (typeof callback == "function") {
\r
1374 callback.call(scope || this, this);
\r
1377 this.onComplete.addListener(f, this);
\r
1382 setRuntimeAttribute: function(attr) {
\r
1385 var attributes = this.attributes;
\r
1387 this.runtimeAttributes[attr] = {};
\r
1389 var isset = function(prop) {
\r
1390 return (typeof prop !== 'undefined');
\r
1393 if (!isset(attributes[attr]['to']) && !isset(attributes[attr]['by'])) {
\r
1397 start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);
\r
1400 if (isset(attributes[attr]['to'])) {
\r
1401 end = attributes[attr]['to'];
\r
1402 } else if (isset(attributes[attr]['by'])) {
\r
1403 if (start.constructor == Array) {
\r
1405 for (var i = 0, len = start.length; i < len; ++i) {
\r
1406 end[i] = start[i] + attributes[attr]['by'][i];
\r
1409 end = start + attributes[attr]['by'];
\r
1413 this.runtimeAttributes[attr].start = start;
\r
1414 this.runtimeAttributes[attr].end = end;
\r
1417 this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
\r
1421 init: function(el, attributes, duration, method) {
\r
1423 var isAnimated = false;
\r
1426 var startTime = null;
\r
1429 var actualFrames = 0;
\r
1432 el = Ext.getDom(el);
\r
1435 this.attributes = attributes || {};
\r
1438 this.duration = duration || 1;
\r
1441 this.method = method || Ext.lib.Easing.easeNone;
\r
1444 this.useSeconds = true;
\r
1447 this.currentFrame = 0;
\r
1450 this.totalFrames = Ext.lib.AnimMgr.fps;
\r
1453 this.getEl = function() {
\r
1458 this.isAnimated = function() {
\r
1459 return isAnimated;
\r
1463 this.getStartTime = function() {
\r
1467 this.runtimeAttributes = {};
\r
1470 this.animate = function() {
\r
1471 if (this.isAnimated()) {
\r
1475 this.currentFrame = 0;
\r
1477 this.totalFrames = ( this.useSeconds ) ? Math.ceil(Ext.lib.AnimMgr.fps * this.duration) : this.duration;
\r
1479 Ext.lib.AnimMgr.registerElement(this);
\r
1483 this.stop = function(finish) {
\r
1485 this.currentFrame = this.totalFrames;
\r
1486 this._onTween.fire();
\r
1488 Ext.lib.AnimMgr.stop(this);
\r
1491 var onStart = function() {
\r
1492 this.onStart.fire();
\r
1494 this.runtimeAttributes = {};
\r
1495 for (var attr in this.attributes) {
\r
1496 this.setRuntimeAttribute(attr);
\r
1499 isAnimated = true;
\r
1501 startTime = new Date();
\r
1505 var onTween = function() {
\r
1507 duration: new Date() - this.getStartTime(),
\r
1508 currentFrame: this.currentFrame
\r
1511 data.toString = function() {
\r
1513 'duration: ' + data.duration +
\r
1514 ', currentFrame: ' + data.currentFrame
\r
1518 this.onTween.fire(data);
\r
1520 var runtimeAttributes = this.runtimeAttributes;
\r
1522 for (var attr in runtimeAttributes) {
\r
1523 this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);
\r
1526 actualFrames += 1;
\r
1529 var onComplete = function() {
\r
1530 var actual_duration = (new Date() - startTime) / 1000 ;
\r
1533 duration: actual_duration,
\r
1534 frames: actualFrames,
\r
1535 fps: actualFrames / actual_duration
\r
1538 data.toString = function() {
\r
1540 'duration: ' + data.duration +
\r
1541 ', frames: ' + data.frames +
\r
1542 ', fps: ' + data.fps
\r
1546 isAnimated = false;
\r
1548 this.onComplete.fire(data);
\r
1552 this._onStart = new Ext.util.Event(this);
\r
1553 this.onStart = new Ext.util.Event(this);
\r
1554 this.onTween = new Ext.util.Event(this);
\r
1555 this._onTween = new Ext.util.Event(this);
\r
1556 this.onComplete = new Ext.util.Event(this);
\r
1557 this._onComplete = new Ext.util.Event(this);
\r
1558 this._onStart.addListener(onStart);
\r
1559 this._onTween.addListener(onTween);
\r
1560 this._onComplete.addListener(onComplete);
\r
1565 Ext.lib.AnimMgr = new function() {
\r
1567 var thread = null;
\r
1573 var tweenCount = 0;
\r
1582 this.registerElement = function(tween) {
\r
1583 queue[queue.length] = tween;
\r
1585 tween._onStart.fire();
\r
1590 this.unRegister = function(tween, index) {
\r
1591 tween._onComplete.fire();
\r
1592 index = index || getIndex(tween);
\r
1593 if (index != -1) {
\r
1594 queue.splice(index, 1);
\r
1598 if (tweenCount <= 0) {
\r
1604 this.start = function() {
\r
1605 if (thread === null) {
\r
1606 thread = setInterval(this.run, this.delay);
\r
1611 this.stop = function(tween) {
\r
1613 clearInterval(thread);
\r
1615 for (var i = 0, len = queue.length; i < len; ++i) {
\r
1616 if (queue[0].isAnimated()) {
\r
1617 this.unRegister(queue[0], 0);
\r
1626 this.unRegister(tween);
\r
1631 this.run = function() {
\r
1632 for (var i = 0, len = queue.length; i < len; ++i) {
\r
1633 var tween = queue[i];
\r
1634 if (!tween || !tween.isAnimated()) {
\r
1638 if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)
\r
1640 tween.currentFrame += 1;
\r
1642 if (tween.useSeconds) {
\r
1643 correctFrame(tween);
\r
1645 tween._onTween.fire();
\r
1648 Ext.lib.AnimMgr.stop(tween, i);
\r
1653 var getIndex = function(anim) {
\r
1654 for (var i = 0, len = queue.length; i < len; ++i) {
\r
1655 if (queue[i] == anim) {
\r
1663 var correctFrame = function(tween) {
\r
1664 var frames = tween.totalFrames;
\r
1665 var frame = tween.currentFrame;
\r
1666 var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
\r
1667 var elapsed = (new Date() - tween.getStartTime());
\r
1670 if (elapsed < tween.duration * 1000) {
\r
1671 tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
\r
1673 tweak = frames - (frame + 1);
\r
1675 if (tweak > 0 && isFinite(tweak)) {
\r
1676 if (tween.currentFrame + tweak >= frames) {
\r
1677 tweak = frames - (frame + 1);
\r
1680 tween.currentFrame += tweak;
\r
1685 Ext.lib.Bezier = new function() {
\r
1687 this.getPosition = function(points, t) {
\r
1688 var n = points.length;
\r
1691 for (var i = 0; i < n; ++i) {
\r
1692 tmp[i] = [points[i][0], points[i][1]];
\r
1695 for (var j = 1; j < n; ++j) {
\r
1696 for (i = 0; i < n - j; ++i) {
\r
1697 tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
\r
1698 tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
\r
1702 return [ tmp[0][0], tmp[0][1] ];
\r
1708 Ext.lib.ColorAnim = function(el, attributes, duration, method) {
\r
1709 Ext.lib.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
\r
1712 Ext.extend(Ext.lib.ColorAnim, Ext.lib.AnimBase);
\r
1716 var superclass = Y.ColorAnim.superclass;
\r
1717 var proto = Y.ColorAnim.prototype;
\r
1719 proto.toString = function() {
\r
1720 var el = this.getEl();
\r
1721 var id = el.id || el.tagName;
\r
1722 return ("ColorAnim " + id);
\r
1725 proto.patterns.color = /color$/i;
\r
1726 proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
\r
1727 proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
\r
1728 proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
\r
1729 proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/;
\r
1732 proto.parseColor = function(s) {
\r
1733 if (s.length == 3) {
\r
1737 var c = this.patterns.hex.exec(s);
\r
1738 if (c && c.length == 4) {
\r
1739 return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];
\r
1742 c = this.patterns.rgb.exec(s);
\r
1743 if (c && c.length == 4) {
\r
1744 return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];
\r
1747 c = this.patterns.hex3.exec(s);
\r
1748 if (c && c.length == 4) {
\r
1749 return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];
\r
1755 proto.getAttribute = function(attr) {
\r
1756 var el = this.getEl();
\r
1757 if (this.patterns.color.test(attr)) {
\r
1758 var val = fly(el).getStyle(attr);
\r
1760 if (this.patterns.transparent.test(val)) {
\r
1761 var parent = el.parentNode;
\r
1762 val = fly(parent).getStyle(attr);
\r
1764 while (parent && this.patterns.transparent.test(val)) {
\r
1765 parent = parent.parentNode;
\r
1766 val = fly(parent).getStyle(attr);
\r
1767 if (parent.tagName.toUpperCase() == 'HTML') {
\r
1773 val = superclass.getAttribute.call(this, attr);
\r
1779 proto.doMethod = function(attr, start, end) {
\r
1782 if (this.patterns.color.test(attr)) {
\r
1784 for (var i = 0, len = start.length; i < len; ++i) {
\r
1785 val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);
\r
1788 val = 'rgb(' + Math.floor(val[0]) + ',' + Math.floor(val[1]) + ',' + Math.floor(val[2]) + ')';
\r
1791 val = superclass.doMethod.call(this, attr, start, end);
\r
1797 proto.setRuntimeAttribute = function(attr) {
\r
1798 superclass.setRuntimeAttribute.call(this, attr);
\r
1800 if (this.patterns.color.test(attr)) {
\r
1801 var attributes = this.attributes;
\r
1802 var start = this.parseColor(this.runtimeAttributes[attr].start);
\r
1803 var end = this.parseColor(this.runtimeAttributes[attr].end);
\r
1805 if (typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined') {
\r
1806 end = this.parseColor(attributes[attr].by);
\r
1808 for (var i = 0, len = start.length; i < len; ++i) {
\r
1809 end[i] = start[i] + end[i];
\r
1813 this.runtimeAttributes[attr].start = start;
\r
1814 this.runtimeAttributes[attr].end = end;
\r
1820 Ext.lib.Easing = {
\r
1823 easeNone: function (t, b, c, d) {
\r
1824 return c * t / d + b;
\r
1828 easeIn: function (t, b, c, d) {
\r
1829 return c * (t /= d) * t + b;
\r
1833 easeOut: function (t, b, c, d) {
\r
1834 return -c * (t /= d) * (t - 2) + b;
\r
1838 easeBoth: function (t, b, c, d) {
\r
1839 if ((t /= d / 2) < 1) {
\r
1840 return c / 2 * t * t + b;
\r
1843 return -c / 2 * ((--t) * (t - 2) - 1) + b;
\r
1847 easeInStrong: function (t, b, c, d) {
\r
1848 return c * (t /= d) * t * t * t + b;
\r
1852 easeOutStrong: function (t, b, c, d) {
\r
1853 return -c * ((t = t / d - 1) * t * t * t - 1) + b;
\r
1857 easeBothStrong: function (t, b, c, d) {
\r
1858 if ((t /= d / 2) < 1) {
\r
1859 return c / 2 * t * t * t * t + b;
\r
1862 return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
\r
1867 elasticIn: function (t, b, c, d, a, p) {
\r
1871 if ((t /= d) == 1) {
\r
1878 if (!a || a < Math.abs(c)) {
\r
1883 var s = p / (2 * Math.PI) * Math.asin(c / a);
\r
1886 return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
\r
1890 elasticOut: function (t, b, c, d, a, p) {
\r
1894 if ((t /= d) == 1) {
\r
1901 if (!a || a < Math.abs(c)) {
\r
1906 var s = p / (2 * Math.PI) * Math.asin(c / a);
\r
1909 return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
\r
1913 elasticBoth: function (t, b, c, d, a, p) {
\r
1918 if ((t /= d / 2) == 2) {
\r
1923 p = d * (.3 * 1.5);
\r
1926 if (!a || a < Math.abs(c)) {
\r
1931 var s = p / (2 * Math.PI) * Math.asin(c / a);
\r
1935 return -.5 * (a * Math.pow(2, 10 * (t -= 1)) *
\r
1936 Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
\r
1938 return a * Math.pow(2, -10 * (t -= 1)) *
\r
1939 Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
\r
1944 backIn: function (t, b, c, d, s) {
\r
1945 if (typeof s == 'undefined') {
\r
1948 return c * (t /= d) * t * ((s + 1) * t - s) + b;
\r
1952 backOut: function (t, b, c, d, s) {
\r
1953 if (typeof s == 'undefined') {
\r
1956 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
\r
1960 backBoth: function (t, b, c, d, s) {
\r
1961 if (typeof s == 'undefined') {
\r
1965 if ((t /= d / 2 ) < 1) {
\r
1966 return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
\r
1968 return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
\r
1972 bounceIn: function (t, b, c, d) {
\r
1973 return c - Ext.lib.Easing.bounceOut(d - t, 0, c, d) + b;
\r
1977 bounceOut: function (t, b, c, d) {
\r
1978 if ((t /= d) < (1 / 2.75)) {
\r
1979 return c * (7.5625 * t * t) + b;
\r
1980 } else if (t < (2 / 2.75)) {
\r
1981 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
\r
1982 } else if (t < (2.5 / 2.75)) {
\r
1983 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
\r
1985 return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
\r
1989 bounceBoth: function (t, b, c, d) {
\r
1991 return Ext.lib.Easing.bounceIn(t * 2, 0, c, d) * .5 + b;
\r
1993 return Ext.lib.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
\r
1998 Ext.lib.Motion = function(el, attributes, duration, method) {
\r
2000 Ext.lib.Motion.superclass.constructor.call(this, el, attributes, duration, method);
\r
2004 Ext.extend(Ext.lib.Motion, Ext.lib.ColorAnim);
\r
2008 var superclass = Y.Motion.superclass;
\r
2009 var proto = Y.Motion.prototype;
\r
2011 proto.toString = function() {
\r
2012 var el = this.getEl();
\r
2013 var id = el.id || el.tagName;
\r
2014 return ("Motion " + id);
\r
2017 proto.patterns.points = /^points$/i;
\r
2019 proto.setAttribute = function(attr, val, unit) {
\r
2020 if (this.patterns.points.test(attr)) {
\r
2021 unit = unit || 'px';
\r
2022 superclass.setAttribute.call(this, 'left', val[0], unit);
\r
2023 superclass.setAttribute.call(this, 'top', val[1], unit);
\r
2025 superclass.setAttribute.call(this, attr, val, unit);
\r
2029 proto.getAttribute = function(attr) {
\r
2030 if (this.patterns.points.test(attr)) {
\r
2032 superclass.getAttribute.call(this, 'left'),
\r
2033 superclass.getAttribute.call(this, 'top')
\r
2036 val = superclass.getAttribute.call(this, attr);
\r
2042 proto.doMethod = function(attr, start, end) {
\r
2045 if (this.patterns.points.test(attr)) {
\r
2046 var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
\r
2047 val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);
\r
2049 val = superclass.doMethod.call(this, attr, start, end);
\r
2054 proto.setRuntimeAttribute = function(attr) {
\r
2055 if (this.patterns.points.test(attr)) {
\r
2056 var el = this.getEl();
\r
2057 var attributes = this.attributes;
\r
2059 var control = attributes['points']['control'] || [];
\r
2063 if (control.length > 0 && !Ext.isArray(control[0])) {
\r
2064 control = [control];
\r
2067 for (i = 0,len = control.length; i < len; ++i) {
\r
2068 tmp[i] = control[i];
\r
2073 Ext.fly(el, '_anim').position();
\r
2075 if (isset(attributes['points']['from'])) {
\r
2076 Ext.lib.Dom.setXY(el, attributes['points']['from']);
\r
2079 Ext.lib.Dom.setXY(el, Ext.lib.Dom.getXY(el));
\r
2082 start = this.getAttribute('points');
\r
2085 if (isset(attributes['points']['to'])) {
\r
2086 end = translateValues.call(this, attributes['points']['to'], start);
\r
2088 var pageXY = Ext.lib.Dom.getXY(this.getEl());
\r
2089 for (i = 0,len = control.length; i < len; ++i) {
\r
2090 control[i] = translateValues.call(this, control[i], start);
\r
2094 } else if (isset(attributes['points']['by'])) {
\r
2095 end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ];
\r
2097 for (i = 0,len = control.length; i < len; ++i) {
\r
2098 control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
\r
2102 this.runtimeAttributes[attr] = [start];
\r
2104 if (control.length > 0) {
\r
2105 this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);
\r
2108 this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;
\r
2111 superclass.setRuntimeAttribute.call(this, attr);
\r
2115 var translateValues = function(val, start) {
\r
2116 var pageXY = Ext.lib.Dom.getXY(this.getEl());
\r
2117 val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];
\r
2122 var isset = function(prop) {
\r
2123 return (typeof prop !== 'undefined');
\r
2129 Ext.lib.Scroll = function(el, attributes, duration, method) {
\r
2131 Ext.lib.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
\r
2135 Ext.extend(Ext.lib.Scroll, Ext.lib.ColorAnim);
\r
2139 var superclass = Y.Scroll.superclass;
\r
2140 var proto = Y.Scroll.prototype;
\r
2142 proto.toString = function() {
\r
2143 var el = this.getEl();
\r
2144 var id = el.id || el.tagName;
\r
2145 return ("Scroll " + id);
\r
2148 proto.doMethod = function(attr, start, end) {
\r
2151 if (attr == 'scroll') {
\r
2153 this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames),
\r
2154 this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)
\r
2158 val = superclass.doMethod.call(this, attr, start, end);
\r
2163 proto.getAttribute = function(attr) {
\r
2165 var el = this.getEl();
\r
2167 if (attr == 'scroll') {
\r
2168 val = [ el.scrollLeft, el.scrollTop ];
\r
2170 val = superclass.getAttribute.call(this, attr);
\r
2176 proto.setAttribute = function(attr, val, unit) {
\r
2177 var el = this.getEl();
\r
2179 if (attr == 'scroll') {
\r
2180 el.scrollLeft = val[0];
\r
2181 el.scrollTop = val[1];
\r
2183 superclass.setAttribute.call(this, attr, val, unit);
\r