3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 if(typeof YAHOO == "undefined"){
16 throw "Unable to load Ext, core YUI utilities (yahoo, dom, event) not found.";
20 var E = YAHOO.util.Event,
22 CN = YAHOO.util.Connect,
23 ES = YAHOO.util.Easing,
26 version = YAHOO.env.getVersion('yahoo').version.split('.'),
27 mouseEnterSupported = parseInt(version[0]) >= 3,
29 elContains = function(parent, child){
30 if(parent && parent.firstChild){
35 child = child.parentNode;
36 if(child && (child.nodeType != 1)){
42 }, checkRelatedTarget = function(e){
43 return !elContains(e.currentTarget, Ext.lib.Event.getRelatedTarget(e));
47 getViewWidth : function(full){
48 return full ? D.getDocumentWidth() : D.getViewportWidth();
51 getViewHeight : function(full){
52 return full ? D.getDocumentHeight() : D.getViewportHeight();
55 isAncestor : function(haystack, needle){
56 return D.isAncestor(haystack, needle);
59 getRegion : function(el){
60 return D.getRegion(el);
64 return this.getXY(el)[1];
68 return this.getXY(el)[0];
71 // original version based on YahooUI getXY
72 // this version fixes several issues in Safari and FF
73 // and boosts performance by removing the batch overhead, repetitive dom lookups and array index calls
75 var p, pe, b, scroll, bd = (document.body || document.documentElement);
82 if (el.getBoundingClientRect) {
83 b = el.getBoundingClientRect();
84 scroll = fly(document).getScroll();
85 return [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
91 var hasAbsolute = fly(el).getStyle("position") == "absolute";
98 if (!hasAbsolute && fly(p).getStyle("position") == "absolute") {
105 var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
106 var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
113 if (p != el && pe.getStyle('overflow') != 'visible') {
121 if (Ext.isSafari && hasAbsolute) {
126 if (Ext.isGecko && !hasAbsolute) {
128 x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
129 y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
133 while (p && p != bd) {
134 if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) {
143 setXY : function(el, xy){
144 el = Ext.fly(el, '_setXY');
146 var pts = el.translatePoints(xy);
148 el.dom.style.left = pts.left + "px";
151 el.dom.style.top = pts.top + "px";
155 setX : function(el, x){
156 this.setXY(el, [x, false]);
159 setY : function(el, y){
160 this.setXY(el, [false, y]);
165 getPageX : function(e){
166 return E.getPageX(e.browserEvent || e);
169 getPageY : function(e){
170 return E.getPageY(e.browserEvent || e);
174 return E.getXY(e.browserEvent || e);
177 getTarget : function(e){
178 return E.getTarget(e.browserEvent || e);
181 getRelatedTarget : function(e){
182 return E.getRelatedTarget(e.browserEvent || e);
185 on : function(el, eventName, fn, scope, override){
186 if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
187 var item = mouseCache[el.id] || (mouseCache[el.id] = {});
188 item[eventName] = fn;
189 fn = fn.createInterceptor(checkRelatedTarget);
190 eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
192 E.on(el, eventName, fn, scope, override);
195 un : function(el, eventName, fn){
196 if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
197 var item = mouseCache[el.id],
198 ev = item && item[eventName];
202 delete item[eventName];
203 eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
206 E.removeListener(el, eventName, fn);;
209 purgeElement : function(el){
213 preventDefault : function(e){
214 E.preventDefault(e.browserEvent || e);
217 stopPropagation : function(e){
218 E.stopPropagation(e.browserEvent || e);
221 stopEvent : function(e){
222 E.stopEvent(e.browserEvent || e);
225 onAvailable : function(el, fn, scope, override){
226 return E.onAvailable(el, fn, scope, override);
231 request : function(method, uri, cb, data, options){
233 var hs = options.headers;
236 if(hs.hasOwnProperty(h)){
237 CN.initHeader(h, hs[h], false);
242 if (!hs || !hs['Content-Type']){
243 CN.initHeader('Content-Type', 'text/xml', false);
245 method = (method ? method : (options.method ? options.method : 'POST'));
246 data = options.xmlData;
247 }else if(options.jsonData){
248 if (!hs || !hs['Content-Type']){
249 CN.initHeader('Content-Type', 'application/json', false);
251 method = (method ? method : (options.method ? options.method : 'POST'));
252 data = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
255 return CN.asyncRequest(method, uri, cb, data);
258 formRequest : function(form, uri, cb, data, isUpload, sslUri){
259 CN.setForm(form, isUpload, sslUri);
260 return CN.asyncRequest(Ext.getDom(form).method ||'POST', uri, cb, data);
263 isCallInProgress : function(trans){
264 return CN.isCallInProgress(trans);
267 abort : function(trans){
268 return CN.abort(trans);
271 serializeForm : function(form){
272 var d = CN.setForm(form.dom || form);
278 Ext.lib.Region = YAHOO.util.Region;
279 Ext.lib.Point = YAHOO.util.Point;
283 scroll : function(el, args, duration, easing, cb, scope){
284 this.run(el, args, duration, easing, cb, scope, YAHOO.util.Scroll);
287 motion : function(el, args, duration, easing, cb, scope){
288 this.run(el, args, duration, easing, cb, scope, YAHOO.util.Motion);
291 color : function(el, args, duration, easing, cb, scope){
292 this.run(el, args, duration, easing, cb, scope, YAHOO.util.ColorAnim);
295 run : function(el, args, duration, easing, cb, scope, type){
296 type = type || YAHOO.util.Anim;
297 if(typeof easing == "string"){
298 easing = YAHOO.util.Easing[easing];
300 var anim = new type(el, args, duration, easing);
301 anim.animateX(function(){
302 Ext.callback(cb, scope);
308 // all lib flyweight calls use their own flyweight to prevent collisions with developer flyweights
311 libFlyweight = new Ext.Element.Flyweight();
313 libFlyweight.dom = el;
319 function fnCleanUp() {
320 var p = Function.prototype;
321 delete p.createSequence;
323 delete p.createDelegate;
324 delete p.createCallback;
325 delete p.createInterceptor;
327 window.detachEvent("onunload", fnCleanUp);
329 window.attachEvent("onunload", fnCleanUp);
333 // add ability for callbacks with animations
335 YAHOO.util.Anim.prototype.animateX = function(callback, scope){
337 this.onComplete.unsubscribe(f);
338 if(typeof callback == "function"){
339 callback.call(scope || this, this);
342 this.onComplete.subscribe(f, this, true);
347 if(YAHOO.util.DragDrop && Ext.dd.DragDrop){
348 YAHOO.util.DragDrop.defaultPadding = Ext.dd.DragDrop.defaultPadding;
349 YAHOO.util.DragDrop.constrainTo = Ext.dd.DragDrop.constrainTo;
352 YAHOO.util.Dom.getXY = function(el) {
353 var f = function(el) {
354 return Ext.lib.Dom.getXY(el);
356 return YAHOO.util.Dom.batch(el, f, YAHOO.util.Dom, true);
360 // workaround for Safari anim duration speed problems
361 if(YAHOO.util.AnimMgr){
362 YAHOO.util.AnimMgr.fps = 1000;
365 YAHOO.util.Region.prototype.adjust = function(t, l, b, r){
373 YAHOO.util.Region.prototype.constrainTo = function(r) {
374 this.top = this.top.constrain(r.top, r.bottom);
375 this.bottom = this.bottom.constrain(r.top, r.bottom);
376 this.left = this.left.constrain(r.left, r.right);
377 this.right = this.right.constrain(r.left, r.right);