deluge/deluge/ui/web/js/mootools-bridge.js
Damien Churchill e5459eda49 move mootools-bridge.js to mootools-bridge-debug.js and create the
yuicompressed mootools-bridge.js
2009-04-18 14:52:13 +00:00

1 line
5.1 KiB
JavaScript

(function(){Ext.lib.Dom={getViewWidth:function(b){return document["get"+(b?"Scroll":"")+"Width"]()},getViewHeight:function(b){return document["get"+(b?"Scroll":"")+"Height"]()},getDocumentHeight:function(){return document.getScrollHeight()},getDocumentWidth:function(){return document.getScrollWidth()},getViewportHeight:function(){return document.getHeight()},getViewportWidth:function(){return document.getWidth()},isAncestor:function(b,d){return $(b).hasChild(d)},getRegion:function(b){return Ext.lib.Region.getRegion(b)},getY:function(b){return $(b).getTop()},getX:function(b){return $(b).getLeft()},getXY:function(b){return Hash.getValues($(b).getPosition())},setXY:function(b,c){var d=Ext.get(b).translatePoints(c);Hash.each(d,function(e,f){if(!e){return}$(b).setStyle(f,e+"px")})},setX:function(c,b){this.setXY(c,[b,false])},setY:function(b,c){this.setXY(b,[false,c])}};function a(b){if($type(b)=="object"){return new Document(b)}return $(b)}Ext.lib.Event={getPageX:function(b){return new Event(b.browserEvent||b).page.x},getPageY:function(b){return new Event(b.browserEvent||b).page.y},getXY:function(c){var b=new Event(c.browserEvent||c).page;return b?[b.x,b.y]:[0,0]},getTarget:function(b){return new Event(b.browserEvent||b).target},resolveTextNode:function(b){return b&&3==b.nodeType?b.parentNode:b},getRelatedTarget:function(b){return new Event(b.browserEvent||b).relatedTarget},on:function(c,d,b){c=a(c);if(c){c.addListener(d,b)}},un:function(c,d,b){c=a(c);if(c){c.removeListener(d,b)}},purgeElement:function(b){b=a(b);if(b){b.removeEvents()}},preventDefault:function(b){new Event(b.browserEvent||b).preventDefault()},stopPropagation:function(b){new Event(b.browserEvent||b).stopPropagation()},stopEvent:function(b){new Event(b.browserEvent||b).stop()},onAvailable:function(d,c,b){if(Browser.loaded){c.call(b||window,$(d))}else{document.addEvent("domready",c)}}};Ext.lib.Ajax=function(){var c=function(d){return d.success?function(f,e){d.success.call(d.scope||window,{responseText:f,responseXML:e,argument:d.argument})}:Ext.emptyFn};var b=function(d){return d.failure?function(f,e){d.failure.call(d.scope||window,{responseText:f,responseXML:e,argument:d.argument})}:Ext.emptyFn};return{request:function(j,f,d,g,e){var h={url:f,method:j.toLowerCase(),data:g||"",onSuccess:c(d),onFailure:b(d)};if(e){if(e.headers){h.headers=e.headers}if(e.xmlData){h.method="post";h.headers={"Content-type":"text/xml"};h.data=e.xmlData}if(e.jsonData){h.method="post";h.headers={"Content-type":"text/javascript"};h.data=typeof e.jsonData=="object"?Ext.encode(e.jsonData):e.jsonData}}new Request(h).send()},formRequest:function(h,g,e,j,d,f){new Request({url:g,method:(Ext.getDom(h).method||"post").toLowerCase(),data:$(h).toQueryString()+(j?"&"+j:""),onSuccess:c(e),onFailure:b(e)}).send()},isCallInProgress:function(d){return false},abort:function(d){return false},serializeForm:function(d){return $(d.dom||d).toQueryString()}}}();Ext.lib.Anim=function(){var d=function(e,f){return{stop:function(g){this.effect.pause()},isAnimated:function(){return !!this.effect.timer},proxyCallback:function(){Ext.callback(e,f)}}};var c=function(e){if(!Fx.Transitions[e]){e="linear"}return Fx.Transitions[e]};var b={scroll:function(h,f,k,l,e,g){var j=d(e,g);j.effect=new Fx.Scroll(h,{duration:k*1000,transisions:c(l),onComplete:j.proxyCallback}).start(f);return j},run:function(h,q,k,o,j,s,r){if(o=="easeNone"){o="linear"}var l=d(j,s);var f={};for(i in q){if(i=="points"){var n,g,m=Ext.fly(h,"_animrun");m.position();if(n=q[i].by){var t=m.getXY();g=m.translatePoints([t[0]+n[0],t[1]+n[1]])}else{g=m.translatePoints(q[i].to)}f.left=g.left;f.top=g.top}else{f[i]=q[i].from?[q[i].from,q[i].to]:[q[i].to]}}l.effect=new Fx.Morph(h,{duration:k*1000,transition:c(o),onComplete:l.proxyCallback}).start(f);return l}};return Hash.extend(b,{motion:b.run,color:b.run})}();Ext.lib.Region=function(e,f,c,d){this.top=e;this[1]=e;this.right=f;this.bottom=c;this.left=d;this[0]=d};Ext.lib.Region.prototype={contains:function(b){return(b.left>=this.left&&b.right<=this.right&&b.top>=this.top&&b.bottom<=this.bottom)},getArea:function(){return((this.bottom-this.top)*(this.right-this.left))},intersect:function(g){var e=Math.max(this.top,g.top);var f=Math.min(this.right,g.right);var c=Math.min(this.bottom,g.bottom);var d=Math.max(this.left,g.left);if(c>=e&&f>=d){return new Ext.lib.Region(e,f,c,d)}else{return null}},union:function(g){var e=Math.min(this.top,g.top);var f=Math.max(this.right,g.right);var c=Math.max(this.bottom,g.bottom);var d=Math.min(this.left,g.left);return new Ext.lib.Region(e,f,c,d)},constrainTo:function(b){this.top=this.top.constrain(b.top,b.bottom);this.bottom=this.bottom.constrain(b.top,b.bottom);this.left=this.left.constrain(b.left,b.right);this.right=this.right.constrain(b.left,b.right);return this},adjust:function(e,d,c,f){this.top+=e;this.left+=d;this.right+=f;this.bottom+=c;return this}};Ext.lib.Region.getRegion=function(f){var h=Ext.lib.Dom.getXY(f);var e=h[1];var g=h[0]+f.offsetWidth;var c=h[1]+f.offsetHeight;var d=h[0];return new Ext.lib.Region(e,g,c,d)};Ext.lib.Point=function(b,c){if(Ext.isArray(b)){c=b[1];b=b[0]}this.x=this.right=this.left=this[0]=b;this.y=this.top=this.bottom=this[1]=c};Ext.lib.Point.prototype=new Ext.lib.Region()})();