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.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.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){
304 return headerObj[header.toLowerCase()];
306 getAllResponseHeaders : function(){
312 request : function(method, uri, cb, data, options){
318 complete: createComplete(cb)
322 var hs = options.headers;
324 o.data = options.xmlData;
325 o.processData = false;
326 o.type = (method ? method : (options.method ? options.method : 'POST'));
327 if (!hs || !hs['Content-Type']){
328 o.contentType = 'text/xml';
330 }else if(options.jsonData){
331 o.data = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
332 o.processData = false;
333 o.type = (method ? method : (options.method ? options.method : 'POST'));
334 if (!hs || !hs['Content-Type']){
335 o.contentType = 'application/json';
339 o.beforeSend = function(xhr){
341 if (hs.hasOwnProperty(h)) {
342 xhr.setRequestHeader(h, hs[h]);
351 formRequest : function(form, uri, cb, data, isUpload, sslUri){
353 type: Ext.getDom(form).method ||'POST',
355 data: jQuery(form).serialize()+(data?'&'+data:''),
357 complete: createComplete(cb)
361 isCallInProgress : function(trans){
365 abort : function(trans){
369 serializeForm : function(form){
370 return jQuery(form.dom||form).serialize();
375 Ext.lib.Anim = function(){
376 var createAnim = function(cb, scope){
379 stop : function(skipToLast){
383 isAnimated : function(){
387 proxyCallback : function(){
389 Ext.callback(cb, scope);
394 scroll : function(el, args, duration, easing, cb, scope){
395 // scroll anim not supported so just scroll immediately
396 var anim = createAnim(cb, scope);
398 if(typeof args.scroll.to[0] == 'number'){
399 el.scrollLeft = args.scroll.to[0];
401 if(typeof args.scroll.to[1] == 'number'){
402 el.scrollTop = args.scroll.to[1];
404 anim.proxyCallback();
408 motion : function(el, args, duration, easing, cb, scope){
409 return this.run(el, args, duration, easing, cb, scope);
412 color : function(el, args, duration, easing, cb, scope){
413 // color anim not supported, so execute callback immediately
414 var anim = createAnim(cb, scope);
415 anim.proxyCallback();
419 run : function(el, args, duration, easing, cb, scope, type){
420 var anim = createAnim(cb, scope), e = Ext.fly(el, '_animrun');
423 switch(k){ // jquery doesn't support, so convert
427 if(by = args.points.by){
429 pts = e.translatePoints([xy[0]+by[0], xy[1]+by[1]]);
431 pts = e.translatePoints(args.points.to);
435 if(!parseInt(e.getStyle('left'), 10)){ // auto bug
438 if(!parseInt(e.getStyle('top'), 10)){
441 if(args.points.from){
442 e.setXY(args.points.from);
446 o.width = args.width.to;
448 e.setWidth(args.width.from);
451 o.height = args.height.to;
452 if (args.height.from)
453 e.setHeight(args.height.from);
456 o.opacity = args.opacity.to;
457 if (args.opacity.from)
458 e.setOpacity(args.opacity.from);
461 o.left = args.left.to;
463 e.setLeft(args.left.from);
468 e.setTop(args.top.from);
470 // jQuery can't handle callback, scope, and xy arguments, so break here
479 e.setStyle(k, args[k].from);
483 // TODO: find out about easing plug in?
484 jQuery(el).animate(o, duration*1000, undefined, anim.proxyCallback);
491 Ext.lib.Region = function(t, r, b, l) {
500 Ext.lib.Region.prototype = {
501 contains : function(region) {
502 return ( region.left >= this.left &&
503 region.right <= this.right &&
504 region.top >= this.top &&
505 region.bottom <= this.bottom );
509 getArea : function() {
510 return ( (this.bottom - this.top) * (this.right - this.left) );
513 intersect : function(region) {
514 var t = Math.max( this.top, region.top );
515 var r = Math.min( this.right, region.right );
516 var b = Math.min( this.bottom, region.bottom );
517 var l = Math.max( this.left, region.left );
519 if (b >= t && r >= l) {
520 return new Ext.lib.Region(t, r, b, l);
525 union : function(region) {
526 var t = Math.min( this.top, region.top );
527 var r = Math.max( this.right, region.right );
528 var b = Math.max( this.bottom, region.bottom );
529 var l = Math.min( this.left, region.left );
531 return new Ext.lib.Region(t, r, b, l);
534 constrainTo : function(r) {
535 this.top = this.top.constrain(r.top, r.bottom);
536 this.bottom = this.bottom.constrain(r.top, r.bottom);
537 this.left = this.left.constrain(r.left, r.right);
538 this.right = this.right.constrain(r.left, r.right);
542 adjust : function(t, l, b, r){
551 Ext.lib.Region.getRegion = function(el) {
552 var p = Ext.lib.Dom.getXY(el);
555 var r = p[0] + el.offsetWidth;
556 var b = p[1] + el.offsetHeight;
559 return new Ext.lib.Region(t, r, b, l);
562 Ext.lib.Point = function(x, y) {
563 if (Ext.isArray(x)) {
567 this.x = this.right = this.left = this[0] = x;
568 this.y = this.top = this.bottom = this[1] = y;
571 Ext.lib.Point.prototype = new Ext.lib.Region();
575 function fnCleanUp() {
576 var p = Function.prototype;
577 delete p.createSequence;
579 delete p.createDelegate;
580 delete p.createCallback;
581 delete p.createInterceptor;
583 window.detachEvent("onunload", fnCleanUp);
585 window.attachEvent("onunload", fnCleanUp);