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.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 if(typeof jQuery == "undefined"){
16 throw "Unable to load Ext, jQuery not found.";
23 getViewWidth : function(full){
24 // jQuery doesn't report full window size on document query, so max both
25 return full ? Math.max(jQuery(document).width(),jQuery(window).width()) : jQuery(window).width();
28 getViewHeight : function(full){
29 // jQuery doesn't report full window size on document query, so max both
30 return full ? Math.max(jQuery(document).height(),jQuery(window).height()) : jQuery(window).height();
33 isAncestor : function(p, c){
41 } else if (p.compareDocumentPosition) {
42 return !!(p.compareDocumentPosition(c) & 16);
44 while (c = c.parentNode) {
52 getRegion : function(el){
53 return Ext.lib.Region.getRegion(el);
56 //////////////////////////////////////////////////////////////////////////////////////
57 // Use of jQuery.offset() removed to promote consistent behavior across libs.
59 //////////////////////////////////////////////////////////////////////////////////////
62 return this.getXY(el)[1];
66 return this.getXY(el)[0];
69 getXY : function(el) {
70 var p, pe, b, scroll, bd = (document.body || document.documentElement);
77 if (el.getBoundingClientRect) {
78 b = el.getBoundingClientRect();
79 scroll = fly(document).getScroll();
80 return [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
86 var hasAbsolute = fly(el).getStyle("position") == "absolute";
93 if (!hasAbsolute && fly(p).getStyle("position") == "absolute") {
100 var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
101 var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
108 if (p != el && pe.getStyle('overflow') != 'visible') {
116 if (Ext.isSafari && hasAbsolute) {
121 if (Ext.isGecko && !hasAbsolute) {
123 x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
124 y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
128 while (p && p != bd) {
129 if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) {
138 setXY : function(el, xy){
139 el = Ext.fly(el, '_setXY');
141 var pts = el.translatePoints(xy);
143 el.dom.style.left = pts.left + "px";
146 el.dom.style.top = pts.top + "px";
150 setX : function(el, x){
151 this.setXY(el, [x, false]);
154 setY : function(el, y){
155 this.setXY(el, [false, y]);
159 // all lib flyweight calls use their own flyweight to prevent collisions with developer flyweights
162 libFlyweight = new Ext.Element.Flyweight();
164 libFlyweight.dom = el;
168 getPageX : function(e){
169 e = e.browserEvent || e;
173 getPageY : function(e){
174 e = e.browserEvent || e;
179 e = e.browserEvent || e;
180 return [e.pageX, e.pageY];
183 getTarget : function(e){
187 // all Ext events will go through event manager which provides scoping
188 on : function(el, eventName, fn, scope, override){
189 jQuery(el).bind(eventName, fn);
192 un : function(el, eventName, fn){
193 jQuery(el).unbind(eventName, fn);
196 purgeElement : function(el){
200 preventDefault : function(e){
201 e = e.browserEvent || e;
202 if(e.preventDefault){
205 e.returnValue = false;
209 stopPropagation : function(e){
210 e = e.browserEvent || e;
211 if(e.stopPropagation){
214 e.cancelBubble = true;
218 stopEvent : function(e){
219 this.preventDefault(e);
220 this.stopPropagation(e);
223 onAvailable : function(id, fn, scope){
224 var start = new Date();
226 if(start.getElapsed() > 10000){
229 var el = document.getElementById(id);
232 fn.call(scope||window, el);
235 var iid = setInterval(f, 50);
238 resolveTextNode: Ext.isGecko ? function(node){
242 var s = HTMLElement.prototype.toString.call(node);
243 if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
246 return node.nodeType == 3 ? node.parentNode : node;
248 return node && node.nodeType == 3 ? node.parentNode : node;
251 getRelatedTarget: function(ev) {
252 ev = ev.browserEvent || ev;
253 var t = ev.relatedTarget;
255 if (ev.type == "mouseout") {
257 } else if (ev.type == "mouseover") {
262 return this.resolveTextNode(t);
266 Ext.lib.Ajax = function(){
267 var createComplete = function(cb){
268 return function(xhr, status){
269 if((status == 'error' || status == 'timeout') && cb.failure){
270 cb.failure.call(cb.scope||window, createResponse(cb, xhr));
271 }else if(cb.success){
272 cb.success.call(cb.scope||window, createResponse(cb, xhr));
277 var createResponse = function(cb, xhr){
284 headerStr = xhr.getAllResponseHeaders();
285 Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
288 s = v.substr(0, t).toLowerCase();
289 if(v.charAt(t + 1) == ' '){
292 headerObj[s] = v.substr(t + 1);
298 responseText: xhr.responseText,
299 responseXML : xhr.responseXML,
300 argument: cb.argument,
302 statusText: xhr.statusText,
303 getResponseHeader : function(header){return headerObj[header.toLowerCase()];},
304 getAllResponseHeaders : function(){return headerStr}
308 request : function(method, uri, cb, data, options){
314 complete: createComplete(cb)
318 var hs = options.headers;
320 o.data = options.xmlData;
321 o.processData = false;
322 o.type = (method ? method : (options.method ? options.method : 'POST'));
323 if (!hs || !hs['Content-Type']){
324 o.contentType = 'text/xml';
326 }else if(options.jsonData){
327 o.data = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
328 o.processData = false;
329 o.type = (method ? method : (options.method ? options.method : 'POST'));
330 if (!hs || !hs['Content-Type']){
331 o.contentType = 'application/json';
335 o.beforeSend = function(xhr){
337 if(hs.hasOwnProperty(h)){
338 xhr.setRequestHeader(h, hs[h]);
347 formRequest : function(form, uri, cb, data, isUpload, sslUri){
349 type: Ext.getDom(form).method ||'POST',
351 data: jQuery(form).serialize()+(data?'&'+data:''),
353 complete: createComplete(cb)
357 isCallInProgress : function(trans){
361 abort : function(trans){
365 serializeForm : function(form){
366 return jQuery(form.dom||form).serialize();
371 Ext.lib.Anim = function(){
372 var createAnim = function(cb, scope){
375 stop : function(skipToLast){
379 isAnimated : function(){
383 proxyCallback : function(){
385 Ext.callback(cb, scope);
390 scroll : function(el, args, duration, easing, cb, scope){
391 // scroll anim not supported so just scroll immediately
392 var anim = createAnim(cb, scope);
394 if(typeof args.scroll.to[0] == 'number'){
395 el.scrollLeft = args.scroll.to[0];
397 if(typeof args.scroll.to[1] == 'number'){
398 el.scrollTop = args.scroll.to[1];
400 anim.proxyCallback();
404 motion : function(el, args, duration, easing, cb, scope){
405 return this.run(el, args, duration, easing, cb, scope);
408 color : function(el, args, duration, easing, cb, scope){
409 // color anim not supported, so execute callback immediately
410 var anim = createAnim(cb, scope);
411 anim.proxyCallback();
415 run : function(el, args, duration, easing, cb, scope, type){
416 var anim = createAnim(cb, scope), e = Ext.fly(el, '_animrun');
419 switch(k){ // jquery doesn't support, so convert
423 if(by = args.points.by){
425 pts = e.translatePoints([xy[0]+by[0], xy[1]+by[1]]);
427 pts = e.translatePoints(args.points.to);
431 if(!parseInt(e.getStyle('left'), 10)){ // auto bug
434 if(!parseInt(e.getStyle('top'), 10)){
437 if(args.points.from){
438 e.setXY(args.points.from);
442 o.width = args.width.to;
444 e.setWidth(args.width.from);
447 o.height = args.height.to;
448 if (args.height.from)
449 e.setHeight(args.height.from);
452 o.opacity = args.opacity.to;
453 if (args.opacity.from)
454 e.setOpacity(args.opacity.from);
457 o.left = args.left.to;
459 e.setLeft(args.left.from);
464 e.setTop(args.top.from);
466 // jQuery can't handle callback, scope, and xy arguments, so break here
475 e.setStyle(k, args[k].from);
479 // TODO: find out about easing plug in?
480 jQuery(el).animate(o, duration*1000, undefined, anim.proxyCallback);
487 Ext.lib.Region = function(t, r, b, l) {
496 Ext.lib.Region.prototype = {
497 contains : function(region) {
498 return ( region.left >= this.left &&
499 region.right <= this.right &&
500 region.top >= this.top &&
501 region.bottom <= this.bottom );
505 getArea : function() {
506 return ( (this.bottom - this.top) * (this.right - this.left) );
509 intersect : function(region) {
510 var t = Math.max( this.top, region.top );
511 var r = Math.min( this.right, region.right );
512 var b = Math.min( this.bottom, region.bottom );
513 var l = Math.max( this.left, region.left );
515 if (b >= t && r >= l) {
516 return new Ext.lib.Region(t, r, b, l);
521 union : function(region) {
522 var t = Math.min( this.top, region.top );
523 var r = Math.max( this.right, region.right );
524 var b = Math.max( this.bottom, region.bottom );
525 var l = Math.min( this.left, region.left );
527 return new Ext.lib.Region(t, r, b, l);
530 constrainTo : function(r) {
531 this.top = this.top.constrain(r.top, r.bottom);
532 this.bottom = this.bottom.constrain(r.top, r.bottom);
533 this.left = this.left.constrain(r.left, r.right);
534 this.right = this.right.constrain(r.left, r.right);
538 adjust : function(t, l, b, r){
547 Ext.lib.Region.getRegion = function(el) {
548 var p = Ext.lib.Dom.getXY(el);
551 var r = p[0] + el.offsetWidth;
552 var b = p[1] + el.offsetHeight;
555 return new Ext.lib.Region(t, r, b, l);
558 Ext.lib.Point = function(x, y) {
559 if (Ext.isArray(x)) {
563 this.x = this.right = this.left = this[0] = x;
564 this.y = this.top = this.bottom = this[1] = y;
567 Ext.lib.Point.prototype = new Ext.lib.Region();
571 function fnCleanUp() {
572 var p = Function.prototype;
573 delete p.createSequence;
575 delete p.createDelegate;
576 delete p.createCallback;
577 delete p.createInterceptor;
579 window.detachEvent("onunload", fnCleanUp);
581 window.attachEvent("onunload", fnCleanUp);