2
* Ext JS Library 3.0 RC2
3
* Copyright(c) 2006-2009, Ext JS, LLC.
6
* http://extjs.com/license
9
if(typeof YAHOO == "undefined"){
10
throw "Unable to load Ext, core YUI utilities (yahoo, dom, event) not found.";
14
var E = YAHOO.util.Event;
15
var D = YAHOO.util.Dom;
16
var CN = YAHOO.util.Connect;
18
var ES = YAHOO.util.Easing;
19
var A = YAHOO.util.Anim;
23
getViewWidth : function(full){
24
return full ? D.getDocumentWidth() : D.getViewportWidth();
27
getViewHeight : function(full){
28
return full ? D.getDocumentHeight() : D.getViewportHeight();
31
isAncestor : function(haystack, needle){
32
return D.isAncestor(haystack, needle);
35
getRegion : function(el){
36
return D.getRegion(el);
40
return this.getXY(el)[1];
44
return this.getXY(el)[0];
47
// original version based on YahooUI getXY
48
// this version fixes several issues in Safari and FF
49
// and boosts performance by removing the batch overhead, repetitive dom lookups and array index calls
51
var p, pe, b, scroll, bd = (document.body || document.documentElement);
58
if (el.getBoundingClientRect) {
59
b = el.getBoundingClientRect();
60
scroll = fly(document).getScroll();
61
return [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
67
var hasAbsolute = fly(el).getStyle("position") == "absolute";
74
if (!hasAbsolute && fly(p).getStyle("position") == "absolute") {
81
var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
82
var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
89
if (p != el && pe.getStyle('overflow') != 'visible') {
97
if (Ext.isSafari && hasAbsolute) {
102
if (Ext.isGecko && !hasAbsolute) {
104
x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
105
y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
109
while (p && p != bd) {
110
if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) {
119
setXY : function(el, xy){
120
el = Ext.fly(el, '_setXY');
122
var pts = el.translatePoints(xy);
124
el.dom.style.left = pts.left + "px";
127
el.dom.style.top = pts.top + "px";
131
setX : function(el, x){
132
this.setXY(el, [x, false]);
135
setY : function(el, y){
136
this.setXY(el, [false, y]);
141
getPageX : function(e){
142
return E.getPageX(e.browserEvent || e);
145
getPageY : function(e){
146
return E.getPageY(e.browserEvent || e);
150
return E.getXY(e.browserEvent || e);
153
getTarget : function(e){
154
return E.getTarget(e.browserEvent || e);
157
getRelatedTarget : function(e){
158
return E.getRelatedTarget(e.browserEvent || e);
161
on : function(el, eventName, fn, scope, override){
162
E.on(el, eventName, fn, scope, override);
165
un : function(el, eventName, fn){
166
E.removeListener(el, eventName, fn);
169
purgeElement : function(el){
173
preventDefault : function(e){
174
E.preventDefault(e.browserEvent || e);
177
stopPropagation : function(e){
178
E.stopPropagation(e.browserEvent || e);
181
stopEvent : function(e){
182
E.stopEvent(e.browserEvent || e);
185
onAvailable : function(el, fn, scope, override){
186
return E.onAvailable(el, fn, scope, override);
191
request : function(method, uri, cb, data, options){
193
var hs = options.headers;
196
if(hs.hasOwnProperty(h)){
197
CN.initHeader(h, hs[h], false);
202
if (!hs || !hs['Content-Type']){
203
CN.initHeader('Content-Type', 'text/xml', false);
205
method = (method ? method : (options.method ? options.method : 'POST'));
206
data = options.xmlData;
207
}else if(options.jsonData){
208
if (!hs || !hs['Content-Type']){
209
CN.initHeader('Content-Type', 'application/json', false);
211
method = (method ? method : (options.method ? options.method : 'POST'));
212
data = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
215
return CN.asyncRequest(method, uri, cb, data);
218
formRequest : function(form, uri, cb, data, isUpload, sslUri){
219
CN.setForm(form, isUpload, sslUri);
220
return CN.asyncRequest(Ext.getDom(form).method ||'POST', uri, cb, data);
223
isCallInProgress : function(trans){
224
return CN.isCallInProgress(trans);
227
abort : function(trans){
228
return CN.abort(trans);
231
serializeForm : function(form){
232
var d = CN.setForm(form.dom || form);
238
Ext.lib.Region = YAHOO.util.Region;
239
Ext.lib.Point = YAHOO.util.Point;
243
scroll : function(el, args, duration, easing, cb, scope){
244
this.run(el, args, duration, easing, cb, scope, YAHOO.util.Scroll);
247
motion : function(el, args, duration, easing, cb, scope){
248
this.run(el, args, duration, easing, cb, scope, YAHOO.util.Motion);
251
color : function(el, args, duration, easing, cb, scope){
252
this.run(el, args, duration, easing, cb, scope, YAHOO.util.ColorAnim);
255
run : function(el, args, duration, easing, cb, scope, type){
256
type = type || YAHOO.util.Anim;
257
if(typeof easing == "string"){
258
easing = YAHOO.util.Easing[easing];
260
var anim = new type(el, args, duration, easing);
261
anim.animateX(function(){
262
Ext.callback(cb, scope);
268
// all lib flyweight calls use their own flyweight to prevent collisions with developer flyweights
271
libFlyweight = new Ext.Element.Flyweight();
273
libFlyweight.dom = el;
279
function fnCleanUp() {
280
var p = Function.prototype;
281
delete p.createSequence;
283
delete p.createDelegate;
284
delete p.createCallback;
285
delete p.createInterceptor;
287
window.detachEvent("onunload", fnCleanUp);
289
window.attachEvent("onunload", fnCleanUp);
293
// add ability for callbacks with animations
295
YAHOO.util.Anim.prototype.animateX = function(callback, scope){
297
this.onComplete.unsubscribe(f);
298
if(typeof callback == "function"){
299
callback.call(scope || this, this);
302
this.onComplete.subscribe(f, this, true);
307
if(YAHOO.util.DragDrop && Ext.dd.DragDrop){
308
YAHOO.util.DragDrop.defaultPadding = Ext.dd.DragDrop.defaultPadding;
309
YAHOO.util.DragDrop.constrainTo = Ext.dd.DragDrop.constrainTo;
312
YAHOO.util.Dom.getXY = function(el) {
313
var f = function(el) {
314
return Ext.lib.Dom.getXY(el);
316
return YAHOO.util.Dom.batch(el, f, YAHOO.util.Dom, true);
320
// workaround for Safari anim duration speed problems
321
if(YAHOO.util.AnimMgr){
322
YAHOO.util.AnimMgr.fps = 1000;
325
YAHOO.util.Region.prototype.adjust = function(t, l, b, r){
333
YAHOO.util.Region.prototype.constrainTo = function(r) {
334
this.top = this.top.constrain(r.top, r.bottom);
335
this.bottom = this.bottom.constrain(r.top, r.bottom);
336
this.left = this.left.constrain(r.left, r.right);
337
this.right = this.right.constrain(r.left, r.right);
b'\\ No newline at end of file'