From: Dan Vanderkam Date: Wed, 19 Aug 2009 04:47:55 +0000 (+0000) Subject: Only pack a subset of MochiKit. This saves another 90k. X-Git-Tag: v1.0.0~918 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=79f17b42e332b8029a7d574f11a26844530e3120;hp=43f15770a2542b2b199b936f2e31509f736fe055;p=dygraphs.git Only pack a subset of MochiKit. This saves another 90k. --- diff --git a/docs/dygraph-combined.js b/docs/dygraph-combined.js index d0c243a..f0123ae 100644 --- a/docs/dygraph-combined.js +++ b/docs/dygraph-combined.js @@ -1002,1660 +1002,1116 @@ serializeJSON=MochiKit.Base.serializeJSON; } MochiKit.Base._exportSymbols(this,MochiKit.Base); if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Iter"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; -} +dojo.provide("MochiKit.Format"); } -catch(e){ -throw "MochiKit.Iter depends on MochiKit.Base!"; +if(typeof (MochiKit)=="undefined"){ +MochiKit={}; } -if(typeof (MochiKit.Iter)=="undefined"){ -MochiKit.Iter={}; +if(typeof (MochiKit.Format)=="undefined"){ +MochiKit.Format={}; } -MochiKit.Iter.NAME="MochiKit.Iter"; -MochiKit.Iter.VERSION="1.4"; -MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){ +MochiKit.Format.NAME="MochiKit.Format"; +MochiKit.Format.VERSION="1.4"; +MochiKit.Format.__repr__=function(){ return "["+this.NAME+" "+this.VERSION+"]"; -},toString:function(){ +}; +MochiKit.Format.toString=function(){ return this.__repr__(); -},registerIteratorFactory:function(name,_14e,_14f,_150){ -MochiKit.Iter.iteratorRegistry.register(name,_14e,_14f,_150); -},iter:function(_151,_152){ -var self=MochiKit.Iter; -if(arguments.length==2){ -return self.takewhile(function(a){ -return a!=_152; -},_151); +}; +MochiKit.Format._numberFormatter=function(_14d,_14e,_14f,_150,_151,_152,_153,_154,_155){ +return function(num){ +num=parseFloat(num); +if(typeof (num)=="undefined"||num===null||isNaN(num)){ +return _14d; } -if(typeof (_151.next)=="function"){ -return _151; +var _157=_14e; +var _158=_14f; +if(num<0){ +num=-num; }else{ -if(typeof (_151.iter)=="function"){ -return _151.iter(); -} +_157=_157.replace(/-/,""); } -try{ -return self.iteratorRegistry.match(_151); +var me=arguments.callee; +var fmt=MochiKit.Format.formatLocale(_150); +if(_151){ +num=num*100; +_158=fmt.percent+_158; } -catch(e){ -var m=MochiKit.Base; -if(e==m.NotFound){ -e=new TypeError(typeof (_151)+": "+m.repr(_151)+" is not iterable"); +num=MochiKit.Format.roundToFixed(num,_152); +var _15b=num.split(/\./); +var _15c=_15b[0]; +var frac=(_15b.length==1)?"":_15b[1]; +var res=""; +while(_15c.length<_153){ +_15c="0"+_15c; } -throw e; +if(_154){ +while(_15c.length>_154){ +var i=_15c.length-_154; +res=fmt.separator+_15c.substring(i,_15c.length)+res; +_15c=_15c.substring(0,i); } -},count:function(n){ -if(!n){ -n=0; } -var m=MochiKit.Base; -return {repr:function(){ -return "count("+n+")"; -},toString:m.forwardCall("repr"),next:m.counter(n)}; -},cycle:function(p){ -var self=MochiKit.Iter; -var m=MochiKit.Base; -var lst=[]; -var _15c=self.iter(p); -return {repr:function(){ -return "cycle(...)"; -},toString:m.forwardCall("repr"),next:function(){ -try{ -var rval=_15c.next(); -lst.push(rval); -return rval; +res=_15c+res; +if(_152>0){ +while(frac.length<_155){ +frac=frac+"0"; } -catch(e){ -if(e!=self.StopIteration){ -throw e; +res=res+fmt.decimal+frac; } -if(lst.length===0){ -this.next=function(){ -throw self.StopIteration; +return _157+res+_158; }; -}else{ -var i=-1; -this.next=function(){ -i=(i+1)%lst.length; -return lst[i]; }; +MochiKit.Format.numberFormatter=function(_160,_161,_162){ +if(typeof (_161)=="undefined"){ +_161=""; } -return this.next(); -} -}}; -},repeat:function(elem,n){ -var m=MochiKit.Base; -if(typeof (n)=="undefined"){ -return {repr:function(){ -return "repeat("+m.repr(elem)+")"; -},toString:m.forwardCall("repr"),next:function(){ -return elem; -}}; -} -return {repr:function(){ -return "repeat("+m.repr(elem)+", "+n+")"; -},toString:m.forwardCall("repr"),next:function(){ -if(n<=0){ -throw MochiKit.Iter.StopIteration; +var _163=_160.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); +if(!_163){ +throw TypeError("Invalid pattern"); } -n-=1; -return elem; -}}; -},next:function(_162){ -return _162.next(); -},izip:function(p,q){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -var next=self.next; -var _168=m.map(self.iter,arguments); -return {repr:function(){ -return "izip(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return m.map(next,_168); -}}; -},ifilter:function(pred,seq){ -var m=MochiKit.Base; -seq=MochiKit.Iter.iter(seq); -if(pred===null){ -pred=m.operator.truth; +var _164=_160.substr(0,_163.index); +var _165=_160.substr(_163.index+_163[0].length); +if(_164.search(/-/)==-1){ +_164=_164+"-"; } -return {repr:function(){ -return "ifilter(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(true){ -var rval=seq.next(); -if(pred(rval)){ -return rval; +var _166=_163[1]; +var frac=(typeof (_163[2])=="string"&&_163[2]!="")?_163[2]:""; +var _168=(typeof (_163[3])=="string"&&_163[3]!=""); +var tmp=_166.split(/,/); +var _16a; +if(typeof (_162)=="undefined"){ +_162="default"; } +if(tmp.length==1){ +_16a=null; +}else{ +_16a=tmp[1].length; } -return undefined; -}}; -},ifilterfalse:function(pred,seq){ +var _16b=_166.length-_166.replace(/0/g,"").length; +var _16c=frac.length-frac.replace(/0/g,"").length; +var _16d=frac.length; +var rval=MochiKit.Format._numberFormatter(_161,_164,_165,_162,_168,_16d,_16b,_16a,_16c); var m=MochiKit.Base; -seq=MochiKit.Iter.iter(seq); -if(pred===null){ -pred=m.operator.truth; +if(m){ +var fn=arguments.callee; +var args=m.concat(arguments); +rval.repr=function(){ +return [self.NAME,"(",map(m.repr,args).join(", "),")"].join(""); +}; } -return {repr:function(){ -return "ifilterfalse(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(true){ -var rval=seq.next(); -if(!pred(rval)){ return rval; +}; +MochiKit.Format.formatLocale=function(_172){ +if(typeof (_172)=="undefined"||_172===null){ +_172="default"; } +if(typeof (_172)=="string"){ +var rval=MochiKit.Format.LOCALE[_172]; +if(typeof (rval)=="string"){ +rval=arguments.callee(rval); +MochiKit.Format.LOCALE[_172]=rval; } -return undefined; -}}; -},islice:function(seq){ -var self=MochiKit.Iter; -var m=MochiKit.Base; -seq=self.iter(seq); -var _174=0; -var stop=0; -var step=1; -var i=-1; -if(arguments.length==2){ -stop=arguments[1]; -}else{ -if(arguments.length==3){ -_174=arguments[1]; -stop=arguments[2]; -}else{ -_174=arguments[1]; -stop=arguments[2]; -step=arguments[3]; -} -} -return {repr:function(){ -return "islice("+["...",_174,stop,step].join(", ")+")"; -},toString:m.forwardCall("repr"),next:function(){ -var rval; -while(i<_174){ -rval=seq.next(); -i++; -} -if(_174>=stop){ -throw self.StopIteration; -} -_174+=step; return rval; -}}; -},imap:function(fun,p,q){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -var _17e=m.map(self.iter,m.extend(null,arguments,1)); -var map=m.map; -var next=self.next; -return {repr:function(){ -return "imap(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return fun.apply(this,map(next,_17e)); -}}; -},applymap:function(fun,seq,self){ -seq=MochiKit.Iter.iter(seq); -var m=MochiKit.Base; -return {repr:function(){ -return "applymap(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return fun.apply(self,seq.next()); -}}; -},chain:function(p,q){ -var self=MochiKit.Iter; -var m=MochiKit.Base; -if(arguments.length==1){ -return self.iter(arguments[0]); -} -var _189=m.map(self.iter,arguments); -return {repr:function(){ -return "chain(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(_189.length>1){ -try{ -return _189[0].next(); -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -_189.shift(); +}else{ +return _172; } +}; +MochiKit.Format.twoDigitAverage=function(_174,_175){ +if(_175){ +var res=_174/_175; +if(!isNaN(res)){ +return MochiKit.Format.twoDigitFloat(_174/_175); } -if(_189.length==1){ -var arg=_189.shift(); -this.next=m.bind("next",arg); -return this.next(); } -throw self.StopIteration; -}}; -},takewhile:function(pred,seq){ -var self=MochiKit.Iter; -seq=self.iter(seq); -return {repr:function(){ -return "takewhile(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -var rval=seq.next(); -if(!pred(rval)){ -this.next=function(){ -throw self.StopIteration; -}; -this.next(); +return "0"; +}; +MochiKit.Format.twoDigitFloat=function(_177){ +var sign=(_177<0?"-":""); +var s=Math.floor(Math.abs(_177)*100).toString(); +if(s=="0"){ +return s; } -return rval; -}}; -},dropwhile:function(pred,seq){ -seq=MochiKit.Iter.iter(seq); -var m=MochiKit.Base; -var bind=m.bind; -return {"repr":function(){ -return "dropwhile(...)"; -},"toString":m.forwardCall("repr"),"next":function(){ -while(true){ -var rval=seq.next(); -if(!pred(rval)){ -break; +if(s.length<3){ +while(s.charAt(s.length-1)=="0"){ +s=s.substring(0,s.length-1); } +return sign+"0."+s; } -this.next=bind("next",seq); -return rval; -}}; -},_tee:function(_194,sync,_196){ -sync.pos[_194]=-1; -var m=MochiKit.Base; -var _198=m.listMin; -return {repr:function(){ -return "tee("+_194+", ...)"; -},toString:m.forwardCall("repr"),next:function(){ -var rval; -var i=sync.pos[_194]; -if(i==sync.max){ -rval=_196.next(); -sync.deque.push(rval); -sync.max+=1; -sync.pos[_194]+=1; +var head=sign+s.substring(0,s.length-2); +var tail=s.substring(s.length-2,s.length); +if(tail=="00"){ +return head; }else{ -rval=sync.deque[i-sync.min]; -sync.pos[_194]+=1; -if(i==sync.min&&_198(sync.pos)!=sync.min){ -sync.min+=1; -sync.deque.shift(); -} -} -return rval; -}}; -},tee:function(_19b,n){ -var rval=[]; -var sync={"pos":[],"deque":[],"max":-1,"min":-1}; -if(arguments.length==1||typeof (n)=="undefined"||n===null){ -n=2; +if(tail.charAt(1)=="0"){ +return head+"."+tail.charAt(0); +}else{ +return head+"."+tail; } -var self=MochiKit.Iter; -_19b=self.iter(_19b); -var _tee=self._tee; -for(var i=0;i0&&_1ac>=stop)||(step<0&&_1ac<=stop)){ -throw MochiKit.Iter.StopIteration; +if(typeof (JSAN)!="undefined"){ +JSAN.use("MochiKit.Base",[]); } -var rval=_1ac; -_1ac+=step; -return rval; -},repr:function(){ -return "range("+[_1ac,stop,step].join(", ")+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -},sum:function(_1b0,_1b1){ -if(typeof (_1b1)=="undefined"||_1b1===null){ -_1b1=0; -} -var x=_1b1; -var self=MochiKit.Iter; -_1b0=self.iter(_1b0); try{ -while(true){ -x+=_1b0.next(); +if(typeof (MochiKit.Base)=="undefined"){ +throw ""; } } catch(e){ -if(e!=self.StopIteration){ -throw e; +throw "MochiKit.DOM depends on MochiKit.Base!"; } +if(typeof (MochiKit.DOM)=="undefined"){ +MochiKit.DOM={}; } -return x; -},exhaust:function(_1b4){ -var self=MochiKit.Iter; -_1b4=self.iter(_1b4); +MochiKit.DOM.NAME="MochiKit.DOM"; +MochiKit.DOM.VERSION="1.4"; +MochiKit.DOM.__repr__=function(){ +return "["+this.NAME+" "+this.VERSION+"]"; +}; +MochiKit.DOM.toString=function(){ +return this.__repr__(); +}; +MochiKit.DOM.EXPORT=["removeEmptyTextNodes","formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","isChildNode","getNodeAttribute","removeNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","insertSiblingNodesAfter","insertSiblingNodesBefore","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","scrapeText","isParent","getFirstParentByTagAndClassName","makeClipping","undoClipping","makePositioned","undoPositioned","getFirstElementByTagAndClassName"]; +MochiKit.DOM.EXPORT_OK=["domConverters"]; +MochiKit.DOM.DEPRECATED=[["computedStyle","MochiKit.Style.getStyle","1.4"],["elementDimensions","MochiKit.Style.getElementDimensions","1.4"],["elementPosition","MochiKit.Style.getElementPosition","1.4"],["hideElement","MochiKit.Style.hideElement","1.4"],["setElementDimensions","MochiKit.Style.setElementDimensions","1.4"],["setElementPosition","MochiKit.Style.setElementPosition","1.4"],["setDisplayForElement","MochiKit.Style.setDisplayForElement","1.4"],["setOpacity","MochiKit.Style.setOpacity","1.4"],["showElement","MochiKit.Style.showElement","1.4"],["Coordinates","MochiKit.Style.Coordinates","1.4"],["Dimensions","MochiKit.Style.Dimensions","1.4"]]; +MochiKit.DOM.getViewportDimensions=new Function(""+"if (!MochiKit[\"Style\"]) {"+" throw new Error(\"This function has been deprecated and depends on MochiKit.Style.\");"+"}"+"return MochiKit.Style.getViewportDimensions.apply(this, arguments);"); +MochiKit.Base.update(MochiKit.DOM,{currentWindow:function(){ +return MochiKit.DOM._window; +},currentDocument:function(){ +return MochiKit.DOM._document; +},withWindow:function(win,func){ +var self=MochiKit.DOM; +var _194=self._document; +var _195=self._window; +var rval; try{ -while(true){ -_1b4.next(); -} +self._window=win; +self._document=win.document; +rval=func(); } catch(e){ -if(e!=self.StopIteration){ +self._window=_195; +self._document=_194; throw e; } -} -},forEach:function(_1b6,func,self){ +self._window=_195; +self._document=_194; +return rval; +},formContents:function(elem){ +var _198=[]; +var _199=[]; var m=MochiKit.Base; -if(arguments.length>2){ -func=m.bind(func,self); -} -if(m.isArrayLike(_1b6)){ -try{ -for(var i=0;i<_1b6.length;i++){ -func(_1b6[i]); -} -} -catch(e){ -if(e!=MochiKit.Iter.StopIteration){ -throw e; -} -} +var self=MochiKit.DOM; +if(typeof (elem)=="undefined"||elem===null){ +elem=self._document.body; }else{ -self=MochiKit.Iter; -self.exhaust(self.imap(func,_1b6)); -} -},every:function(_1bb,func){ -var self=MochiKit.Iter; -try{ -self.ifilterfalse(func,_1bb).next(); -return false; +elem=self.getElement(elem); } -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -return true; -} -},sorted:function(_1be,cmp){ -var rval=MochiKit.Iter.list(_1be); -if(arguments.length==1){ -cmp=MochiKit.Base.compare; -} -rval.sort(cmp); -return rval; -},reversed:function(_1c1){ -var rval=MochiKit.Iter.list(_1c1); -rval.reverse(); -return rval; -},some:function(_1c3,func){ -var self=MochiKit.Iter; -try{ -self.ifilter(func,_1c3).next(); -return true; +m.nodeWalk(elem,function(elem){ +var name=elem.name; +if(m.isNotEmpty(name)){ +var _19e=elem.tagName.toUpperCase(); +if(_19e==="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){ +return null; } -catch(e){ -if(e!=self.StopIteration){ -throw e; +if(_19e==="SELECT"){ +if(elem.type=="select-one"){ +if(elem.selectedIndex>=0){ +var opt=elem.options[elem.selectedIndex]; +var v=opt.value; +if(!v){ +var h=opt.outerHTML; +if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ +v=opt.text; } -return false; } -},iextend:function(lst,_1c7){ -if(MochiKit.Base.isArrayLike(_1c7)){ -for(var i=0;i<_1c7.length;i++){ -lst.push(_1c7[i]); +_198.push(name); +_199.push(v); +return null; } +_198.push(name); +_199.push(""); +return null; }else{ -var self=MochiKit.Iter; -_1c7=self.iter(_1c7); -try{ -while(true){ -lst.push(_1c7.next()); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; +var opts=elem.options; +if(!opts.length){ +_198.push(name); +_199.push(""); +return null; } +for(var i=0;i]+\svalue\s*=/i)){ +v=opt.text; } -return lst; -},groupby:function(_1ca,_1cb){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_1cb=m.operator.identity; } -_1ca=self.iter(_1ca); -var pk=undefined; -var k=undefined; -var v; -function fetch(){ -v=_1ca.next(); -k=_1cb(v); -} -function eat(){ -var ret=v; -v=undefined; -return ret; -} -var _1d2=true; -var _1d3=m.compare; -return {repr:function(){ -return "groupby(...)"; -},next:function(){ -while(_1d3(k,pk)===0){ -fetch(); -if(_1d2){ -_1d2=false; -break; +_198.push(name); +_199.push(v); } +return null; } -pk=k; -return [k,{next:function(){ -if(v==undefined){ -fetch(); } -if(_1d3(k,pk)!==0){ -throw self.StopIteration; +if(_19e==="FORM"||_19e==="P"||_19e==="SPAN"||_19e==="DIV"){ +return elem.childNodes; } -return eat(); -}}]; -}}; -},groupby_as_array:function(_1d4,_1d5){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_1d5=m.operator.identity; +_198.push(name); +_199.push(elem.value||""); +return null; } -_1d4=self.iter(_1d4); -var _1d8=[]; -var _1d9=true; -var _1da; -var _1db=m.compare; -while(true){ +return elem.childNodes; +}); +return [_198,_199]; +},withDocument:function(doc,func){ +var self=MochiKit.DOM; +var _1a7=self._document; +var rval; try{ -var _1dc=_1d4.next(); -var key=_1d5(_1dc); +self._document=doc; +rval=func(); } catch(e){ -if(e==self.StopIteration){ -break; -} +self._document=_1a7; throw e; } -if(_1d9||_1db(key,_1da)!==0){ -var _1de=[]; -_1d8.push([key,_1de]); +self._document=_1a7; +return rval; +},registerDOMConverter:function(name,_1aa,wrap,_1ac){ +MochiKit.DOM.domConverters.register(name,_1aa,wrap,_1ac); +},coerceToDOM:function(node,ctx){ +var m=MochiKit.Base; +var im=MochiKit.Iter; +var self=MochiKit.DOM; +if(im){ +var iter=im.iter; +var _1b3=im.repeat; +var map=m.map; } -_1de.push(_1dc); -_1d9=false; -_1da=key; +var _1b5=self.domConverters; +var _1b6=arguments.callee; +var _1b7=m.NotFound; +while(true){ +if(typeof (node)=="undefined"||node===null){ +return null; } -return _1d8; -},arrayLikeIter:function(_1df){ -var i=0; -return {repr:function(){ -return "arrayLikeIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -if(i>=_1df.length){ -throw MochiKit.Iter.StopIteration; +if(typeof (node)=="function"&&typeof (node.length)=="number"&&!(node instanceof Function)){ +node=im.list(node); } -return _1df[i++]; -}}; -},hasIterateNext:function(_1e1){ -return (_1e1&&typeof (_1e1.iterateNext)=="function"); -},iterateNextIter:function(_1e2){ -return {repr:function(){ -return "iterateNextIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -var rval=_1e2.iterateNext(); -if(rval===null||rval===undefined){ -throw MochiKit.Iter.StopIteration; +if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){ +return node; } -return rval; -}}; -}}); -MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter",]; -MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"]; -MochiKit.Iter.__new__=function(){ -var m=MochiKit.Base; -if(typeof (StopIteration)!="undefined"){ -this.StopIteration=StopIteration; -}else{ -this.StopIteration=new m.NamedError("StopIteration"); +if(typeof (node)=="number"||typeof (node)=="boolean"){ +node=node.toString(); } -this.iteratorRegistry=new m.AdapterRegistry(); -this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter); -this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -MochiKit.Iter.__new__(); -if(MochiKit.__export__){ -reduce=MochiKit.Iter.reduce; +if(typeof (node)=="string"){ +return self._document.createTextNode(node); } -MochiKit.Base._exportSymbols(this,MochiKit.Iter); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Logging"); -dojo.require("MochiKit.Base"); +if(typeof (node.__dom__)=="function"){ +node=node.__dom__(ctx); +continue; } -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); +if(typeof (node.dom)=="function"){ +node=node.dom(ctx); +continue; } -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; +if(typeof (node)=="function"){ +node=node.apply(ctx,[ctx]); +continue; } +if(im){ +var _1b8=null; +try{ +_1b8=iter(node); } catch(e){ -throw "MochiKit.Logging depends on MochiKit.Base!"; } -if(typeof (MochiKit.Logging)=="undefined"){ -MochiKit.Logging={}; +if(_1b8){ +return map(_1b6,_1b8,_1b3(ctx)); } -MochiKit.Logging.NAME="MochiKit.Logging"; -MochiKit.Logging.VERSION="1.4"; -MochiKit.Logging.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Logging.toString=function(){ -return this.__repr__(); -}; -MochiKit.Logging.EXPORT=["LogLevel","LogMessage","Logger","alertListener","logger","log","logError","logDebug","logFatal","logWarning"]; -MochiKit.Logging.EXPORT_OK=["logLevelAtLeast","isLogMessage","compareLogMessage"]; -MochiKit.Logging.LogMessage=function(num,_1e6,info){ -this.num=num; -this.level=_1e6; -this.info=info; -this.timestamp=new Date(); -}; -MochiKit.Logging.LogMessage.prototype={repr:function(){ -var m=MochiKit.Base; -return "LogMessage("+m.map(m.repr,[this.num,this.level,this.info]).join(", ")+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_1e9){ -var self=MochiKit.Logging; -if(typeof (_1e9)=="string"){ -_1e9=self.LogLevel[_1e9]; -} -return function(msg){ -var _1ec=msg.level; -if(typeof (_1ec)=="string"){ -_1ec=self.LogLevel[_1ec]; -} -return _1ec>=_1e9; -}; -},isLogMessage:function(){ -var _1ed=MochiKit.Logging.LogMessage; -for(var i=0;i=0&&this._messages.length>this.maxSize){ -this._messages.shift(); -} -},getMessages:function(_1ff){ -var _200=0; -if(!(typeof (_1ff)=="undefined"||_1ff===null)){ -_200=Math.max(0,this._messages.length-_1ff); -} -return this._messages.slice(_200); -},getMessageText:function(_201){ -if(typeof (_201)=="undefined"||_201===null){ -_201=30; -} -var _202=this.getMessages(_201); -if(_202.length){ -var lst=map(function(m){ -return "\n ["+m.num+"] "+m.level+": "+m.info.join(" "); -},_202); -lst.unshift("LAST "+_202.length+" MESSAGES:"); -return lst.join(""); -} -return ""; -},debuggingBookmarklet:function(_205){ -if(typeof (MochiKit.LoggingPane)=="undefined"){ -alert(this.getMessageText()); -}else{ -MochiKit.LoggingPane.createLoggingPane(_205||false); } -}}; -MochiKit.Logging.__new__=function(){ -this.LogLevel={ERROR:40,FATAL:50,WARNING:30,INFO:20,DEBUG:10}; -var m=MochiKit.Base; -m.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage); -var _207=m.partial; -var _208=this.Logger; -var _209=_208.prototype.baseLog; -m.update(this.Logger.prototype,{debug:_207(_209,"DEBUG"),log:_207(_209,"INFO"),error:_207(_209,"ERROR"),fatal:_207(_209,"FATAL"),warning:_207(_209,"WARNING")}); -var self=this; -var _20b=function(name){ -return function(){ -self.logger[name].apply(self.logger,arguments); -}; -}; -this.log=_20b("log"); -this.logError=_20b("error"); -this.logDebug=_20b("debug"); -this.logFatal=_20b("fatal"); -this.logWarning=_20b("warning"); -this.logger=new _208(); -this.logger.useNativeConsole=true; -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -if(typeof (printfire)=="undefined"&&typeof (document)!="undefined"&&document.createEvent&&typeof (dispatchEvent)!="undefined"){ -printfire=function(){ -printfire.args=arguments; -var ev=document.createEvent("Events"); -ev.initEvent("printfire",false,true); -dispatchEvent(ev); -}; +return false; +},setNodeAttribute:function(node,attr,_1be){ +var o={}; +o[attr]=_1be; +try{ +return MochiKit.DOM.updateNodeAttributes(node,o); } -MochiKit.Logging.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Logging); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.DateTime"); +catch(e){ } -if(typeof (MochiKit)=="undefined"){ -MochiKit={}; +return null; +},getNodeAttribute:function(node,attr){ +var self=MochiKit.DOM; +var _1c3=self.attributeArray.renames[attr]; +node=self.getElement(node); +try{ +if(_1c3){ +return node[_1c3]; } -if(typeof (MochiKit.DateTime)=="undefined"){ -MochiKit.DateTime={}; +return node.getAttribute(attr); } -MochiKit.DateTime.NAME="MochiKit.DateTime"; -MochiKit.DateTime.VERSION="1.4"; -MochiKit.DateTime.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.DateTime.toString=function(){ -return this.__repr__(); -}; -MochiKit.DateTime.isoDate=function(str){ -str=str+""; -if(typeof (str)!="string"||str.length===0){ -return null; +catch(e){ } -var iso=str.split("-"); -if(iso.length===0){ return null; +},removeNodeAttribute:function(node,attr){ +var self=MochiKit.DOM; +var _1c7=self.attributeArray.renames[attr]; +node=self.getElement(node); +try{ +if(_1c7){ +return node[_1c7]; } -return new Date(iso[0],iso[1]-1,iso[2]); -}; -MochiKit.DateTime._isoRegexp=/(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/; -MochiKit.DateTime.isoTimestamp=function(str){ -str=str+""; -if(typeof (str)!="string"||str.length===0){ -return null; +return node.removeAttribute(attr); +} +catch(e){ } -var res=str.match(MochiKit.DateTime._isoRegexp); -if(typeof (res)=="undefined"||res===null){ return null; +},updateNodeAttributes:function(node,_1c9){ +var elem=node; +var self=MochiKit.DOM; +if(typeof (node)=="string"){ +elem=self.getElement(node); } -var year,_213,day,hour,min,sec,msec; -year=parseInt(res[1],10); -if(typeof (res[2])=="undefined"||res[2]===""){ -return new Date(year); +if(_1c9){ +var _1cc=MochiKit.Base.updatetree; +if(self.attributeArray.compliant){ +for(var k in _1c9){ +var v=_1c9[k]; +if(typeof (v)=="object"&&typeof (elem[k])=="object"){ +if(k=="style"&&MochiKit.Style){ +MochiKit.Style.setStyle(elem,v); +}else{ +_1cc(elem[k],v); } -_213=parseInt(res[2],10)-1; -day=parseInt(res[3],10); -if(typeof (res[4])=="undefined"||res[4]===""){ -return new Date(year,_213,day); +}else{ +if(k.substring(0,2)=="on"){ +if(typeof (v)=="string"){ +v=new Function(v); } -hour=parseInt(res[4],10); -min=parseInt(res[5],10); -sec=(typeof (res[6])!="undefined"&&res[6]!=="")?parseInt(res[6],10):0; -if(typeof (res[7])!="undefined"&&res[7]!==""){ -msec=Math.round(1000*parseFloat("0."+res[7])); +elem[k]=v; }else{ -msec=0; +elem.setAttribute(k,v); } -if((typeof (res[8])=="undefined"||res[8]==="")&&(typeof (res[9])=="undefined"||res[9]==="")){ -return new Date(year,_213,day,hour,min,sec,msec); } -var ofs; -if(typeof (res[9])!="undefined"&&res[9]!==""){ -ofs=parseInt(res[10],10)*3600000; -if(typeof (res[11])!="undefined"&&res[11]!==""){ -ofs+=parseInt(res[11],10)*60000; } -if(res[9]=="-"){ -ofs=-ofs; +}else{ +var _1cf=self.attributeArray.renames; +for(var k in _1c9){ +v=_1c9[k]; +var _1d0=_1cf[k]; +if(k=="style"&&typeof (v)=="string"){ +elem.style.cssText=v; +}else{ +if(typeof (_1d0)=="string"){ +elem[_1d0]=v; +}else{ +if(typeof (elem[k])=="object"&&typeof (v)=="object"){ +if(k=="style"&&MochiKit.Style){ +MochiKit.Style.setStyle(elem,v); +}else{ +_1cc(elem[k],v); } }else{ -ofs=0; +if(k.substring(0,2)=="on"){ +if(typeof (v)=="string"){ +v=new Function(v); } -return new Date(Date.UTC(year,_213,day,hour,min,sec,msec)-ofs); -}; -MochiKit.DateTime.toISOTime=function(date,_21b){ -if(typeof (date)=="undefined"||date===null){ -return null; +elem[k]=v; +}else{ +elem.setAttribute(k,v); } -var hh=date.getHours(); -var mm=date.getMinutes(); -var ss=date.getSeconds(); -var lst=[((_21b&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)]; -return lst.join(":"); -}; -MochiKit.DateTime.toISOTimestamp=function(date,_221){ -if(typeof (date)=="undefined"||date===null){ -return null; } -var sep=_221?"T":" "; -var foot=_221?"Z":""; -if(_221){ -date=new Date(date.getTime()+(date.getTimezoneOffset()*60000)); } -return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_221)+foot; -}; -MochiKit.DateTime.toISODate=function(date){ -if(typeof (date)=="undefined"||date===null){ -return null; } -var _225=MochiKit.DateTime._padTwo; -return [date.getFullYear(),_225(date.getMonth()+1),_225(date.getDate())].join("-"); -}; -MochiKit.DateTime.americanDate=function(d){ -d=d+""; -if(typeof (d)!="string"||d.length===0){ -return null; } -var a=d.split("/"); -return new Date(a[2],a[0]-1,a[1]); -}; -MochiKit.DateTime._padTwo=function(n){ -return (n>9)?n:"0"+n; -}; -MochiKit.DateTime.toPaddedAmericanDate=function(d){ -if(typeof (d)=="undefined"||d===null){ -return null; } -var _22a=MochiKit.DateTime._padTwo; -return [_22a(d.getMonth()+1),_22a(d.getDate()),d.getFullYear()].join("/"); -}; -MochiKit.DateTime.toAmericanDate=function(d){ -if(typeof (d)=="undefined"||d===null){ -return null; } -return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/"); -}; -MochiKit.DateTime.EXPORT=["isoDate","isoTimestamp","toISOTime","toISOTimestamp","toISODate","americanDate","toPaddedAmericanDate","toAmericanDate"]; -MochiKit.DateTime.EXPORT_OK=[]; -MochiKit.DateTime.EXPORT_TAGS={":common":MochiKit.DateTime.EXPORT,":all":MochiKit.DateTime.EXPORT}; -MochiKit.DateTime.__new__=function(){ -var base=this.NAME+"."; -for(var k in this){ -var o=this[k]; -if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ -try{ -o.NAME=base+k; +return elem; +},appendChildNodes:function(node){ +var elem=node; +var self=MochiKit.DOM; +if(typeof (node)=="string"){ +elem=self.getElement(node); } -catch(e){ +var _1d4=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +var _1d5=MochiKit.Base.concat; +while(_1d4.length){ +var n=_1d4.shift(); +if(typeof (n)=="undefined"||n===null){ +}else{ +if(typeof (n.nodeType)=="number"){ +elem.appendChild(n); +}else{ +_1d4=_1d5(n,_1d4); } } } -}; -MochiKit.DateTime.__new__(); -if(typeof (MochiKit.Base)!="undefined"){ -MochiKit.Base._exportSymbols(this,MochiKit.DateTime); +return elem; +},insertSiblingNodesBefore:function(node){ +var elem=node; +var self=MochiKit.DOM; +if(typeof (node)=="string"){ +elem=self.getElement(node); +} +var _1da=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +var _1db=elem.parentNode; +var _1dc=MochiKit.Base.concat; +while(_1da.length){ +var n=_1da.shift(); +if(typeof (n)=="undefined"||n===null){ }else{ -(function(_22f,_230){ -if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){ -var all=_230.EXPORT_TAGS[":all"]; -for(var i=0;i_23a){ -var i=_242.length-_23a; -res=fmt.separator+_242.substring(i,_242.length)+res; -_242=_242.substring(0,i); +if(name=="input"&&"type" in _1e7){ +_1ed+=" type=\""+self.escapeHTML(_1e7.type)+"\""; } +if(_1ed){ +name="<"+name+_1ed+">"; +_1ec=false; } -res=_242+res; -if(_238>0){ -while(frac.length<_23b){ -frac=frac+"0"; } -res=res+fmt.decimal+frac; +var d=self._document; +if(_1ec&&d===document){ +elem=d.createElementNS("http://www.w3.org/1999/xhtml",name); +}else{ +elem=d.createElement(name); } -return _23d+res+_23e; -}; -}; -MochiKit.Format.numberFormatter=function(_246,_247,_248){ -if(typeof (_247)=="undefined"){ -_247=""; +}else{ +elem=name; } -var _249=_246.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); -if(!_249){ -throw TypeError("Invalid pattern"); +if(_1e7){ +self.updateNodeAttributes(elem,_1e7); } -var _24a=_246.substr(0,_249.index); -var _24b=_246.substr(_249.index+_249[0].length); -if(_24a.search(/-/)==-1){ -_24a=_24a+"-"; +if(arguments.length<=2){ +return elem; +}else{ +var args=m.extend([elem],arguments,2); +return self.appendChildNodes.apply(this,args); } -var _24c=_249[1]; -var frac=(typeof (_249[2])=="string"&&_249[2]!="")?_249[2]:""; -var _24e=(typeof (_249[3])=="string"&&_249[3]!=""); -var tmp=_24c.split(/,/); -var _250; -if(typeof (_248)=="undefined"){ -_248="default"; +},createDOMFunc:function(){ +var m=MochiKit.Base; +return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments)); +},removeElement:function(elem){ +var e=MochiKit.DOM.getElement(elem); +e.parentNode.removeChild(e); +return e; +},swapDOM:function(dest,src){ +var self=MochiKit.DOM; +dest=self.getElement(dest); +var _1f5=dest.parentNode; +if(src){ +src=self.getElement(src); +_1f5.replaceChild(src,dest); +}else{ +_1f5.removeChild(dest); } -if(tmp.length==1){ -_250=null; +return src; +},getElement:function(id){ +var self=MochiKit.DOM; +if(arguments.length==1){ +return ((typeof (id)=="string")?self._document.getElementById(id):id); }else{ -_250=tmp[1].length; +return MochiKit.Base.map(self.getElement,arguments); } -var _251=_24c.length-_24c.replace(/0/g,"").length; -var _252=frac.length-frac.replace(/0/g,"").length; -var _253=frac.length; -var rval=MochiKit.Format._numberFormatter(_247,_24a,_24b,_248,_24e,_253,_251,_250,_252); -var m=MochiKit.Base; -if(m){ -var fn=arguments.callee; -var args=m.concat(arguments); -rval.repr=function(){ -return [self.NAME,"(",map(m.repr,args).join(", "),")"].join(""); -}; +},getElementsByTagAndClassName:function(_1f8,_1f9,_1fa){ +var self=MochiKit.DOM; +if(typeof (_1f8)=="undefined"||_1f8===null){ +_1f8="*"; } -return rval; -}; -MochiKit.Format.formatLocale=function(_258){ -if(typeof (_258)=="undefined"||_258===null){ -_258="default"; +if(typeof (_1fa)=="undefined"||_1fa===null){ +_1fa=self._document; } -if(typeof (_258)=="string"){ -var rval=MochiKit.Format.LOCALE[_258]; -if(typeof (rval)=="string"){ -rval=arguments.callee(rval); -MochiKit.Format.LOCALE[_258]=rval; +_1fa=self.getElement(_1fa); +var _1fc=(_1fa.getElementsByTagName(_1f8)||self._document.all); +if(typeof (_1f9)=="undefined"||_1f9===null){ +return MochiKit.Base.extend(null,_1fc); } -return rval; -}else{ -return _258; +var _1fd=[]; +for(var i=0;i<_1fc.length;i++){ +var _1ff=_1fc[i]; +var cls=_1ff.className; +if(!cls){ +continue; } -}; -MochiKit.Format.twoDigitAverage=function(_25a,_25b){ -if(_25b){ -var res=_25a/_25b; -if(!isNaN(res)){ -return MochiKit.Format.twoDigitFloat(_25a/_25b); +var _201=cls.split(" "); +for(var j=0;j<_201.length;j++){ +if(_201[j]==_1f9){ +_1fd.push(_1ff); +break; } } -return "0"; -}; -MochiKit.Format.twoDigitFloat=function(_25d){ -var sign=(_25d<0?"-":""); -var s=Math.floor(Math.abs(_25d)*100).toString(); -if(s=="0"){ -return s; } -if(s.length<3){ -while(s.charAt(s.length-1)=="0"){ -s=s.substring(0,s.length-1); +return _1fd; +},_newCallStack:function(path,once){ +var rval=function(){ +var _206=arguments.callee.callStack; +for(var i=0;i<_206.length;i++){ +if(_206[i].apply(this,arguments)===false){ +break; } -return sign+"0."+s; } -var head=sign+s.substring(0,s.length-2); -var tail=s.substring(s.length-2,s.length); -if(tail=="00"){ -return head; -}else{ -if(tail.charAt(1)=="0"){ -return head+"."+tail.charAt(0); -}else{ -return head+"."+tail; +if(once){ +try{ +this[path]=null; +} +catch(e){ } } }; -MochiKit.Format.lstrip=function(str,_263){ -str=str+""; -if(typeof (str)!="string"){ -return null; +rval.callStack=[]; +return rval; +},addToCallStack:function(_208,path,func,once){ +var self=MochiKit.DOM; +var _20d=_208[path]; +var _20e=_20d; +if(!(typeof (_20d)=="function"&&typeof (_20d.callStack)=="object"&&_20d.callStack!==null)){ +_20e=self._newCallStack(path,once); +if(typeof (_20d)=="function"){ +_20e.callStack.push(_20d); } -if(!_263){ -return str.replace(/^\s+/,""); -}else{ -return str.replace(new RegExp("^["+_263+"]+"),""); +_208[path]=_20e; } -}; -MochiKit.Format.rstrip=function(str,_265){ -str=str+""; -if(typeof (str)!="string"){ -return null; +_20e.callStack.push(func); +},addLoadEvent:function(func){ +var self=MochiKit.DOM; +self.addToCallStack(self._window,"onload",func,true); +},focusOnLoad:function(_211){ +var self=MochiKit.DOM; +self.addLoadEvent(function(){ +_211=self.getElement(_211); +if(_211){ +_211.focus(); } -if(!_265){ -return str.replace(/\s+$/,""); +}); +},setElementClass:function(_213,_214){ +var self=MochiKit.DOM; +var obj=self.getElement(_213); +if(self.attributeArray.compliant){ +obj.setAttribute("class",_214); }else{ -return str.replace(new RegExp("["+_265+"]+$"),""); +obj.setAttribute("className",_214); } -}; -MochiKit.Format.strip=function(str,_267){ -var self=MochiKit.Format; -return self.rstrip(self.lstrip(str,_267),_267); -}; -MochiKit.Format.truncToFixed=function(_269,_26a){ -_269=Math.floor(_269*Math.pow(10,_26a)); -var res=(_269*Math.pow(10,-_26a)).toFixed(_26a); -if(res.charAt(0)=="."){ -res="0"+res; +},toggleElementClass:function(_217){ +var self=MochiKit.DOM; +for(var i=1;i/g,">"); +},toHTML:function(dom){ +return MochiKit.DOM.emitHTML(dom).join(""); +},emitHTML:function(dom,lst){ +if(typeof (lst)=="undefined"||lst===null){ +lst=[]; +} +var _23a=[dom]; +var self=MochiKit.DOM; +var _23c=self.escapeHTML; +var _23d=self.attributeArray; +while(_23a.length){ +dom=_23a.pop(); +if(typeof (dom)=="string"){ +lst.push(dom); }else{ -_278="error"; +if(dom.nodeType==1){ +lst.push("<"+dom.tagName.toLowerCase()); +var _23e=[]; +var _23f=_23d(dom); +for(var i=0;i<_23f.length;i++){ +var a=_23f[i]; +_23e.push([" ",a.name,"=\"",_23c(a.value),"\""]); } +_23e.sort(); +for(i=0;i<_23e.length;i++){ +var _242=_23e[i]; +for(var j=0;j<_242.length;j++){ +lst.push(_242[j]); } -return "Deferred("+this.id+", "+_278+")"; -},toString:MochiKit.Base.forwardCall("repr"),_nextId:MochiKit.Base.counter(),cancel:function(){ -var self=MochiKit.Async; -if(this.fired==-1){ -if(this.canceller){ -this.canceller(this); -}else{ -this.silentlyCancelled=true; } -if(this.fired==-1){ -this.errback(new self.CancelledError(this)); +if(dom.hasChildNodes()){ +lst.push(">"); +_23a.push(""); +var _244=dom.childNodes; +for(i=_244.length-1;i>=0;i--){ +_23a.push(_244[i]); } }else{ -if((this.fired===0)&&(this.results[0] instanceof self.Deferred)){ -this.results[0].cancel(); +lst.push("/>"); } +}else{ +if(dom.nodeType==3){ +lst.push(_23c(dom.nodeValue)); } -},_resback:function(res){ -this.fired=((res instanceof Error)?1:0); -this.results[this.fired]=res; -this._fire(); -},_check:function(){ -if(this.fired!=-1){ -if(!this.silentlyCancelled){ -throw new MochiKit.Async.AlreadyCalledError(this); } -this.silentlyCancelled=false; -return; } -},callback:function(res){ -this._check(); -if(res instanceof MochiKit.Async.Deferred){ -throw new Error("Deferred instances can only be chained if they are the result of a callback"); } -this._resback(res); -},errback:function(res){ -this._check(); -var self=MochiKit.Async; -if(res instanceof self.Deferred){ -throw new Error("Deferred instances can only be chained if they are the result of a callback"); +return lst; +},scrapeText:function(node,_246){ +var rval=[]; +(function(node){ +var cn=node.childNodes; +if(cn){ +for(var i=0;i1){ -fn=MochiKit.Base.partial.apply(null,arguments); +var _24b=node.nodeValue; +if(typeof (_24b)=="string"){ +rval.push(_24b); } -return this.addCallbacks(fn,fn); -},addCallback:function(fn){ -if(arguments.length>1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(fn,null); -},addErrback:function(fn){ -if(arguments.length>1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(null,fn); -},addCallbacks:function(cb,eb){ -if(this.chained){ -throw new Error("Chained Deferreds can not be re-used"); -} -this.chain.push([cb,eb]); -if(this.fired>=0){ -this._fire(); -} -return this; -},_fire:function(){ -var _283=this.chain; -var _284=this.fired; -var res=this.results[_284]; -var self=this; -var cb=null; -while(_283.length>0&&this.paused===0){ -var pair=_283.shift(); -var f=pair[_284]; -if(f===null){ -continue; -} -try{ -res=f(res); -_284=((res instanceof Error)?1:0); -if(res instanceof MochiKit.Async.Deferred){ -cb=function(res){ -self._resback(res); -self.paused--; -if((self.paused===0)&&(self.fired>=0)){ -self._fire(); -} -}; -this.paused++; +})(MochiKit.DOM.getElement(node)); +if(_246){ +return rval; +}else{ +return rval.join(""); } +},removeEmptyTextNodes:function(_24c){ +_24c=MochiKit.DOM.getElement(_24c); +for(var i=0;i<_24c.childNodes.length;i++){ +var node=_24c.childNodes[i]; +if(node.nodeType==3&&!/\S/.test(node.nodeValue)){ +node.parentNode.removeChild(node); } -catch(err){ -_284=1; -if(!(err instanceof Error)){ -err=new MochiKit.Async.GenericError(err); } -res=err; +},makeClipping:function(_24f){ +_24f=MochiKit.DOM.getElement(_24f); +var _250=_24f.style.overflow; +if((MochiKit.Style.getStyle(_24f,"overflow")||"visible")!="hidden"){ +_24f.style.overflow="hidden"; } +return _250; +},undoClipping:function(_251,_252){ +_251=MochiKit.DOM.getElement(_251); +if(!_252){ +return; } -this.fired=_284; -this.results[_284]=res; -if(cb&&this.paused){ -res.addBoth(cb); -res.chained=true; +_251.style.overflow=_252; +},makePositioned:function(_253){ +_253=MochiKit.DOM.getElement(_253); +var pos=MochiKit.Style.getStyle(_253,"position"); +if(pos=="static"||!pos){ +_253.style.position="relative"; +if(/Opera/.test(navigator.userAgent)){ +_253.style.top=0; +_253.style.left=0; } -}}; -MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(){ -return eval("("+arguments[0].responseText+")"); -},succeed:function(_28b){ -var d=new MochiKit.Async.Deferred(); -d.callback.apply(d,arguments); -return d; -},fail:function(_28d){ -var d=new MochiKit.Async.Deferred(); -d.errback.apply(d,arguments); -return d; -},getXMLHttpRequest:function(){ -var self=arguments.callee; -if(!self.XMLHttpRequest){ -var _290=[function(){ -return new XMLHttpRequest(); -},function(){ -return new ActiveXObject("Msxml2.XMLHTTP"); -},function(){ -return new ActiveXObject("Microsoft.XMLHTTP"); -},function(){ -return new ActiveXObject("Msxml2.XMLHTTP.4.0"); -},function(){ -throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); -}]; -for(var i=0;i<_290.length;i++){ -var func=_290[i]; -try{ -self.XMLHttpRequest=func; -return func(); } -catch(e){ +},undoPositioned:function(_255){ +_255=MochiKit.DOM.getElement(_255); +if(_255.style.position=="relative"){ +_255.style.position=_255.style.top=_255.style.left=_255.style.bottom=_255.style.right=""; } +},getFirstElementByTagAndClassName:function(_256,_257,_258){ +var self=MochiKit.DOM; +if(typeof (_256)=="undefined"||_256===null){ +_256="*"; } +if(typeof (_258)=="undefined"||_258===null){ +_258=self._document; } -return self.XMLHttpRequest(); -},_xhr_onreadystatechange:function(d){ -var m=MochiKit.Base; -if(this.readyState==4){ -try{ -this.onreadystatechange=null; +_258=self.getElement(_258); +var _25a=(_258.getElementsByTagName(_256)||self._document.all); +if(typeof (_257)=="undefined"||_257===null){ +return _25a[0]; } -catch(e){ -try{ -this.onreadystatechange=m.noop; +for(var i=0;i<_25a.length;i++){ +var _25c=_25a[i]; +var _25d=_25c.className.split(" "); +for(var j=0;j<_25d.length;j++){ +if(_25d[j]==_257){ +return _25c; } -catch(e){ } } -var _295=null; -try{ -_295=this.status; -if(!_295&&m.isNotEmpty(this.responseText)){ -_295=304; +},getFirstParentByTagAndClassName:function(elem,_260,_261){ +var self=MochiKit.DOM; +elem=self.getElement(elem); +if(typeof (_260)=="undefined"||_260===null){ +_260="*"; +}else{ +_260=_260.toUpperCase(); } +if(typeof (_261)=="undefined"||_261===null){ +_261=null; } -catch(e){ +var _263=""; +var _264=""; +while(elem&&elem.tagName){ +elem=elem.parentNode; +if(_260=="*"&&_261===null){ +return elem; } -if(_295==200||_295==201||_295==204||_295==304||_295==1223){ -d.callback(this); +_263=elem.className.split(" "); +_264=elem.tagName.toUpperCase(); +if(_261===null&&_260==_264){ +return elem; }else{ -var err=new MochiKit.Async.XMLHttpRequestError(this,"Request failed"); -if(err.number){ -d.errback(err); +if(_261!==null){ +for(var i=0;i<_263.length;i++){ +if(_260=="*"&&_263[i]==_261){ +return elem; }else{ -d.errback(err); -} -} -} -},_xhr_canceller:function(req){ -try{ -req.onreadystatechange=null; -} -catch(e){ -try{ -req.onreadystatechange=MochiKit.Base.noop; +if(_260==_264&&_263[i]==_261){ +return elem; } -catch(e){ } } -req.abort(); -},sendXMLHttpRequest:function(req,_299){ -if(typeof (_299)=="undefined"||_299===null){ -_299=""; } -var m=MochiKit.Base; -var self=MochiKit.Async; -var d=new self.Deferred(m.partial(self._xhr_canceller,req)); -try{ -req.onreadystatechange=m.bind(self._xhr_onreadystatechange,req,d); -req.send(_299); } -catch(e){ -try{ -req.onreadystatechange=null; } -catch(ignore){ +return elem; +},isParent:function(_266,_267){ +if(!_266.parentNode||_266==_267){ +return false; } -d.errback(e); +if(_266.parentNode==_267){ +return true; } -return d; -},doXHR:function(url,opts){ -var self=MochiKit.Async; -return self.callLater(0,self._doXHR,url,opts); -},_doXHR:function(url,opts){ +return MochiKit.DOM.isParent(_266.parentNode,_267); +},__new__:function(win){ var m=MochiKit.Base; -opts=m.update({method:"GET",sendContent:""},opts); -var self=MochiKit.Async; -var req=self.getXMLHttpRequest(); -if(opts.queryString){ -var qs=m.queryString(opts.queryString); -if(qs){ -url+="?"+qs; -} -} -if("username" in opts){ -req.open(opts.method,url,true,opts.username,opts.password); +if(typeof (document)!="undefined"){ +this._document=document; +var _26a="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; +this._xhtml=(document.documentElement&&document.createElementNS&&document.documentElement.namespaceURI===_26a); }else{ -req.open(opts.method,url,true); -} -if(req.overrideMimeType&&opts.mimeType){ -req.overrideMimeType(opts.mimeType); -} -if(opts.headers){ -var _2a6=opts.headers; -if(!m.isArrayLike(_2a6)){ -_2a6=m.items(_2a6); -} -for(var i=0;i<_2a6.length;i++){ -var _2a8=_2a6[i]; -var name=_2a8[0]; -var _2aa=_2a8[1]; -req.setRequestHeader(name,_2aa); -} -} -return self.sendXMLHttpRequest(req,opts.sendContent); -},_buildURL:function(url){ -if(arguments.length>1){ -var m=MochiKit.Base; -var qs=m.queryString.apply(null,m.extend(null,arguments,1)); -if(qs){ -return url+"?"+qs; -} -} -return url; -},doSimpleXMLHttpRequest:function(url){ -var self=MochiKit.Async; -url=self._buildURL.apply(self,arguments); -return self.doXHR(url); -},loadJSONDoc:function(url){ -var self=MochiKit.Async; -url=self._buildURL.apply(self,arguments); -var d=self.doXHR(url,{"mimeType":"text/plain","headers":[["Accept","application/json"]]}); -d=d.addCallback(self.evalJSONRequest); -return d; -},wait:function(_2b3,_2b4){ -var d=new MochiKit.Async.Deferred(); -var m=MochiKit.Base; -if(typeof (_2b4)!="undefined"){ -d.addCallback(function(){ -return _2b4; -}); -} -var _2b7=setTimeout(m.bind("callback",d),Math.floor(_2b3*1000)); -d.canceller=function(){ -try{ -clearTimeout(_2b7); -} -catch(e){ +if(MochiKit.MockDOM){ +this._document=MochiKit.MockDOM.document; } -}; -return d; -},callLater:function(_2b8,func){ -var m=MochiKit.Base; -var _2bb=m.partial.apply(m,m.extend(null,arguments,1)); -return MochiKit.Async.wait(_2b8).addCallback(function(res){ -return _2bb(); -}); -}}); -MochiKit.Async.DeferredLock=function(){ -this.waiting=[]; -this.locked=false; -this.id=this._nextId(); -}; -MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){ -var d=new MochiKit.Async.Deferred(); -if(this.locked){ -this.waiting.push(d); -}else{ -this.locked=true; -d.callback(this); } -return d; -},release:function(){ -if(!this.locked){ -throw TypeError("Tried to release an unlocked DeferredLock"); -} -this.locked=false; -if(this.waiting.length>0){ -this.locked=true; -this.waiting.shift().callback(this); -} -},_nextId:MochiKit.Base.counter(),repr:function(){ -var _2be; -if(this.locked){ -_2be="locked, "+this.waiting.length+" waiting"; -}else{ -_2be="unlocked"; -} -return "DeferredLock("+this.id+", "+_2be+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Async.DeferredList=function(list,_2c0,_2c1,_2c2,_2c3){ -MochiKit.Async.Deferred.apply(this,[_2c3]); -this.list=list; -var _2c4=[]; -this.resultList=_2c4; -this.finishedCount=0; -this.fireOnOneCallback=_2c0; -this.fireOnOneErrback=_2c1; -this.consumeErrors=_2c2; -var cb=MochiKit.Base.bind(this._cbDeferred,this); -for(var i=0;i0){ +var _26d=m.filter; +_26c=function(node){ +return _26d(_26c.ignoreAttrFilter,node.attributes); +}; +_26c.ignoreAttr={}; +var _26f=_26b.attributes; +var _270=_26c.ignoreAttr; +for(var i=0;i<_26f.length;i++){ +var a=_26f[i]; +_270[a.name]=a.value; +} +_26c.ignoreAttrFilter=function(a){ +return (_26c.ignoreAttr[a.name]!=a.value); +}; +_26c.compliant=false; +_26c.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"}; +}else{ +_26c=function(node){ +return node.attributes; }; -MochiKit.Async.maybeDeferred=function(func){ -var self=MochiKit.Async; -var _2d2; -try{ -var r=func.apply(null,MochiKit.Base.extend([],arguments,1)); -if(r instanceof self.Deferred){ -_2d2=r; -}else{ -if(r instanceof Error){ -_2d2=self.fail(r); -}else{ -_2d2=self.succeed(r); -} -} -} -catch(e){ -_2d2=self.fail(e); +_26c.compliant=true; +_26c.renames={}; } -return _2d2; +this.attributeArray=_26c; +var _275=function(_276,arr){ +var _278=arr[1].split("."); +var str=""; +var obj={}; +str+="if (!MochiKit."+_278[1]+") { throw new Error(\""; +str+="This function has been deprecated and depends on MochiKit."; +str+=_278[1]+".\");}"; +str+="return MochiKit."+_278[1]+"."+arr[0]; +str+=".apply(this, arguments);"; +obj[_278[2]]=new Function(str); +MochiKit.Base.update(MochiKit[_276],obj); }; -MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred","doXHR"]; -MochiKit.Async.EXPORT_OK=["evalJSONRequest"]; -MochiKit.Async.__new__=function(){ -var m=MochiKit.Base; -var ne=m.partial(m._newNamedError,this); -ne("AlreadyCalledError",function(_2d6){ -this.deferred=_2d6; -}); -ne("CancelledError",function(_2d7){ -this.deferred=_2d7; -}); -ne("BrowserComplianceError",function(msg){ -this.message=msg; -}); -ne("GenericError",function(msg){ -this.message=msg; -}); -ne("XMLHttpRequestError",function(req,msg){ -this.req=req; -this.message=msg; -try{ -this.number=req.status; -} -catch(e){ -} -}); +for(var i;i=0){ -var opt=elem.options[elem.selectedIndex]; -var v=opt.value; -if(!v){ -var h=opt.outerHTML; -if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ -v=opt.text; } } -_2e3.push(name); -_2e4.push(v); -return null; +if(_283=="opacity"){ +_287=parseFloat(_287); } -_2e3.push(name); -_2e4.push(""); -return null; -}else{ -var opts=elem.options; -if(!opts.length){ -_2e3.push(name); -_2e4.push(""); -return null; +if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_283)!=-1)){ +if(MochiKit.Style.getStyle(elem,"position")=="static"){ +_287="auto"; } -for(var i=0;i]+\svalue\s*=/i)){ -v=opt.text; +return _287=="auto"?null:_287; +},setStyle:function(elem,_28a){ +elem=MochiKit.DOM.getElement(elem); +for(var name in _28a){ +if(name=="opacity"){ +MochiKit.Style.setOpacity(elem,_28a[name]); +}else{ +elem.style[MochiKit.Base.camelize(name)]=_28a[name]; } } -_2e3.push(name); -_2e4.push(v); +},setOpacity:function(elem,o){ +elem=MochiKit.DOM.getElement(elem); +var self=MochiKit.Style; +if(o==1){ +var _28f=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)); +elem.style["opacity"]=_28f?0.999999:1; +if(/MSIE/.test(navigator.userAgent)){ +elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,""); } -return null; +}else{ +if(o<0.00001){ +o=0; } +elem.style["opacity"]=o; +if(/MSIE/.test(navigator.userAgent)){ +elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")"; } -if(_2e9==="FORM"||_2e9==="P"||_2e9==="SPAN"||_2e9==="DIV"){ -return elem.childNodes; } -_2e3.push(name); -_2e4.push(elem.value||""); -return null; +},getElementPosition:function(elem,_291){ +var self=MochiKit.Style; +var dom=MochiKit.DOM; +elem=dom.getElement(elem); +if(!elem||(!(elem.x&&elem.y)&&(!elem.parentNode===null||self.getStyle(elem,"display")=="none"))){ +return undefined; } -return elem.childNodes; -}); -return [_2e3,_2e4]; -},withDocument:function(doc,func){ -var self=MochiKit.DOM; -var _2f2=self._document; -var rval; -try{ -self._document=doc; -rval=func(); -} -catch(e){ -self._document=_2f2; -throw e; -} -self._document=_2f2; -return rval; -},registerDOMConverter:function(name,_2f5,wrap,_2f7){ -MochiKit.DOM.domConverters.register(name,_2f5,wrap,_2f7); -},coerceToDOM:function(node,ctx){ -var m=MochiKit.Base; -var im=MochiKit.Iter; -var self=MochiKit.DOM; -if(im){ -var iter=im.iter; -var _2fe=im.repeat; -var map=m.map; +var c=new self.Coordinates(0,0); +var box=null; +var _296=null; +var d=MochiKit.DOM._document; +var de=d.documentElement; +var b=d.body; +if(!elem.parentNode&&elem.x&&elem.y){ +c.x+=elem.x||0; +c.y+=elem.y||0; +}else{ +if(elem.getBoundingClientRect){ +box=elem.getBoundingClientRect(); +c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); +c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0); +}else{ +if(elem.offsetParent){ +c.x+=elem.offsetLeft; +c.y+=elem.offsetTop; +_296=elem.offsetParent; +if(_296!=elem){ +while(_296){ +c.x+=_296.offsetLeft; +c.y+=_296.offsetTop; +_296=_296.offsetParent; } -var _300=self.domConverters; -var _301=arguments.callee; -var _302=m.NotFound; -while(true){ -if(typeof (node)=="undefined"||node===null){ -return null; } -if(typeof (node)=="function"&&typeof (node.length)=="number"&&!(node instanceof Function)){ -node=im.list(node); +var ua=navigator.userAgent.toLowerCase(); +if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("AppleWebKit")!=-1&&self.getStyle(elem,"position")=="absolute")){ +c.x-=b.offsetLeft; +c.y-=b.offsetTop; } -if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){ -return node; } -if(typeof (node)=="number"||typeof (node)=="boolean"){ -node=node.toString(); } -if(typeof (node)=="string"){ -return self._document.createTextNode(node); } -if(typeof (node.__dom__)=="function"){ -node=node.__dom__(ctx); -continue; +if(typeof (_291)!="undefined"){ +_291=arguments.callee(_291); +if(_291){ +c.x-=(_291.x||0); +c.y-=(_291.y||0); } -if(typeof (node.dom)=="function"){ -node=node.dom(ctx); -continue; } -if(typeof (node)=="function"){ -node=node.apply(ctx,[ctx]); -continue; +if(elem.parentNode){ +_296=elem.parentNode; +}else{ +_296=null; } -if(im){ -var _303=null; -try{ -_303=iter(node); +while(_296){ +var _29b=_296.tagName.toUpperCase(); +if(_29b==="BODY"||_29b==="HTML"){ +break; } -catch(e){ +var disp=self.getStyle(_296,"display"); +if(disp!="inline"&&disp!="table-row"){ +c.x-=_296.scrollLeft; +c.y-=_296.scrollTop; } -if(_303){ -return map(_301,_303,_2fe(ctx)); +if(_296.parentNode){ +_296=_296.parentNode; +}else{ +_296=null; } } -try{ -node=_300.match(node,ctx); -continue; +return c; +},setElementPosition:function(elem,_29e,_29f){ +elem=MochiKit.DOM.getElement(elem); +if(typeof (_29f)=="undefined"){ +_29f="px"; } -catch(e){ -if(e!=_302){ -throw e; +var _2a0={}; +var _2a1=MochiKit.Base.isUndefinedOrNull; +if(!_2a1(_29e.x)){ +_2a0["left"]=_29e.x+_29f; } +if(!_2a1(_29e.y)){ +_2a0["top"]=_29e.y+_29f; } -return self._document.createTextNode(node.toString()); +MochiKit.DOM.updateNodeAttributes(elem,{"style":_2a0}); +},getElementDimensions:function(elem){ +var self=MochiKit.Style; +var dom=MochiKit.DOM; +if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){ +return new self.Dimensions(elem.w||0,elem.h||0); } +elem=dom.getElement(elem); +if(!elem){ return undefined; -},isChildNode:function(node,_305){ -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -node=self.getElement(node); -} -if(typeof (_305)=="string"){ -_305=self.getElement(_305); -} -if(node===_305){ -return true; -} -while(node&&node.tagName.toUpperCase()!="BODY"){ -node=node.parentNode; -if(node===_305){ -return true; -} -} -return false; -},setNodeAttribute:function(node,attr,_309){ -var o={}; -o[attr]=_309; -try{ -return MochiKit.DOM.updateNodeAttributes(node,o); -} -catch(e){ -} -return null; -},getNodeAttribute:function(node,attr){ -var self=MochiKit.DOM; -var _30e=self.attributeArray.renames[attr]; -node=self.getElement(node); -try{ -if(_30e){ -return node[_30e]; -} -return node.getAttribute(attr); } -catch(e){ +var disp=self.getStyle(elem,"display"); +if(disp!="none"&&disp!==""&&typeof (disp)!="undefined"){ +return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0); } -return null; -},removeNodeAttribute:function(node,attr){ -var self=MochiKit.DOM; -var _312=self.attributeArray.renames[attr]; -node=self.getElement(node); -try{ -if(_312){ -return node[_312]; +var s=elem.style; +var _2a7=s.visibility; +var _2a8=s.position; +s.visibility="hidden"; +s.position="absolute"; +s.display=""; +var _2a9=elem.offsetWidth; +var _2aa=elem.offsetHeight; +s.display="none"; +s.position=_2a8; +s.visibility=_2a7; +return new self.Dimensions(_2a9,_2aa); +},setElementDimensions:function(elem,_2ac,_2ad){ +elem=MochiKit.DOM.getElement(elem); +if(typeof (_2ad)=="undefined"){ +_2ad="px"; } -return node.removeAttribute(attr); +var _2ae={}; +var _2af=MochiKit.Base.isUndefinedOrNull; +if(!_2af(_2ac.w)){ +_2ae["width"]=_2ac.w+_2ad; } -catch(e){ +if(!_2af(_2ac.h)){ +_2ae["height"]=_2ac.h+_2ad; } -return null; -},updateNodeAttributes:function(node,_314){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); +MochiKit.DOM.updateNodeAttributes(elem,{"style":_2ae}); +},setDisplayForElement:function(_2b0,_2b1){ +var _2b2=MochiKit.Base.extend(null,arguments,1); +var _2b3=MochiKit.DOM.getElement; +for(var i=0;i<_2b2.length;i++){ +_2b1=_2b3(_2b2[i]); +if(_2b1){ +_2b1.style.display=_2b0; } -if(_314){ -var _317=MochiKit.Base.updatetree; -if(self.attributeArray.compliant){ -for(var k in _314){ -var v=_314[k]; -if(typeof (v)=="object"&&typeof (elem[k])=="object"){ -if(k=="style"&&MochiKit.Style){ -MochiKit.Style.setStyle(elem,v); -}else{ -_317(elem[k],v); } +},getViewportDimensions:function(){ +var d=new MochiKit.Style.Dimensions(); +var w=MochiKit.DOM._window; +var b=MochiKit.DOM._document.body; +if(w.innerWidth){ +d.w=w.innerWidth; +d.h=w.innerHeight; }else{ -if(k.substring(0,2)=="on"){ -if(typeof (v)=="string"){ -v=new Function(v); -} -elem[k]=v; +if(b.parentElement.clientWidth){ +d.w=b.parentElement.clientWidth; +d.h=b.parentElement.clientHeight; }else{ -elem.setAttribute(k,v); -} -} +if(b&&b.clientWidth){ +d.w=b.clientWidth; +d.h=b.clientHeight; } -}else{ -var _31a=self.attributeArray.renames; -for(var k in _314){ -v=_314[k]; -var _31b=_31a[k]; -if(k=="style"&&typeof (v)=="string"){ -elem.style.cssText=v; -}else{ -if(typeof (_31b)=="string"){ -elem[_31b]=v; -}else{ -if(typeof (elem[k])=="object"&&typeof (v)=="object"){ -if(k=="style"&&MochiKit.Style){ -MochiKit.Style.setStyle(elem,v); -}else{ -_317(elem[k],v); } -}else{ -if(k.substring(0,2)=="on"){ -if(typeof (v)=="string"){ -v=new Function(v); } -elem[k]=v; +return d; +},getViewportPosition:function(){ +var c=new MochiKit.Style.Coordinates(0,0); +var d=MochiKit.DOM._document; +var de=d.documentElement; +var db=d.body; +if(de&&(de.scrollTop||de.scrollLeft)){ +c.x=de.scrollLeft; +c.y=de.scrollTop; }else{ -elem.setAttribute(k,v); -} +if(db){ +c.x=db.scrollLeft; +c.y=db.scrollTop; } } +return c; +},__new__:function(){ +var m=MochiKit.Base; +this.elementPosition=this.getElementPosition; +this.elementDimensions=this.getElementDimensions; +this.hideElement=m.partial(this.setDisplayForElement,"none"); +this.showElement=m.partial(this.setDisplayForElement,"block"); +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; +m.nameFunctions(this); +}}); +MochiKit.Style.__new__(); +MochiKit.Base._exportSymbols(this,MochiKit.Style); +if(typeof (dojo)!="undefined"){ +dojo.provide("MochiKit.Color"); +dojo.require("MochiKit.Base"); +dojo.require("MochiKit.DOM"); +dojo.require("MochiKit.Style"); } +if(typeof (JSAN)!="undefined"){ +JSAN.use("MochiKit.Base",[]); +JSAN.use("MochiKit.DOM",[]); +JSAN.use("MochiKit.Style",[]); } +try{ +if(typeof (MochiKit.Base)=="undefined"){ +throw ""; } } -return elem; -},appendChildNodes:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); +catch(e){ +throw "MochiKit.Color depends on MochiKit.Base"; } -var _31f=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _320=MochiKit.Base.concat; -while(_31f.length){ -var n=_31f.shift(); -if(typeof (n)=="undefined"||n===null){ -}else{ -if(typeof (n.nodeType)=="number"){ -elem.appendChild(n); -}else{ -_31f=_320(n,_31f); +try{ +if(typeof (MochiKit.DOM)=="undefined"){ +throw ""; } } +catch(e){ +throw "MochiKit.Color depends on MochiKit.DOM"; } -return elem; -},insertSiblingNodesBefore:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); +try{ +if(typeof (MochiKit.Style)=="undefined"){ +throw ""; } -var _325=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _326=elem.parentNode; -var _327=MochiKit.Base.concat; -while(_325.length){ -var n=_325.shift(); -if(typeof (n)=="undefined"||n===null){ -}else{ -if(typeof (n.nodeType)=="number"){ -_326.insertBefore(n,elem); -}else{ -_325=_327(n,_325); } +catch(e){ +throw "MochiKit.Color depends on MochiKit.Style"; } +if(typeof (MochiKit.Color)=="undefined"){ +MochiKit.Color={}; } -return _326; -},insertSiblingNodesAfter:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); +MochiKit.Color.NAME="MochiKit.Color"; +MochiKit.Color.VERSION="1.4"; +MochiKit.Color.__repr__=function(){ +return "["+this.NAME+" "+this.VERSION+"]"; +}; +MochiKit.Color.toString=function(){ +return this.__repr__(); +}; +MochiKit.Color.Color=function(red,_2be,blue,_2c0){ +if(typeof (_2c0)=="undefined"||_2c0===null){ +_2c0=1; } -var _32c=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -if(elem.nextSibling){ -return self.insertSiblingNodesBefore(elem.nextSibling,_32c); +this.rgb={r:red,g:_2be,b:blue,a:_2c0}; +}; +MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_2c1){ +var rgb=this.rgb; +var m=MochiKit.Color; +return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_2c1); +},colorWithHue:function(hue){ +var hsl=this.asHSL(); +hsl.h=hue; +var m=MochiKit.Color; +return m.Color.fromHSL(hsl); +},colorWithSaturation:function(_2c7){ +var hsl=this.asHSL(); +hsl.s=_2c7; +var m=MochiKit.Color; +return m.Color.fromHSL(hsl); +},colorWithLightness:function(_2ca){ +var hsl=this.asHSL(); +hsl.l=_2ca; +var m=MochiKit.Color; +return m.Color.fromHSL(hsl); +},darkerColorWithLevel:function(_2cd){ +var hsl=this.asHSL(); +hsl.l=Math.max(hsl.l-_2cd,0); +var m=MochiKit.Color; +return m.Color.fromHSL(hsl); +},lighterColorWithLevel:function(_2d0){ +var hsl=this.asHSL(); +hsl.l=Math.min(hsl.l+_2d0,1); +var m=MochiKit.Color; +return m.Color.fromHSL(hsl); +},blendedColor:function(_2d3,_2d4){ +if(typeof (_2d4)=="undefined"||_2d4===null){ +_2d4=0.5; +} +var sf=1-_2d4; +var s=this.rgb; +var d=_2d3.rgb; +var df=_2d4; +return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df)); +},compareRGB:function(_2d9){ +var a=this.asRGB(); +var b=_2d9.asRGB(); +return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]); +},isLight:function(){ +return this.asHSL().b>0.5; +},isDark:function(){ +return (!this.isLight()); +},toHSLString:function(){ +var c=this.asHSL(); +var ccc=MochiKit.Color.clampColorComponent; +var rval=this._hslString; +if(!rval){ +var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%"); +var a=c.a; +if(a>=1){ +a=1; +rval="hsl("+mid+")"; }else{ -return self.appendChildNodes(elem.parentNode,_32c); +if(a<=0){ +a=0; } -},replaceChildNodes:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -arguments[0]=elem; +rval="hsla("+mid+","+a+")"; } -var _330; -while((_330=elem.firstChild)){ -elem.removeChild(_330); +this._hslString=rval; } -if(arguments.length<2){ -return elem; +return rval; +},toRGBString:function(){ +var c=this.rgb; +var ccc=MochiKit.Color.clampColorComponent; +var rval=this._rgbString; +if(!rval){ +var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0)); +if(c.a!=1){ +rval="rgba("+mid+","+c.a+")"; }else{ -return self.appendChildNodes.apply(this,arguments); -} -},createDOM:function(name,_332){ -var elem; -var self=MochiKit.DOM; -var m=MochiKit.Base; -if(typeof (_332)=="string"||typeof (_332)=="number"){ -var args=m.extend([name,null],arguments,1); -return arguments.callee.apply(this,args); +rval="rgb("+mid+")"; } -if(typeof (name)=="string"){ -var _337=self._xhtml; -if(_332&&!self.attributeArray.compliant){ -var _338=""; -if("name" in _332){ -_338+=" name=\""+self.escapeHTML(_332.name)+"\""; +this._rgbString=rval; } -if(name=="input"&&"type" in _332){ -_338+=" type=\""+self.escapeHTML(_332.type)+"\""; +return rval; +},asRGB:function(){ +return MochiKit.Base.clone(this.rgb); +},toHexString:function(){ +var m=MochiKit.Color; +var c=this.rgb; +var ccc=MochiKit.Color.clampColorComponent; +var rval=this._hexString; +if(!rval){ +rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255))); +this._hexString=rval; } -if(_338){ -name="<"+name+_338+">"; -_337=false; +return rval; +},asHSV:function(){ +var hsv=this.hsv; +var c=this.rgb; +if(typeof (hsv)=="undefined"||hsv===null){ +hsv=MochiKit.Color.rgbToHSV(this.rgb); +this.hsv=hsv; } +return MochiKit.Base.clone(hsv); +},asHSL:function(){ +var hsl=this.hsl; +var c=this.rgb; +if(typeof (hsl)=="undefined"||hsl===null){ +hsl=MochiKit.Color.rgbToHSL(this.rgb); +this.hsl=hsl; } -var d=self._document; -if(_337&&d===document){ -elem=d.createElementNS("http://www.w3.org/1999/xhtml",name); +return MochiKit.Base.clone(hsl); +},toString:function(){ +return this.toRGBString(); +},repr:function(){ +var c=this.rgb; +var col=[c.r,c.g,c.b,c.a]; +return this.__class__.NAME+"("+col.join(", ")+")"; +}}; +MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_2f0,blue,_2f2){ +var _2f3=MochiKit.Color.Color; +if(arguments.length==1){ +var rgb=red; +red=rgb.r; +_2f0=rgb.g; +blue=rgb.b; +if(typeof (rgb.a)=="undefined"){ +_2f2=undefined; }else{ -elem=d.createElement(name); +_2f2=rgb.a; } -}else{ -elem=name; } -if(_332){ -self.updateNodeAttributes(elem,_332); +return new _2f3(red,_2f0,blue,_2f2); +},fromHSL:function(hue,_2f6,_2f7,_2f8){ +var m=MochiKit.Color; +return m.Color.fromRGB(m.hslToRGB.apply(m,arguments)); +},fromHSV:function(hue,_2fb,_2fc,_2fd){ +var m=MochiKit.Color; +return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments)); +},fromName:function(name){ +var _300=MochiKit.Color.Color; +if(name.charAt(0)=="\""){ +name=name.substr(1,name.length-2); } -if(arguments.length<=2){ -return elem; +var _301=_300._namedColors[name.toLowerCase()]; +if(typeof (_301)=="string"){ +return _300.fromHexString(_301); }else{ -var args=m.extend([elem],arguments,2); -return self.appendChildNodes.apply(this,args); +if(name=="transparent"){ +return _300.transparentColor(); } -},createDOMFunc:function(){ -var m=MochiKit.Base; -return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments)); -},removeElement:function(elem){ -var e=MochiKit.DOM.getElement(elem); -e.parentNode.removeChild(e); -return e; -},swapDOM:function(dest,src){ -var self=MochiKit.DOM; -dest=self.getElement(dest); -var _340=dest.parentNode; -if(src){ -src=self.getElement(src); -_340.replaceChild(src,dest); -}else{ -_340.removeChild(dest); } -return src; -},getElement:function(id){ -var self=MochiKit.DOM; -if(arguments.length==1){ -return ((typeof (id)=="string")?self._document.getElementById(id):id); +return null; +},fromString:function(_302){ +var self=MochiKit.Color.Color; +var _304=_302.substr(0,3); +if(_304=="rgb"){ +return self.fromRGBString(_302); }else{ -return MochiKit.Base.map(self.getElement,arguments); +if(_304=="hsl"){ +return self.fromHSLString(_302); +}else{ +if(_302.charAt(0)=="#"){ +return self.fromHexString(_302); } -},getElementsByTagAndClassName:function(_343,_344,_345){ -var self=MochiKit.DOM; -if(typeof (_343)=="undefined"||_343===null){ -_343="*"; } -if(typeof (_345)=="undefined"||_345===null){ -_345=self._document; } -_345=self.getElement(_345); -var _347=(_345.getElementsByTagName(_343)||self._document.all); -if(typeof (_344)=="undefined"||_344===null){ -return MochiKit.Base.extend(null,_347); +return self.fromName(_302); +},fromHexString:function(_305){ +if(_305.charAt(0)=="#"){ +_305=_305.substring(1); } -var _348=[]; -for(var i=0;i<_347.length;i++){ -var _34a=_347[i]; -var cls=_34a.className; -if(!cls){ -continue; +var _306=[]; +var i,hex; +if(_305.length==3){ +for(i=0;i<3;i++){ +hex=_305.substr(i,1); +_306.push(parseInt(hex+hex,16)/255); } -var _34c=cls.split(" "); -for(var j=0;j<_34c.length;j++){ -if(_34c[j]==_344){ -_348.push(_34a); -break; +}else{ +for(i=0;i<6;i+=2){ +hex=_305.substr(i,2); +_306.push(parseInt(hex,16)/255); } } +var _309=MochiKit.Color.Color; +return _309.fromRGB.apply(_309,_306); +},_fromColorString:function(pre,_30b,_30c,_30d){ +if(_30d.indexOf(pre)===0){ +_30d=_30d.substring(_30d.indexOf("(",3)+1,_30d.length-1); } -return _348; -},_newCallStack:function(path,once){ -var rval=function(){ -var _351=arguments.callee.callStack; -for(var i=0;i<_351.length;i++){ -if(_351[i].apply(this,arguments)===false){ -break; +var _30e=_30d.split(/\s*,\s*/); +var _30f=[]; +for(var i=0;i<_30e.length;i++){ +var c=_30e[i]; +var val; +var _313=c.substring(c.length-3); +if(c.charAt(c.length-1)=="%"){ +val=0.01*parseFloat(c.substring(0,c.length-1)); +}else{ +if(_313=="deg"){ +val=parseFloat(c)/360; +}else{ +if(_313=="rad"){ +val=parseFloat(c)/(Math.PI*2); +}else{ +val=_30c[i]*parseFloat(c); } } -if(once){ -try{ -this[path]=null; } -catch(e){ +_30f.push(val); } +return this[_30b].apply(this,_30f); +},fromComputedStyle:function(elem,_315){ +var d=MochiKit.DOM; +var cls=MochiKit.Color.Color; +for(elem=d.getElement(elem);elem;elem=elem.parentNode){ +var _318=MochiKit.Style.getStyle.apply(d,arguments); +if(!_318){ +continue; } -}; -rval.callStack=[]; -return rval; -},addToCallStack:function(_353,path,func,once){ -var self=MochiKit.DOM; -var _358=_353[path]; -var _359=_358; -if(!(typeof (_358)=="function"&&typeof (_358.callStack)=="object"&&_358.callStack!==null)){ -_359=self._newCallStack(path,once); -if(typeof (_358)=="function"){ -_359.callStack.push(_358); +var _319=cls.fromString(_318); +if(!_319){ +break; } -_353[path]=_359; +if(_319.asRGB().a>0){ +return _319; } -_359.callStack.push(func); -},addLoadEvent:function(func){ -var self=MochiKit.DOM; -self.addToCallStack(self._window,"onload",func,true); -},focusOnLoad:function(_35c){ -var self=MochiKit.DOM; -self.addLoadEvent(function(){ -_35c=self.getElement(_35c); -if(_35c){ -_35c.focus(); } -}); -},setElementClass:function(_35e,_35f){ -var self=MochiKit.DOM; -var obj=self.getElement(_35e); -if(self.attributeArray.compliant){ -obj.setAttribute("class",_35f); +return null; +},fromBackground:function(elem){ +var cls=MochiKit.Color.Color; +return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor(); +},fromText:function(elem){ +var cls=MochiKit.Color.Color; +return cls.fromComputedStyle(elem,"color","color")||cls.blackColor(); +},namedColors:function(){ +return MochiKit.Base.clone(MochiKit.Color.Color._namedColors); +}}); +MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_31f){ +v*=_31f; +if(v<0){ +return 0; }else{ -obj.setAttribute("className",_35f); -} -},toggleElementClass:function(_362){ -var self=MochiKit.DOM; -for(var i=1;i_31f){ +return _31f; +}else{ +return v; } -self.setElementClass(obj,cls+" "+_367); -return true; -},removeElementClass:function(_36d,_36e){ -var self=MochiKit.DOM; -var obj=self.getElement(_36d); -var cls=obj.className; -if(cls==undefined||cls.length===0){ -return false; } -if(cls==_36e){ -self.setElementClass(obj,""); -return true; +},_hslValue:function(n1,n2,hue){ +if(hue>6){ +hue-=6; +}else{ +if(hue<0){ +hue+=6; } -var _372=cls.split(" "); -for(var i=0;i<_372.length;i++){ -if(_372[i]==_36e){ -_372.splice(i,1); -self.setElementClass(obj,_372.join(" ")); -return true; } +var val; +if(hue<1){ +val=n1+(n2-n1)*hue; +}else{ +if(hue<3){ +val=n2; +}else{ +if(hue<4){ +val=n1+(n2-n1)*(4-hue); +}else{ +val=n1; } -return false; -},swapElementClass:function(_374,_375,_376){ -var obj=MochiKit.DOM.getElement(_374); -var res=MochiKit.DOM.removeElementClass(obj,_375); -if(res){ -MochiKit.DOM.addElementClass(obj,_376); } -return res; -},hasElementClass:function(_379,_37a){ -var obj=MochiKit.DOM.getElement(_379); -var cls=obj.className; -if(!cls){ -return false; } -var _37d=cls.split(" "); -for(var i=1;i/g,">"); -},toHTML:function(dom){ -return MochiKit.DOM.emitHTML(dom).join(""); -},emitHTML:function(dom,lst){ -if(typeof (lst)=="undefined"||lst===null){ -lst=[]; -} -var _385=[dom]; -var self=MochiKit.DOM; -var _387=self.escapeHTML; -var _388=self.attributeArray; -while(_385.length){ -dom=_385.pop(); -if(typeof (dom)=="string"){ -lst.push(dom); +var red; +var _32a; +var blue; +if(_325===0){ +red=_326; +_32a=_326; +blue=_326; }else{ -if(dom.nodeType==1){ -lst.push("<"+dom.tagName.toLowerCase()); -var _389=[]; -var _38a=_388(dom); -for(var i=0;i<_38a.length;i++){ -var a=_38a[i]; -_389.push([" ",a.name,"=\"",_387(a.value),"\""]); -} -_389.sort(); -for(i=0;i<_389.length;i++){ -var _38d=_389[i]; -for(var j=0;j<_38d.length;j++){ -lst.push(_38d[j]); +var i=Math.floor(hue*6); +var f=(hue*6)-i; +var p=_326*(1-_325); +var q=_326*(1-(_325*f)); +var t=_326*(1-(_325*(1-f))); +switch(i){ +case 1: +red=q; +_32a=_326; +blue=p; +break; +case 2: +red=p; +_32a=_326; +blue=t; +break; +case 3: +red=p; +_32a=q; +blue=_326; +break; +case 4: +red=t; +_32a=p; +blue=_326; +break; +case 5: +red=_326; +_32a=p; +blue=q; +break; +case 6: +case 0: +red=_326; +_32a=t; +blue=p; +break; } } -if(dom.hasChildNodes()){ -lst.push(">"); -_385.push(""); -var _38f=dom.childNodes; -for(i=_38f.length-1;i>=0;i--){ -_385.push(_38f[i]); +return {r:red,g:_32a,b:blue,a:_327}; +},hslToRGB:function(hue,_332,_333,_334){ +if(arguments.length==1){ +var hsl=hue; +hue=hsl.h; +_332=hsl.s; +_333=hsl.l; +_334=hsl.a; } +var red; +var _337; +var blue; +if(_332===0){ +red=_333; +_337=_333; +blue=_333; }else{ -lst.push("/>"); -} +var m2; +if(_333<=0.5){ +m2=_333*(1+_332); }else{ -if(dom.nodeType==3){ -lst.push(_387(dom.nodeValue)); -} -} -} -} -return lst; -},scrapeText:function(node,_391){ -var rval=[]; -(function(node){ -var cn=node.childNodes; -if(cn){ -for(var i=0;i1){ +hue-=1; } } +return {h:hue,s:_345,v:_346,a:_340}; +},rgbToHSL:function(red,_349,blue,_34b){ +if(arguments.length==1){ +var rgb=red; +red=rgb.r; +_349=rgb.g; +blue=rgb.b; +_34b=rgb.a; } -},getFirstParentByTagAndClassName:function(elem,_3ab,_3ac){ -var self=MochiKit.DOM; -elem=self.getElement(elem); -if(typeof (_3ab)=="undefined"||_3ab===null){ -_3ab="*"; +var max=Math.max(red,Math.max(_349,blue)); +var min=Math.min(red,Math.min(_349,blue)); +var hue; +var _350; +var _351=(max+min)/2; +var _352=max-min; +if(_352===0){ +hue=0; +_350=0; }else{ -_3ab=_3ab.toUpperCase(); -} -if(typeof (_3ac)=="undefined"||_3ac===null){ -_3ac=null; -} -var _3ae=""; -var _3af=""; -while(elem&&elem.tagName){ -elem=elem.parentNode; -if(_3ab=="*"&&_3ac===null){ -return elem; +if(_351<=0.5){ +_350=_352/(max+min); +}else{ +_350=_352/(2-max-min); } -_3ae=elem.className.split(" "); -_3af=elem.tagName.toUpperCase(); -if(_3ac===null&&_3ab==_3af){ -return elem; +if(red==max){ +hue=(_349-blue)/_352; }else{ -if(_3ac!==null){ -for(var i=0;i<_3ae.length;i++){ -if(_3ab=="*"&&_3ae[i]==_3ac){ -return elem; +if(_349==max){ +hue=2+((blue-red)/_352); }else{ -if(_3ab==_3af&&_3ae[i]==_3ac){ -return elem; -} -} +hue=4+((red-_349)/_352); } } +hue/=6; +if(hue<0){ +hue+=1; } +if(hue>1){ +hue-=1; } -return elem; -},isParent:function(_3b1,_3b2){ -if(!_3b1.parentNode||_3b1==_3b2){ -return false; } -if(_3b1.parentNode==_3b2){ -return true; +return {h:hue,s:_350,l:_351,a:_34b}; +},toColorPart:function(num){ +num=Math.round(num); +var _354=num.toString(16); +if(num<16){ +return "0"+_354; } -return MochiKit.DOM.isParent(_3b1.parentNode,_3b2); -},__new__:function(win){ +return _354; +},__new__:function(){ var m=MochiKit.Base; -if(typeof (document)!="undefined"){ -this._document=document; -var _3b5="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; -this._xhtml=(document.documentElement&&document.createElementNS&&document.documentElement.namespaceURI===_3b5); -}else{ -if(MochiKit.MockDOM){ -this._document=MochiKit.MockDOM.document; +this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]); +this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]); +var _356=1/3; +var _357={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_356,_356,_356],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_356,2*_356,2*_356],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]}; +var _358=function(name,r,g,b,a){ +var rval=this.fromRGB(r,g,b,a); +this[name]=function(){ +return rval; +}; +return rval; +}; +for(var k in _357){ +var name=k+"Color"; +var _361=m.concat([_358,this.Color,name],_357[k]); +this.Color[name]=m.bind.apply(null,_361); } +var _362=function(){ +for(var i=0;i0){ -var _3b8=m.filter; -_3b7=function(node){ -return _3b8(_3b7.ignoreAttrFilter,node.attributes); -}; -_3b7.ignoreAttr={}; -var _3ba=_3b6.attributes; -var _3bb=_3b7.ignoreAttr; -for(var i=0;i<_3ba.length;i++){ -var a=_3ba[i]; -_3bb[a.name]=a.value; -} -_3b7.ignoreAttrFilter=function(a){ -return (_3b7.ignoreAttr[a.name]!=a.value); -}; -_3b7.compliant=false; -_3b7.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"}; -}else{ -_3b7=function(node){ -return node.attributes; -}; -_3b7.compliant=true; -_3b7.renames={}; } -this.attributeArray=_3b7; -var _3c0=function(_3c1,arr){ -var _3c3=arr[1].split("."); -var str=""; -var obj={}; -str+="if (!MochiKit."+_3c3[1]+") { throw new Error(\""; -str+="This function has been deprecated and depends on MochiKit."; -str+=_3c3[1]+".\");}"; -str+="return MochiKit."+_3c3[1]+"."+arr[0]; -str+=".apply(this, arguments);"; -obj[_3c3[2]]=new Function(str); -MochiKit.Base.update(MochiKit[_3c1],obj); +return true; +}; +var _364=function(a,b){ +return a.compareRGB(b); }; -for(var i;i0){ -abort(repr(expr)); +try{ +if(typeof (MochiKit.DOM)=="undefined"){ +throw ""; } -},buildMatchExpression:function(){ -var repr=MochiKit.Base.repr; -var _3d1=this.params; -var _3d2=[]; -var _3d3,i; -function childElements(_3d5){ -return "MochiKit.Base.filter(function (node) { return node.nodeType == 1; }, "+_3d5+".childNodes)"; -} -if(_3d1.wildcard){ -_3d2.push("true"); -} -if(_3d3=_3d1.id){ -_3d2.push("element.id == "+repr(_3d3)); -} -if(_3d3=_3d1.tagName){ -_3d2.push("element.tagName.toUpperCase() == "+repr(_3d3)); -} -if((_3d3=_3d1.classNames).length>0){ -for(i=0;i<_3d3.length;i++){ -_3d2.push("MochiKit.DOM.hasElementClass(element, "+repr(_3d3[i])+")"); -} -} -if((_3d3=_3d1.pseudoClassNames).length>0){ -for(i=0;i<_3d3.length;i++){ -var _3d6=_3d3[i].match(/^([^(]+)(?:\((.*)\))?$/); -var _3d7=_3d6[1]; -var _3d8=_3d6[2]; -switch(_3d7){ -case "root": -_3d2.push("element.nodeType == 9 || element === element.ownerDocument.documentElement"); -break; -case "nth-child": -case "nth-last-child": -case "nth-of-type": -case "nth-last-of-type": -_3d6=_3d8.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/); -if(!_3d6){ -throw "Invalid argument to pseudo element nth-child: "+_3d8; } -var a,b; -if(_3d6[0]=="odd"){ -a=2; -b=1; -}else{ -if(_3d6[0]=="even"){ -a=2; -b=0; -}else{ -a=_3d6[2]&&parseInt(_3d6)||null; -b=parseInt(_3d6[3]); +catch(e){ +throw "MochiKit.Signal depends on MochiKit.DOM!"; } +try{ +if(typeof (MochiKit.Style)=="undefined"){ +throw ""; } -_3d2.push("this.nthChild(element,"+a+","+b+","+!!_3d7.match("^nth-last")+","+!!_3d7.match("of-type$")+")"); -break; -case "first-child": -_3d2.push("this.nthChild(element, null, 1)"); -break; -case "last-child": -_3d2.push("this.nthChild(element, null, 1, true)"); -break; -case "first-of-type": -_3d2.push("this.nthChild(element, null, 1, false, true)"); -break; -case "last-of-type": -_3d2.push("this.nthChild(element, null, 1, true, true)"); -break; -case "only-child": -_3d2.push(childElements("element.parentNode")+".length == 1"); -break; -case "only-of-type": -_3d2.push("MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, "+childElements("element.parentNode")+").length == 1"); -break; -case "empty": -_3d2.push("element.childNodes.length == 0"); -break; -case "enabled": -_3d2.push("(this.isUIElement(element) && element.disabled === false)"); -break; -case "disabled": -_3d2.push("(this.isUIElement(element) && element.disabled === true)"); -break; -case "checked": -_3d2.push("(this.isUIElement(element) && element.checked === true)"); -break; -case "not": -var _3db=new MochiKit.Selector.Selector(_3d8); -_3d2.push("!( "+_3db.buildMatchExpression()+")"); -break; } +catch(e){ +throw "MochiKit.Signal depends on MochiKit.Style!"; } +if(typeof (MochiKit.Signal)=="undefined"){ +MochiKit.Signal={}; } -if(_3d3=_3d1.attributes){ -MochiKit.Base.map(function(_3dc){ -var _3dd="MochiKit.DOM.getNodeAttribute(element, "+repr(_3dc.name)+")"; -var _3de=function(_3df){ -return _3dd+".split("+repr(_3df)+")"; +MochiKit.Signal.NAME="MochiKit.Signal"; +MochiKit.Signal.VERSION="1.4"; +MochiKit.Signal._observers=[]; +MochiKit.Signal.Event=function(src,e){ +this._event=e||window.event; +this._src=src; }; -switch(_3dc.operator){ -case "=": -_3d2.push(_3dd+" == "+repr(_3dc.value)); -break; -case "~=": -_3d2.push(_3dd+" && MochiKit.Base.findValue("+_3de(" ")+", "+repr(_3dc.value)+") > -1"); -break; -case "^=": -_3d2.push(_3dd+".substring(0, "+_3dc.value.length+") == "+repr(_3dc.value)); -break; -case "$=": -_3d2.push(_3dd+".substring("+_3dd+".length - "+_3dc.value.length+") == "+repr(_3dc.value)); -break; -case "*=": -_3d2.push(_3dd+".match("+repr(_3dc.value)+")"); -break; -case "|=": -_3d2.push(_3dd+" && "+_3de("-")+"[0].toUpperCase() == "+repr(_3dc.value.toUpperCase())); -break; -case "!=": -_3d2.push(_3dd+" != "+repr(_3dc.value)); -break; -case "": -case undefined: -_3d2.push(_3dd+" != null"); -break; -default: -throw "Unknown operator "+_3dc.operator+" in selector"; -} -},_3d3); -} -return _3d2.join(" && "); -},compileMatcher:function(){ -this.match=new Function("element","if (!element.tagName) return false; return "+this.buildMatchExpression()); -},nthChild:function(_3e0,a,b,_3e3,_3e4){ -var _3e5=MochiKit.Base.filter(function(node){ -return node.nodeType==1; -},_3e0.parentNode.childNodes); -if(_3e4){ -_3e5=MochiKit.Base.filter(function(node){ -return node.tagName==_3e0.tagName; -},_3e5); -} -if(_3e3){ -_3e5=MochiKit.Iter.reversed(_3e5); -} -if(a){ -var _3e8=MochiKit.Base.findIdentical(_3e5,_3e0); -return ((_3e8+1-b)/a)%1==0; -}else{ -return b==MochiKit.Base.findIdentical(_3e5,_3e0)+1; -} -},isUIElement:function(_3e9){ -return MochiKit.Base.findValue(["input","button","select","option","textarea","object"],_3e9.tagName.toLowerCase())>-1; -},findElements:function(_3ea,axis){ -var _3ec; -if(axis==undefined){ -axis=""; -} -function inScope(_3ed,_3ee){ -if(axis==""){ -return MochiKit.DOM.isChildNode(_3ed,_3ee); -}else{ -if(axis==">"){ -return _3ed.parentNode==_3ee; -}else{ -if(axis=="+"){ -return _3ed==nextSiblingElement(_3ee); -}else{ -if(axis=="~"){ -var _3ef=_3ee; -while(_3ef=nextSiblingElement(_3ef)){ -if(_3ed==_3ef){ -return true; +MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){ +var repr=MochiKit.Base.repr; +var str="{event(): "+repr(this.event())+", src(): "+repr(this.src())+", type(): "+repr(this.type())+", target(): "+repr(this.target()); +if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){ +str+=", modifier(): "+"{alt: "+repr(this.modifier().alt)+", ctrl: "+repr(this.modifier().ctrl)+", meta: "+repr(this.modifier().meta)+", shift: "+repr(this.modifier().shift)+", any: "+repr(this.modifier().any)+"}"; } +if(this.type()&&this.type().indexOf("key")===0){ +str+=", key(): {code: "+repr(this.key().code)+", string: "+repr(this.key().string)+"}"; } -return false; +if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ +str+=", mouse(): {page: "+repr(this.mouse().page)+", client: "+repr(this.mouse().client); +if(this.type()!="mousemove"){ +str+=", button: {left: "+repr(this.mouse().button.left)+", middle: "+repr(this.mouse().button.middle)+", right: "+repr(this.mouse().button.right)+"}}"; }else{ -throw "Invalid axis: "+axis; -} +str+="}"; } } +if(this.type()=="mouseover"||this.type()=="mouseout"){ +str+=", relatedTarget(): "+repr(this.relatedTarget()); } +str+="}"; +return str; +},toString:function(){ +return this.__repr__(); +},src:function(){ +return this._src; +},event:function(){ +return this._event; +},type:function(){ +return this._event.type||undefined; +},target:function(){ +return this._event.target||this._event.srcElement; +},_relatedTarget:null,relatedTarget:function(){ +if(this._relatedTarget!==null){ +return this._relatedTarget; } -if(_3ec=MochiKit.DOM.getElement(this.params.id)){ -if(this.match(_3ec)){ -if(!_3ea||inScope(_3ec,_3ea)){ -return [_3ec]; +var elem=null; +if(this.type()=="mouseover"){ +elem=(this._event.relatedTarget||this._event.fromElement); +}else{ +if(this.type()=="mouseout"){ +elem=(this._event.relatedTarget||this._event.toElement); } } +if(elem!==null){ +this._relatedTarget=elem; +return elem; } -function nextSiblingElement(node){ -node=node.nextSibling; -while(node&&node.nodeType!=1){ -node=node.nextSibling; +return undefined; +},_modifier:null,modifier:function(){ +if(this._modifier!==null){ +return this._modifier; } -return node; +var m={}; +m.alt=this._event.altKey; +m.ctrl=this._event.ctrlKey; +m.meta=this._event.metaKey||false; +m.shift=this._event.shiftKey; +m.any=m.alt||m.ctrl||m.shift||m.meta; +this._modifier=m; +return m; +},_key:null,key:function(){ +if(this._key!==null){ +return this._key; } -if(axis==""){ -_3ea=(_3ea||MochiKit.DOM.currentDocument()).getElementsByTagName(this.params.tagName||"*"); +var k={}; +if(this.type()&&this.type().indexOf("key")===0){ +if(this.type()=="keydown"||this.type()=="keyup"){ +k.code=this._event.keyCode; +k.string=(MochiKit.Signal._specialKeys[k.code]||"KEY_UNKNOWN"); +this._key=k; +return k; }else{ -if(axis==">"){ -if(!_3ea){ -throw "> combinator not allowed without preceeding expression"; -} -_3ea=MochiKit.Base.filter(function(node){ -return node.nodeType==1; -},_3ea.childNodes); +if(this.type()=="keypress"){ +k.code=0; +k.string=""; +if(typeof (this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){ +k.code=this._event.charCode; +k.string=String.fromCharCode(k.code); }else{ -if(axis=="+"){ -if(!_3ea){ -throw "+ combinator not allowed without preceeding expression"; +if(this._event.keyCode&&typeof (this._event.charCode)=="undefined"){ +k.code=this._event.keyCode; +k.string=String.fromCharCode(k.code); } -_3ea=nextSiblingElement(_3ea)&&[nextSiblingElement(_3ea)]; -}else{ -if(axis=="~"){ -if(!_3ea){ -throw "~ combinator not allowed without preceeding expression"; } -var _3f2=[]; -while(nextSiblingElement(_3ea)){ -_3ea=nextSiblingElement(_3ea); -_3f2.push(_3ea); +this._key=k; +return k; } -_3ea=_3f2; } } +return undefined; +},_mouse:null,mouse:function(){ +if(this._mouse!==null){ +return this._mouse; } +var m={}; +var e=this._event; +if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ +m.client=new MochiKit.Style.Coordinates(0,0); +if(e.clientX||e.clientY){ +m.client.x=(!e.clientX||e.clientX<0)?0:e.clientX; +m.client.y=(!e.clientY||e.clientY<0)?0:e.clientY; } -if(!_3ea){ -return []; +m.page=new MochiKit.Style.Coordinates(0,0); +if(e.pageX||e.pageY){ +m.page.x=(!e.pageX||e.pageX<0)?0:e.pageX; +m.page.y=(!e.pageY||e.pageY<0)?0:e.pageY; +}else{ +var de=MochiKit.DOM._document.documentElement; +var b=MochiKit.DOM._document.body; +m.page.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); +m.page.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0); } -var _3f3=MochiKit.Base.filter(MochiKit.Base.bind(function(_3f4){ -return this.match(_3f4); -},this),_3ea); -return _3f3; -},repr:function(){ -return "Selector("+this.expression+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Base.update(MochiKit.Selector,{findChildElements:function(_3f5,_3f6){ -return MochiKit.Base.flattenArray(MochiKit.Base.map(function(_3f7){ -var _3f8=""; -return MochiKit.Iter.reduce(function(_3f9,expr){ -if(match=expr.match(/^[>+~]$/)){ -_3f8=match[0]; -return _3f9; -}else{ -var _3fb=new MochiKit.Selector.Selector(expr); -var _3fc=MochiKit.Iter.reduce(function(_3fd,_3fe){ -return MochiKit.Base.extend(_3fd,_3fb.findElements(_3fe||_3f5,_3f8)); -},_3f9,[]); -_3f8=""; -return _3fc; -} -},_3f7.replace(/(^\s+|\s+$)/g,"").split(/\s+/),[null]); -},_3f6)); -},findDocElements:function(){ -return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(),arguments); -},__new__:function(){ -var m=MochiKit.Base; -this.$$=this.findDocElements; -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}}); -MochiKit.Selector.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Selector); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Style"); -dojo.require("MochiKit.Base"); -dojo.require("MochiKit.DOM"); +if(this.type()!="mousemove"){ +m.button={}; +m.button.left=false; +m.button.right=false; +m.button.middle=false; +if(e.which){ +m.button.left=(e.which==1); +m.button.middle=(e.which==2); +m.button.right=(e.which==3); +}else{ +m.button.left=!!(e.button&1); +m.button.right=!!(e.button&2); +m.button.middle=!!(e.button&4); } -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -JSAN.use("MochiKit.DOM",[]); } -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; +this._mouse=m; +return m; } +return undefined; +},stop:function(){ +this.stopPropagation(); +this.preventDefault(); +},stopPropagation:function(){ +if(this._event.stopPropagation){ +this._event.stopPropagation(); +}else{ +this._event.cancelBubble=true; } -catch(e){ -throw "MochiKit.Style depends on MochiKit.Base!"; +},preventDefault:function(){ +if(this._event.preventDefault){ +this._event.preventDefault(); +}else{ +if(this._confirmUnload===null){ +this._event.returnValue=false; } -try{ -if(typeof (MochiKit.DOM)=="undefined"){ -throw ""; } +},_confirmUnload:null,confirmUnload:function(msg){ +if(this.type()=="beforeunload"){ +this._confirmUnload=msg; +this._event.returnValue=msg; } -catch(e){ -throw "MochiKit.Style depends on MochiKit.DOM!"; +}}); +MochiKit.Signal._specialMacKeys={3:"KEY_ENTER",63289:"KEY_NUM_PAD_CLEAR",63276:"KEY_PAGE_UP",63277:"KEY_PAGE_DOWN",63275:"KEY_END",63273:"KEY_HOME",63234:"KEY_ARROW_LEFT",63232:"KEY_ARROW_UP",63235:"KEY_ARROW_RIGHT",63233:"KEY_ARROW_DOWN",63302:"KEY_INSERT",63272:"KEY_DELETE"}; +(function(){ +var _373=MochiKit.Signal._specialMacKeys; +for(i=63236;i<=63242;i++){ +_373[i]="KEY_F"+(i-63236+1); } -if(typeof (MochiKit.Style)=="undefined"){ -MochiKit.Style={}; +})(); +MochiKit.Signal._specialKeys={8:"KEY_BACKSPACE",9:"KEY_TAB",12:"KEY_NUM_PAD_CLEAR",13:"KEY_ENTER",16:"KEY_SHIFT",17:"KEY_CTRL",18:"KEY_ALT",19:"KEY_PAUSE",20:"KEY_CAPS_LOCK",27:"KEY_ESCAPE",32:"KEY_SPACEBAR",33:"KEY_PAGE_UP",34:"KEY_PAGE_DOWN",35:"KEY_END",36:"KEY_HOME",37:"KEY_ARROW_LEFT",38:"KEY_ARROW_UP",39:"KEY_ARROW_RIGHT",40:"KEY_ARROW_DOWN",44:"KEY_PRINT_SCREEN",45:"KEY_INSERT",46:"KEY_DELETE",59:"KEY_SEMICOLON",91:"KEY_WINDOWS_LEFT",92:"KEY_WINDOWS_RIGHT",93:"KEY_SELECT",106:"KEY_NUM_PAD_ASTERISK",107:"KEY_NUM_PAD_PLUS_SIGN",109:"KEY_NUM_PAD_HYPHEN-MINUS",110:"KEY_NUM_PAD_FULL_STOP",111:"KEY_NUM_PAD_SOLIDUS",144:"KEY_NUM_LOCK",145:"KEY_SCROLL_LOCK",186:"KEY_SEMICOLON",187:"KEY_EQUALS_SIGN",188:"KEY_COMMA",189:"KEY_HYPHEN-MINUS",190:"KEY_FULL_STOP",191:"KEY_SOLIDUS",192:"KEY_GRAVE_ACCENT",219:"KEY_LEFT_SQUARE_BRACKET",220:"KEY_REVERSE_SOLIDUS",221:"KEY_RIGHT_SQUARE_BRACKET",222:"KEY_APOSTROPHE"}; +(function(){ +var _374=MochiKit.Signal._specialKeys; +for(var i=48;i<=57;i++){ +_374[i]="KEY_"+(i-48); } -MochiKit.Style.NAME="MochiKit.Style"; -MochiKit.Style.VERSION="1.4"; -MochiKit.Style.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Style.toString=function(){ -return this.__repr__(); -}; -MochiKit.Style.EXPORT_OK=[]; -MochiKit.Style.EXPORT=["setStyle","setOpacity","getStyle","getElementDimensions","elementDimensions","setElementDimensions","getElementPosition","elementPosition","setElementPosition","setDisplayForElement","hideElement","showElement","getViewportDimensions","getViewportPosition","Dimensions","Coordinates"]; -MochiKit.Style.Dimensions=function(w,h){ -this.w=w; -this.h=h; -}; -MochiKit.Style.Dimensions.prototype.__repr__=function(){ -var repr=MochiKit.Base.repr; -return "{w: "+repr(this.w)+", h: "+repr(this.h)+"}"; -}; -MochiKit.Style.Dimensions.prototype.toString=function(){ -return this.__repr__(); -}; -MochiKit.Style.Coordinates=function(x,y){ -this.x=x; -this.y=y; -}; -MochiKit.Style.Coordinates.prototype.__repr__=function(){ -var repr=MochiKit.Base.repr; -return "{x: "+repr(this.x)+", y: "+repr(this.y)+"}"; +for(i=65;i<=90;i++){ +_374[i]="KEY_"+String.fromCharCode(i); +} +for(i=96;i<=105;i++){ +_374[i]="KEY_NUM_PAD_"+(i-96); +} +for(i=112;i<=123;i++){ +_374[i]="KEY_F"+(i-112+1); +} +})(); +MochiKit.Signal.Ident=function(_376){ +this.source=_376.source; +this.signal=_376.signal; +this.listener=_376.listener; +this.isDOM=_376.isDOM; +this.objOrFunc=_376.objOrFunc; +this.funcOrStr=_376.funcOrStr; +this.connected=_376.connected; }; -MochiKit.Style.Coordinates.prototype.toString=function(){ +MochiKit.Signal.Ident.prototype={}; +MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){ +return "["+this.NAME+" "+this.VERSION+"]"; +},toString:function(){ return this.__repr__(); -}; -MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_407){ -var dom=MochiKit.DOM; -var d=dom._document; -elem=dom.getElement(elem); -_407=MochiKit.Base.camelize(_407); -if(!elem||elem==d){ -return undefined; +},_unloadCache:function(){ +var self=MochiKit.Signal; +var _378=self._observers; +for(var i=0;i<_378.length;i++){ +if(_378[i].signal!=="onload"&&_378[i].signal!=="onunload"){ +self._disconnect(_378[i]); } -if(_407=="opacity"&&elem.filters){ -var _40a=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/); -if(_40a&&_40a[1]){ -return parseFloat(_40a[1])/100; } -return 1; +},_listener:function(src,sig,func,obj,_37e){ +var self=MochiKit.Signal; +var E=self.Event; +if(!_37e){ +return MochiKit.Base.bind(func,obj); } -var _40b=elem.style?elem.style[_407]:null; -if(!_40b){ -if(d.defaultView&&d.defaultView.getComputedStyle){ -var css=d.defaultView.getComputedStyle(elem,null); -_407=_407.replace(/([A-Z])/g,"-$1").toLowerCase(); -_40b=css?css.getPropertyValue(_407):null; +obj=obj||src; +if(typeof (func)=="string"){ +if(sig==="onload"||sig==="onunload"){ +return function(_381){ +obj[func].apply(obj,[new E(src,_381)]); +var _382=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:obj,funcOrStr:func}); +MochiKit.Signal._disconnect(_382); +}; }else{ -if(elem.currentStyle){ -_40b=elem.currentStyle[_407]; +return function(_383){ +obj[func].apply(obj,[new E(src,_383)]); +}; } +}else{ +if(sig==="onload"||sig==="onunload"){ +return function(_384){ +func.apply(obj,[new E(src,_384)]); +MochiKit.Signal.disconnect(src,sig,func); +var _385=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:func}); +MochiKit.Signal._disconnect(_385); +}; +}else{ +return function(_386){ +func.apply(obj,[new E(src,_386)]); +}; } } -if(_407=="opacity"){ -_40b=parseFloat(_40b); +},_browserAlreadyHasMouseEnterAndLeave:function(){ +return /MSIE/.test(navigator.userAgent); +},_mouseEnterListener:function(src,sig,func,obj){ +var E=MochiKit.Signal.Event; +return function(_38c){ +var e=new E(src,_38c); +try{ +e.relatedTarget().nodeName; } -if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_407)!=-1)){ -if(MochiKit.Style.getStyle(elem,"position")=="static"){ -_40b="auto"; +catch(err){ +return; } +e.stop(); +if(MochiKit.DOM.isChildNode(e.relatedTarget(),src)){ +return; } -return _40b=="auto"?null:_40b; -},setStyle:function(elem,_40e){ -elem=MochiKit.DOM.getElement(elem); -for(var name in _40e){ -if(name=="opacity"){ -MochiKit.Style.setOpacity(elem,_40e[name]); +e.type=function(){ +return sig; +}; +if(typeof (func)=="string"){ +return obj[func].apply(obj,[e]); }else{ -elem.style[MochiKit.Base.camelize(name)]=_40e[name]; -} +return func.apply(obj,[e]); } -},setOpacity:function(elem,o){ -elem=MochiKit.DOM.getElement(elem); -var self=MochiKit.Style; -if(o==1){ -var _413=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)); -elem.style["opacity"]=_413?0.999999:1; -if(/MSIE/.test(navigator.userAgent)){ -elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,""); +}; +},_getDestPair:function(_38e,_38f){ +var obj=null; +var func=null; +if(typeof (_38f)!="undefined"){ +obj=_38e; +func=_38f; +if(typeof (_38f)=="string"){ +if(typeof (_38e[_38f])!="function"){ +throw new Error("'funcOrStr' must be a function on 'objOrFunc'"); } }else{ -if(o<0.00001){ -o=0; +if(typeof (_38f)!="function"){ +throw new Error("'funcOrStr' must be a function or string"); } -elem.style["opacity"]=o; -if(/MSIE/.test(navigator.userAgent)){ -elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")"; } +}else{ +if(typeof (_38e)!="function"){ +throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given"); +}else{ +func=_38e; } -},getElementPosition:function(elem,_415){ -var self=MochiKit.Style; -var dom=MochiKit.DOM; -elem=dom.getElement(elem); -if(!elem||(!(elem.x&&elem.y)&&(!elem.parentNode===null||self.getStyle(elem,"display")=="none"))){ -return undefined; } -var c=new self.Coordinates(0,0); -var box=null; -var _41a=null; -var d=MochiKit.DOM._document; -var de=d.documentElement; -var b=d.body; -if(!elem.parentNode&&elem.x&&elem.y){ -c.x+=elem.x||0; -c.y+=elem.y||0; +return [obj,func]; +},connect:function(src,sig,_394,_395){ +src=MochiKit.DOM.getElement(src); +var self=MochiKit.Signal; +if(typeof (sig)!="string"){ +throw new Error("'sig' must be a string"); +} +var _397=self._getDestPair(_394,_395); +var obj=_397[0]; +var func=_397[1]; +if(typeof (obj)=="undefined"||obj===null){ +obj=src; +} +var _39a=!!(src.addEventListener||src.attachEvent); +if(_39a&&(sig==="onmouseenter"||sig==="onmouseleave")&&!self._browserAlreadyHasMouseEnterAndLeave()){ +var _39b=self._mouseEnterListener(src,sig.substr(2),func,obj); +if(sig==="onmouseenter"){ +sig="onmouseover"; }else{ -if(elem.getBoundingClientRect){ -box=elem.getBoundingClientRect(); -c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); -c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0); +sig="onmouseout"; +} }else{ -if(elem.offsetParent){ -c.x+=elem.offsetLeft; -c.y+=elem.offsetTop; -_41a=elem.offsetParent; -if(_41a!=elem){ -while(_41a){ -c.x+=_41a.offsetLeft; -c.y+=_41a.offsetTop; -_41a=_41a.offsetParent; +var _39b=self._listener(src,sig,func,obj,_39a); } +if(src.addEventListener){ +src.addEventListener(sig.substr(2),_39b,false); +}else{ +if(src.attachEvent){ +src.attachEvent(sig,_39b); } -var ua=navigator.userAgent.toLowerCase(); -if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("AppleWebKit")!=-1&&self.getStyle(elem,"position")=="absolute")){ -c.x-=b.offsetLeft; -c.y-=b.offsetTop; } +var _39c=new MochiKit.Signal.Ident({source:src,signal:sig,listener:_39b,isDOM:_39a,objOrFunc:_394,funcOrStr:_395,connected:true}); +self._observers.push(_39c); +if(!_39a&&typeof (src.__connect__)=="function"){ +var args=MochiKit.Base.extend([_39c],arguments,1); +src.__connect__.apply(src,args); } +return _39c; +},_disconnect:function(_39e){ +if(!_39e.connected){ +return; } +_39e.connected=false; +if(!_39e.isDOM){ +return; } -if(typeof (_415)!="undefined"){ -_415=arguments.callee(_415); -if(_415){ -c.x-=(_415.x||0); -c.y-=(_415.y||0); +var src=_39e.source; +var sig=_39e.signal; +var _3a1=_39e.listener; +if(src.removeEventListener){ +src.removeEventListener(sig.substr(2),_3a1,false); +}else{ +if(src.detachEvent){ +src.detachEvent(sig,_3a1); +}else{ +throw new Error("'src' must be a DOM element"); } } -if(elem.parentNode){ -_41a=elem.parentNode; +},disconnect:function(_3a2){ +var self=MochiKit.Signal; +var _3a4=self._observers; +var m=MochiKit.Base; +if(arguments.length>1){ +var src=MochiKit.DOM.getElement(arguments[0]); +var sig=arguments[1]; +var obj=arguments[2]; +var func=arguments[3]; +for(var i=_3a4.length-1;i>=0;i--){ +var o=_3a4[i]; +if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){ +self._disconnect(o); +if(!self._lock){ +_3a4.splice(i,1); }else{ -_41a=null; +self._dirty=true; } -while(_41a){ -var _41f=_41a.tagName.toUpperCase(); -if(_41f==="BODY"||_41f==="HTML"){ -break; +return true; } -var disp=self.getStyle(_41a,"display"); -if(disp!="inline"&&disp!="table-row"){ -c.x-=_41a.scrollLeft; -c.y-=_41a.scrollTop; } -if(_41a.parentNode){ -_41a=_41a.parentNode; }else{ -_41a=null; +var idx=m.findIdentical(_3a4,_3a2); +if(idx>=0){ +self._disconnect(_3a2); +if(!self._lock){ +_3a4.splice(idx,1); +}else{ +self._dirty=true; } +return true; } -return c; -},setElementPosition:function(elem,_422,_423){ -elem=MochiKit.DOM.getElement(elem); -if(typeof (_423)=="undefined"){ -_423="px"; } -var _424={}; -var _425=MochiKit.Base.isUndefinedOrNull; -if(!_425(_422.x)){ -_424["left"]=_422.x+_423; +return false; +},disconnectAllTo:function(_3ad,_3ae){ +var self=MochiKit.Signal; +var _3b0=self._observers; +var _3b1=self._disconnect; +var _3b2=self._lock; +var _3b3=self._dirty; +if(typeof (_3ae)==="undefined"){ +_3ae=null; } -if(!_425(_422.y)){ -_424["top"]=_422.y+_423; +for(var i=_3b0.length-1;i>=0;i--){ +var _3b5=_3b0[i]; +if(_3b5.objOrFunc===_3ad&&(_3ae===null||_3b5.funcOrStr===_3ae)){ +_3b1(_3b5); +if(_3b2){ +_3b3=true; +}else{ +_3b0.splice(i,1); } -MochiKit.DOM.updateNodeAttributes(elem,{"style":_424}); -},getElementDimensions:function(elem){ -var self=MochiKit.Style; -var dom=MochiKit.DOM; -if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){ -return new self.Dimensions(elem.w||0,elem.h||0); } -elem=dom.getElement(elem); -if(!elem){ -return undefined; } -var disp=self.getStyle(elem,"display"); -if(disp!="none"&&disp!==""&&typeof (disp)!="undefined"){ -return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0); +self._dirty=_3b3; +},disconnectAll:function(src,sig){ +src=MochiKit.DOM.getElement(src); +var m=MochiKit.Base; +var _3b9=m.flattenArguments(m.extend(null,arguments,1)); +var self=MochiKit.Signal; +var _3bb=self._disconnect; +var _3bc=self._observers; +var i,_3be; +var _3bf=self._lock; +var _3c0=self._dirty; +if(_3b9.length===0){ +for(i=_3bc.length-1;i>=0;i--){ +_3be=_3bc[i]; +if(_3be.source===src){ +_3bb(_3be); +if(!_3bf){ +_3bc.splice(i,1); +}else{ +_3c0=true; } -var s=elem.style; -var _42b=s.visibility; -var _42c=s.position; -s.visibility="hidden"; -s.position="absolute"; -s.display=""; -var _42d=elem.offsetWidth; -var _42e=elem.offsetHeight; -s.display="none"; -s.position=_42c; -s.visibility=_42b; -return new self.Dimensions(_42d,_42e); -},setElementDimensions:function(elem,_430,_431){ -elem=MochiKit.DOM.getElement(elem); -if(typeof (_431)=="undefined"){ -_431="px"; } -var _432={}; -var _433=MochiKit.Base.isUndefinedOrNull; -if(!_433(_430.w)){ -_432["width"]=_430.w+_431; } -if(!_433(_430.h)){ -_432["height"]=_430.h+_431; +}else{ +var sigs={}; +for(i=0;i<_3b9.length;i++){ +sigs[_3b9[i]]=true; } -MochiKit.DOM.updateNodeAttributes(elem,{"style":_432}); -},setDisplayForElement:function(_434,_435){ -var _436=MochiKit.Base.extend(null,arguments,1); -var _437=MochiKit.DOM.getElement; -for(var i=0;i<_436.length;i++){ -_435=_437(_436[i]); -if(_435){ -_435.style.display=_434; +for(i=_3bc.length-1;i>=0;i--){ +_3be=_3bc[i]; +if(_3be.source===src&&_3be.signal in sigs){ +_3bb(_3be); +if(!_3bf){ +_3bc.splice(i,1); +}else{ +_3c0=true; } } -},getViewportDimensions:function(){ -var d=new MochiKit.Style.Dimensions(); -var w=MochiKit.DOM._window; -var b=MochiKit.DOM._document.body; -if(w.innerWidth){ -d.w=w.innerWidth; -d.h=w.innerHeight; -}else{ -if(b.parentElement.clientWidth){ -d.w=b.parentElement.clientWidth; -d.h=b.parentElement.clientHeight; -}else{ -if(b&&b.clientWidth){ -d.w=b.clientWidth; -d.h=b.clientHeight; } } +self._dirty=_3c0; +},signal:function(src,sig){ +var self=MochiKit.Signal; +var _3c5=self._observers; +src=MochiKit.DOM.getElement(src); +var args=MochiKit.Base.extend(null,arguments,2); +var _3c7=[]; +self._lock=true; +for(var i=0;i<_3c5.length;i++){ +var _3c9=_3c5[i]; +if(_3c9.source===src&&_3c9.signal===sig){ +try{ +_3c9.listener.apply(src,args); } -return d; -},getViewportPosition:function(){ -var c=new MochiKit.Style.Coordinates(0,0); -var d=MochiKit.DOM._document; -var de=d.documentElement; -var db=d.body; -if(de&&(de.scrollTop||de.scrollLeft)){ -c.x=de.scrollLeft; -c.y=de.scrollTop; +catch(e){ +_3c7.push(e); +} +} +} +self._lock=false; +if(self._dirty){ +self._dirty=false; +for(var i=_3c5.length-1;i>=0;i--){ +if(!_3c5[i].connected){ +_3c5.splice(i,1); +} +} +} +if(_3c7.length==1){ +throw _3c7[0]; }else{ -if(db){ -c.x=db.scrollLeft; -c.y=db.scrollTop; +if(_3c7.length>1){ +var e=new Error("Multiple errors thrown in handling 'sig', see errors property"); +e.errors=_3c7; +throw e; } } -return c; -},__new__:function(){ +}}); +MochiKit.Signal.EXPORT_OK=[]; +MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"]; +MochiKit.Signal.__new__=function(win){ var m=MochiKit.Base; -this.elementPosition=this.getElementPosition; -this.elementDimensions=this.getElementDimensions; -this.hideElement=m.partial(this.setDisplayForElement,"none"); -this.showElement=m.partial(this.setDisplayForElement,"block"); +this._document=document; +this._window=win; +this._lock=false; +this._dirty=false; +try{ +this.connect(window,"onunload",this._unloadCache); +} +catch(e){ +} this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; m.nameFunctions(this); -}}); -MochiKit.Style.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Style); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.LoggingPane"); -dojo.require("MochiKit.Logging"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Logging",[]); -JSAN.use("MochiKit.Base",[]); +}; +MochiKit.Signal.__new__(this); +if(MochiKit.__export__){ +connect=MochiKit.Signal.connect; +disconnect=MochiKit.Signal.disconnect; +disconnectAll=MochiKit.Signal.disconnectAll; +signal=MochiKit.Signal.signal; } +MochiKit.Base._exportSymbols(this,MochiKit.Signal); + + +/*** + + PlotKit.PlotKit 0.9.1 : PACKED VERSION + + THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please + diff against the source tree, not this file. + + For more information, . + + Copyright (c) 2006. Alastair Tse. + +***/ + try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.Logging)=="undefined"){ +if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"||typeof (MochiKit.Format)=="undefined"){ throw ""; } } catch(e){ -throw "MochiKit.LoggingPane depends on MochiKit.Base and MochiKit.Logging!"; +throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format}"; } -if(typeof (MochiKit.LoggingPane)=="undefined"){ -MochiKit.LoggingPane={}; +MochiKit.Base.update(MochiKit.Color.Color.prototype,{asFillColor:function(){ +return this.lighterColorWithLevel(0.3); +},asStrokeColor:function(){ +return this.darkerColorWithLevel(0.1); +},asPointColor:function(){ +return this.lighterColorWithLevel(0.1); +}}); +if(typeof (PlotKit)=="undefined"){ +PlotKit={}; } -MochiKit.LoggingPane.NAME="MochiKit.LoggingPane"; -MochiKit.LoggingPane.VERSION="1.4"; -MochiKit.LoggingPane.__repr__=function(){ +PlotKit.NAME="PlotKit"; +PlotKit.VERSION="0.8"; +PlotKit.__repr__=function(){ return "["+this.NAME+" "+this.VERSION+"]"; }; -MochiKit.LoggingPane.toString=function(){ +PlotKit.toString=function(){ return this.__repr__(); }; -MochiKit.LoggingPane.createLoggingPane=function(_441){ -var m=MochiKit.LoggingPane; -_441=!(!_441); -if(m._loggingPane&&m._loggingPane.inline!=_441){ -m._loggingPane.closePane(); -m._loggingPane=null; -} -if(!m._loggingPane||m._loggingPane.closed){ -m._loggingPane=new m.LoggingPane(_441,MochiKit.Logging.logger); +if(typeof (PlotKit.Base)=="undefined"){ +PlotKit.Base={}; } -return m._loggingPane; +PlotKit.Base.NAME="PlotKit.Base"; +PlotKit.Base.VERSION=PlotKit.VERSION; +PlotKit.Base.__repr__=function(){ +return "["+this.NAME+" "+this.VERSION+"]"; }; -MochiKit.LoggingPane.LoggingPane=function(_443,_444){ -if(typeof (_444)=="undefined"||_444===null){ -_444=MochiKit.Logging.logger; -} -this.logger=_444; -var _445=MochiKit.Base.update; -var _446=MochiKit.Base.updatetree; -var bind=MochiKit.Base.bind; -var _448=MochiKit.Base.clone; -var win=window; -var uid="_MochiKit_LoggingPane"; -if(typeof (MochiKit.DOM)!="undefined"){ -win=MochiKit.DOM.currentWindow(); -} -if(!_443){ -var url=win.location.href.split("?")[0].replace(/[#:\/.><&-]/g,"_"); -var name=uid+"_"+url; -var nwin=win.open("",name,"dependent,resizable,height=200"); -if(!nwin){ -alert("Not able to open debugging window due to pop-up blocking."); -return undefined; -} -nwin.document.write(""+"[MochiKit.LoggingPane]"+""); -nwin.document.close(); -nwin.document.title+=" "+win.document.title; -win=nwin; -} -var doc=win.document; -this.doc=doc; -var _44f=doc.getElementById(uid); -var _450=!!_44f; -if(_44f&&typeof (_44f.loggingPane)!="undefined"){ -_44f.loggingPane.logger=this.logger; -_44f.loggingPane.buildAndApplyFilter(); -return _44f.loggingPane; -} -if(_450){ -var _451; -while((_451=_44f.firstChild)){ -_44f.removeChild(_451); -} -}else{ -_44f=doc.createElement("div"); -_44f.id=uid; -} -_44f.loggingPane=this; -var _452=doc.createElement("input"); -var _453=doc.createElement("input"); -var _454=doc.createElement("button"); -var _455=doc.createElement("button"); -var _456=doc.createElement("button"); -var _457=doc.createElement("button"); -var _458=doc.createElement("div"); -var _459=doc.createElement("div"); -var _45a=uid+"_Listener"; -this.colorTable=_448(this.colorTable); -var _45b=[]; -var _45c=null; -var _45d=function(msg){ -var _45f=msg.level; -if(typeof (_45f)=="number"){ -_45f=MochiKit.Logging.LogLevel[_45f]; -} -return _45f; -}; -var _460=function(msg){ -return msg.info.join(" "); -}; -var _462=bind(function(msg){ -var _464=_45d(msg); -var text=_460(msg); -var c=this.colorTable[_464]; -var p=doc.createElement("span"); -p.className="MochiKit-LogMessage MochiKit-LogLevel-"+_464; -p.style.cssText="margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: "+c; -p.appendChild(doc.createTextNode(_464+": "+text)); -_459.appendChild(p); -_459.appendChild(doc.createElement("br")); -if(_458.offsetHeight>_458.scrollHeight){ -_458.scrollTop=0; -}else{ -_458.scrollTop=_458.scrollHeight; -} -},this); -var _468=function(msg){ -_45b[_45b.length]=msg; -_462(msg); -}; -var _46a=function(){ -var _46b,_46c; +PlotKit.Base.toString=function(){ +return this.__repr__(); +}; +PlotKit.Base.usingPrototype=function(){ try{ -_46b=new RegExp(_452.value); -_46c=new RegExp(_453.value); +return (typeof (Object.extend)=="function"); } catch(e){ -logDebug("Error in filter regex: "+e.message); -return null; -} -return function(msg){ -return (_46b.test(_45d(msg))&&_46c.test(_460(msg))); -}; -}; -var _46e=function(){ -while(_459.firstChild){ -_459.removeChild(_459.firstChild); +return false; } }; -var _46f=function(){ -_45b=[]; -_46e(); -}; -var _470=bind(function(){ -if(this.closed){ -return; -} -this.closed=true; -if(MochiKit.LoggingPane._loggingPane==this){ -MochiKit.LoggingPane._loggingPane=null; -} -this.logger.removeListener(_45a); -try{ -try{ -_44f.loggingPane=null; -} -catch(e){ -logFatal("Bookmarklet was closed incorrectly."); +MochiKit.Base.update(PlotKit.Base,{roundInterval:function(_1,_2,_3){ +var _4=MochiKit.Format.roundToFixed; +var _5=_1/_2; +return parseFloat(_4(_5,_3)); +},collapse:function(_6){ +var m=MochiKit.Base; +var _8=new Array(); +for(var i=0;i<_6.length;i++){ +_8=m.concat(_8,_6[i]); } -if(_443){ -_44f.parentNode.removeChild(_44f); -}else{ -this.win.close(); +if(PlotKit.Base.usingPrototype()){ +delete _8.extend; +delete _8.from; +delete _8.inspect; } +return _8; +},uniq:function(_10){ +var m=MochiKit.Base; +if(!m.isArrayLike(_10)||(_10.length<1)){ +return new Array(); } -catch(e){ -} -},this); -var _471=function(){ -_46e(); -for(var i=0;i<_45b.length;i++){ -var msg=_45b[i]; -if(_45c===null||_45c(msg)){ -_462(msg); -} -} -}; -this.buildAndApplyFilter=function(){ -_45c=_46a(); -_471(); -this.logger.removeListener(_45a); -this.logger.addListener(_45a,_45c,_468); -}; -var _474=bind(function(){ -_45b=this.logger.getMessages(); -_471(); -},this); -var _475=bind(function(_476){ -_476=_476||window.event; -key=_476.which||_476.keyCode; -if(key==13){ -this.buildAndApplyFilter(); -} -},this); -var _477="display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: "+this.logFont; -if(_443){ -_477+="; height: 10em; border-top: 2px solid black"; -}else{ -_477+="; height: 100%;"; -} -_44f.style.cssText=_477; -if(!_450){ -doc.body.appendChild(_44f); -} -_477={"cssText":"width: 33%; display: inline; font: "+this.logFont}; -_446(_452,{"value":"FATAL|ERROR|WARNING|INFO|DEBUG","onkeypress":_475,"style":_477}); -_44f.appendChild(_452); -_446(_453,{"value":".*","onkeypress":_475,"style":_477}); -_44f.appendChild(_453); -_477="width: 8%; display:inline; font: "+this.logFont; -_454.appendChild(doc.createTextNode("Filter")); -_454.onclick=bind("buildAndApplyFilter",this); -_454.style.cssText=_477; -_44f.appendChild(_454); -_455.appendChild(doc.createTextNode("Load")); -_455.onclick=_474; -_455.style.cssText=_477; -_44f.appendChild(_455); -_456.appendChild(doc.createTextNode("Clear")); -_456.onclick=_46f; -_456.style.cssText=_477; -_44f.appendChild(_456); -_457.appendChild(doc.createTextNode("Close")); -_457.onclick=_470; -_457.style.cssText=_477; -_44f.appendChild(_457); -_458.style.cssText="overflow: auto; width: 100%"; -_459.style.cssText="width: 100%; height: "+(_443?"8em":"100%"); -_458.appendChild(_459); -_44f.appendChild(_458); -this.buildAndApplyFilter(); -_474(); -if(_443){ -this.win=undefined; -}else{ -this.win=win; -} -this.inline=_443; -this.closePane=_470; -this.closed=false; -return this; -}; -MochiKit.LoggingPane.LoggingPane.prototype={"logFont":"8pt Verdana,sans-serif","colorTable":{"ERROR":"red","FATAL":"darkred","WARNING":"blue","INFO":"black","DEBUG":"green"}}; -MochiKit.LoggingPane.EXPORT_OK=["LoggingPane"]; -MochiKit.LoggingPane.EXPORT=["createLoggingPane"]; -MochiKit.LoggingPane.__new__=function(){ -this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}; -MochiKit.Base.nameFunctions(this); -MochiKit.LoggingPane._loggingPane=null; -}; -MochiKit.LoggingPane.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.LoggingPane); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Color"); -dojo.require("MochiKit.Base"); -dojo.require("MochiKit.DOM"); -dojo.require("MochiKit.Style"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -JSAN.use("MochiKit.DOM",[]); -JSAN.use("MochiKit.Style",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Color depends on MochiKit.Base"; -} -try{ -if(typeof (MochiKit.DOM)=="undefined"){ -throw ""; -} +var _11=new Array(); +var _12=_10[0]; +_11.push(_10[0]); +for(var i=1;i<_10.length;i++){ +if(m.compare(_10[i],_12)!=0){ +_12=_10[i]; +_11.push(_10[i]); } -catch(e){ -throw "MochiKit.Color depends on MochiKit.DOM"; } -try{ -if(typeof (MochiKit.Style)=="undefined"){ -throw ""; +return _11; +},colorScheme:function(){ +var mb=MochiKit.Base; +var mc=MochiKit.Color; +var _15=["red","orange","yellow","green","cyan","blue","purple","magenta"]; +var _16=function(_17){ +return mc.Color[_17+"Color"](); +}; +return mb.map(_16,_15); +},baseDarkPrimaryColors:function(){ +var _18=MochiKit.Color.Color.fromHexString; +return [_18("#ad3f40"),_18("#ddac2c"),_18("#dfdd0c"),_18("#5276c4"),_18("#739c5a")]; +},basePrimaryColors:function(){ +var _19=MochiKit.Color.Color.fromHexString; +return [_19("#d24c4d"),_19("#f2b32f"),_19("#ece90e"),_19("#5d83da"),_19("#78a15d")]; +},baseBlueColors:function(){ +var _20=MochiKit.Color.Color.fromHexString; +return [_20("#4b6b94"),_20("#5d81b4"),_20("#acbad2")]; +},palette:function(_21,_22,_23,_24){ +var _25=MochiKit.Base.isUndefinedOrNull; +var _26=new Array(); +if(_25(_24)){ +_24=0.1; } +if(_25(_23)){ +_23=0.4; } -catch(e){ -throw "MochiKit.Color depends on MochiKit.Style"; +if(_25(_22)){ +_22=-0.2; } -if(typeof (MochiKit.Color)=="undefined"){ -MochiKit.Color={}; +var _27=_22; +while(_27<=_23){ +_26.push(_27); +_27+=_24; } -MochiKit.Color.NAME="MochiKit.Color"; -MochiKit.Color.VERSION="1.4"; -MochiKit.Color.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Color.toString=function(){ -return this.__repr__(); +var _28=function(_29,_30){ +return _29.lighterColorWithLevel(_30); }; -MochiKit.Color.Color=function(red,_479,blue,_47b){ -if(typeof (_47b)=="undefined"||_47b===null){ -_47b=1; +return MochiKit.Base.map(partial(_28,_21),_26); +},excanvasSupported:function(){ +if(/MSIE/.test(navigator.userAgent)&&!window.opera){ +return true; } -this.rgb={r:red,g:_479,b:blue,a:_47b}; -}; -MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_47c){ -var rgb=this.rgb; -var m=MochiKit.Color; -return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_47c); -},colorWithHue:function(hue){ -var hsl=this.asHSL(); -hsl.h=hue; -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},colorWithSaturation:function(_482){ -var hsl=this.asHSL(); -hsl.s=_482; -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},colorWithLightness:function(_485){ -var hsl=this.asHSL(); -hsl.l=_485; -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},darkerColorWithLevel:function(_488){ -var hsl=this.asHSL(); -hsl.l=Math.max(hsl.l-_488,0); -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},lighterColorWithLevel:function(_48b){ -var hsl=this.asHSL(); -hsl.l=Math.min(hsl.l+_48b,1); -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},blendedColor:function(_48e,_48f){ -if(typeof (_48f)=="undefined"||_48f===null){ -_48f=0.5; +return false; +},findPosX:function(obj){ +var _32=0; +if(obj.offsetParent){ +while(obj.offsetParent){ +_32+=obj.offsetLeft; +obj=obj.offsetParent; } -var sf=1-_48f; -var s=this.rgb; -var d=_48e.rgb; -var df=_48f; -return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df)); -},compareRGB:function(_494){ -var a=this.asRGB(); -var b=_494.asRGB(); -return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]); -},isLight:function(){ -return this.asHSL().b>0.5; -},isDark:function(){ -return (!this.isLight()); -},toHSLString:function(){ -var c=this.asHSL(); -var ccc=MochiKit.Color.clampColorComponent; -var rval=this._hslString; -if(!rval){ -var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%"); -var a=c.a; -if(a>=1){ -a=1; -rval="hsl("+mid+")"; }else{ -if(a<=0){ -a=0; +if(obj.x){ +_32+=obj.x; } -rval="hsla("+mid+","+a+")"; } -this._hslString=rval; +return _32; +},findPosY:function(obj){ +var _33=0; +if(obj.offsetParent){ +while(obj.offsetParent){ +_33+=obj.offsetTop; +obj=obj.offsetParent; } -return rval; -},toRGBString:function(){ -var c=this.rgb; -var ccc=MochiKit.Color.clampColorComponent; -var rval=this._rgbString; -if(!rval){ -var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0)); -if(c.a!=1){ -rval="rgba("+mid+","+c.a+")"; }else{ -rval="rgb("+mid+")"; -} -this._rgbString=rval; +if(obj.y){ +_33+=obj.y; } -return rval; -},asRGB:function(){ -return MochiKit.Base.clone(this.rgb); -},toHexString:function(){ -var m=MochiKit.Color; -var c=this.rgb; -var ccc=MochiKit.Color.clampColorComponent; -var rval=this._hexString; -if(!rval){ -rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255))); -this._hexString=rval; } -return rval; -},asHSV:function(){ -var hsv=this.hsv; -var c=this.rgb; -if(typeof (hsv)=="undefined"||hsv===null){ -hsv=MochiKit.Color.rgbToHSV(this.rgb); -this.hsv=hsv; +return _33; +},isFuncLike:function(obj){ +return (typeof (obj)=="function"); +}}); +PlotKit.Base.map=function(fn,lst){ +if(PlotKit.Base.usingPrototype()){ +var _36=[]; +for(var x in lst){ +if(typeof (lst[x])=="function"){ +continue; } -return MochiKit.Base.clone(hsv); -},asHSL:function(){ -var hsl=this.hsl; -var c=this.rgb; -if(typeof (hsl)=="undefined"||hsl===null){ -hsl=MochiKit.Color.rgbToHSL(this.rgb); -this.hsl=hsl; +_36.push(fn(lst[x])); } -return MochiKit.Base.clone(hsl); -},toString:function(){ -return this.toRGBString(); -},repr:function(){ -var c=this.rgb; -var col=[c.r,c.g,c.b,c.a]; -return this.__class__.NAME+"("+col.join(", ")+")"; -}}; -MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_4ab,blue,_4ad){ -var _4ae=MochiKit.Color.Color; -if(arguments.length==1){ -var rgb=red; -red=rgb.r; -_4ab=rgb.g; -blue=rgb.b; -if(typeof (rgb.a)=="undefined"){ -_4ad=undefined; +return _36; }else{ -_4ad=rgb.a; -} -} -return new _4ae(red,_4ab,blue,_4ad); -},fromHSL:function(hue,_4b1,_4b2,_4b3){ -var m=MochiKit.Color; -return m.Color.fromRGB(m.hslToRGB.apply(m,arguments)); -},fromHSV:function(hue,_4b6,_4b7,_4b8){ -var m=MochiKit.Color; -return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments)); -},fromName:function(name){ -var _4bb=MochiKit.Color.Color; -if(name.charAt(0)=="\""){ -name=name.substr(1,name.length-2); +return MochiKit.Base.map(fn,lst); } -var _4bc=_4bb._namedColors[name.toLowerCase()]; -if(typeof (_4bc)=="string"){ -return _4bb.fromHexString(_4bc); -}else{ -if(name=="transparent"){ -return _4bb.transparentColor(); +}; +PlotKit.Base.items=function(lst){ +if(PlotKit.Base.usingPrototype()){ +var _38=[]; +for(var x in lst){ +if(typeof (lst[x])=="function"){ +continue; } +_38.push([x,lst[x]]); } -return null; -},fromString:function(_4bd){ -var self=MochiKit.Color.Color; -var _4bf=_4bd.substr(0,3); -if(_4bf=="rgb"){ -return self.fromRGBString(_4bd); -}else{ -if(_4bf=="hsl"){ -return self.fromHSLString(_4bd); +return _38; }else{ -if(_4bd.charAt(0)=="#"){ -return self.fromHexString(_4bd); -} -} +return MochiKit.Base.items(lst); } -return self.fromName(_4bd); -},fromHexString:function(_4c0){ -if(_4c0.charAt(0)=="#"){ -_4c0=_4c0.substring(1); +}; +PlotKit.Base.keys=function(lst){ +if(PlotKit.Base.usingPrototype()){ +var _39=[]; +for(var x in lst){ +if(typeof (lst[x])=="function"){ +continue; } -var _4c1=[]; -var i,hex; -if(_4c0.length==3){ -for(i=0;i<3;i++){ -hex=_4c0.substr(i,1); -_4c1.push(parseInt(hex+hex,16)/255); +_39.push(x); } +return _39; }else{ -for(i=0;i<6;i+=2){ -hex=_4c0.substr(i,2); -_4c1.push(parseInt(hex,16)/255); -} -} -var _4c4=MochiKit.Color.Color; -return _4c4.fromRGB.apply(_4c4,_4c1); -},_fromColorString:function(pre,_4c6,_4c7,_4c8){ -if(_4c8.indexOf(pre)===0){ -_4c8=_4c8.substring(_4c8.indexOf("(",3)+1,_4c8.length-1); +return MochiKit.Base.keys(lst); } -var _4c9=_4c8.split(/\s*,\s*/); -var _4ca=[]; -for(var i=0;i<_4c9.length;i++){ -var c=_4c9[i]; -var val; -var _4ce=c.substring(c.length-3); -if(c.charAt(c.length-1)=="%"){ -val=0.01*parseFloat(c.substring(0,c.length-1)); -}else{ -if(_4ce=="deg"){ -val=parseFloat(c)/360; -}else{ -if(_4ce=="rad"){ -val=parseFloat(c)/(Math.PI*2); -}else{ -val=_4c7[i]*parseFloat(c); +}; +PlotKit.Base.baseColors=function(){ +var _40=MochiKit.Color.Color.fromHexString; +return [_40("#476fb2"),_40("#be2c2b"),_40("#85b730"),_40("#734a99"),_40("#26a1c5"),_40("#fb8707"),_40("#000000")]; +}; +PlotKit.Base.officeBaseStyle={"axisLineWidth":2,"axisLabelColor":Color.grayColor(),"axisLineColor":Color.whiteColor(),"padding":{top:5,bottom:10,left:30,right:30}}; +MochiKit.Base.update(PlotKit.Base,{officeBlue:function(){ +var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"backgroundColor":PlotKit.Base.baseColors()[0].lighterColorWithLevel(0.45)}; +MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); +return r; +},officeRed:function(){ +var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"backgroundColor":PlotKit.Base.baseColors()[1].lighterColorWithLevel(0.5)}; +MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); +return r; +},officeGreen:function(){ +var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[2]),"backgroundColor":PlotKit.Base.baseColors()[2].lighterColorWithLevel(0.5)}; +MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); +return r; +},officePurple:function(){ +var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[3]),"backgroundColor":PlotKit.Base.baseColors()[3].lighterColorWithLevel(0.5)}; +MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); +return r; +},officeCyan:function(){ +var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[4]),"backgroundColor":PlotKit.Base.baseColors()[4].lighterColorWithLevel(0.5)}; +MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); +return r; +},officeOrange:function(){ +var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[5]),"backgroundColor":PlotKit.Base.baseColors()[5].lighterColorWithLevel(0.4)}; +MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); +return r; +},officeBlack:function(){ +var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[6],0,0.6),"backgroundColor":PlotKit.Base.baseColors()[6].lighterColorWithLevel(0.9)}; +MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); +return r; +}}); +PlotKit.Base.EXPORT=["baseColors","collapse","colorScheme","findPosX","findPosY","officeBaseStyle","officeBlue","officeRed","officeGreen","officePurple","officeCyan","officeOrange","officeBlack","roundInterval","uniq","isFuncLike","excanvasSupported"]; +PlotKit.Base.EXPORT_OK=[]; +PlotKit.Base.__new__=function(){ +var m=MochiKit.Base; +m.nameFunctions(this); +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; +}; +PlotKit.Base.__new__(); +MochiKit.Base._exportSymbols(this,PlotKit.Base); +try{ +if(typeof (PlotKit.Base)=="undefined"){ +throw ""; } } +catch(e){ +throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Base"; } -_4ca.push(val); +if(typeof (PlotKit.Layout)=="undefined"){ +PlotKit.Layout={}; } -return this[_4c6].apply(this,_4ca); -},fromComputedStyle:function(elem,_4d0){ -var d=MochiKit.DOM; -var cls=MochiKit.Color.Color; -for(elem=d.getElement(elem);elem;elem=elem.parentNode){ -var _4d3=MochiKit.Style.getStyle.apply(d,arguments); -if(!_4d3){ -continue; +PlotKit.Layout.NAME="PlotKit.Layout"; +PlotKit.Layout.VERSION=PlotKit.VERSION; +PlotKit.Layout.__repr__=function(){ +return "["+this.NAME+" "+this.VERSION+"]"; +}; +PlotKit.Layout.toString=function(){ +return this.__repr__(); +}; +PlotKit.Layout.valid_styles=["bar","line","pie","point"]; +PlotKit.Layout=function(_42,_43){ +this.options={"barWidthFillFraction":0.75,"barOrientation":"vertical","xOriginIsZero":true,"yOriginIsZero":true,"xAxis":null,"yAxis":null,"xTicks":null,"yTicks":null,"xNumberOfTicks":10,"yNumberOfTicks":5,"xTickPrecision":1,"yTickPrecision":1,"pieRadius":0.4}; +this.style=_42; +MochiKit.Base.update(this.options,_43?_43:{}); +if(!MochiKit.Base.isUndefinedOrNull(this.options.xAxis)){ +this.minxval=this.options.xAxis[0]; +this.maxxval=this.options.xAxis[1]; +this.xscale=this.maxxval-this.minxval; +}else{ +this.minxval=0; +this.maxxval=null; +this.xscale=null; } -var _4d4=cls.fromString(_4d3); -if(!_4d4){ -break; +if(!MochiKit.Base.isUndefinedOrNull(this.options.yAxis)){ +this.minyval=this.options.yAxis[0]; +this.maxyval=this.options.yAxis[1]; +this.yscale=this.maxyval-this.minyval; +}else{ +this.minyval=0; +this.maxyval=null; +this.yscale=null; } -if(_4d4.asRGB().a>0){ -return _4d4; +this.bars=new Array(); +this.points=new Array(); +this.slices=new Array(); +this.xticks=new Array(); +this.yticks=new Array(); +this.datasets=new Array(); +this.minxdelta=0; +this.xrange=1; +this.yrange=1; +this.hitTestCache={x2maxy:null}; +}; +PlotKit.Layout.prototype.addDataset=function(_44,_45){ +this.datasets[_44]=_45; +}; +PlotKit.Layout.prototype.removeDataset=function(_46,_47){ +delete this.datasets[_46]; +}; +PlotKit.Layout.prototype.addDatasetFromTable=function(_48,_49,_50,_51,_52){ +var _53=MochiKit.Base.isUndefinedOrNull; +var _54=MochiKit.DOM.scrapeText; +var _55=MochiKit.Format.strip; +if(_53(_50)){ +_50=0; } +if(_53(_51)){ +_51=1; } -return null; -},fromBackground:function(elem){ -var cls=MochiKit.Color.Color; -return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor(); -},fromText:function(elem){ -var cls=MochiKit.Color.Color; -return cls.fromComputedStyle(elem,"color","color")||cls.blackColor(); -},namedColors:function(){ -return MochiKit.Base.clone(MochiKit.Color.Color._namedColors); -}}); -MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_4da){ -v*=_4da; -if(v<0){ -return 0; -}else{ -if(v>_4da){ -return _4da; -}else{ -return v; +if(_53(_52)){ +_52=-1; } +var _56=_49.tBodies[0].rows; +var _57=new Array(); +var _58=new Array(); +if(!_53(_56)){ +for(var i=0;i<_56.length;i++){ +_57.push([parseFloat(_55(_54(_56[i].cells[_50]))),parseFloat(_55(_54(_56[i].cells[_51])))]); +if(_52>=0){ +_58.push({v:parseFloat(_55(_54(_56[i].cells[_50]))),label:_55(_54(_56[i].cells[_52]))}); } -},_hslValue:function(n1,n2,hue){ -if(hue>6){ -hue-=6; -}else{ -if(hue<0){ -hue+=6; } +this.addDataset(_48,_57); +if(_52>=0){ +this.options.xTicks=_58; +} +return true; } -var val; -if(hue<1){ -val=n1+(n2-n1)*hue; +return false; +}; +PlotKit.Layout.prototype.evaluate=function(){ +this._evaluateLimits(); +this._evaluateScales(); +if(this.style=="bar"){ +if(this.options.barOrientation=="horizontal"){ +this._evaluateHorizBarCharts(); }else{ -if(hue<3){ -val=n2; +this._evaluateBarCharts(); +} +this._evaluateBarTicks(); }else{ -if(hue<4){ -val=n1+(n2-n1)*(4-hue); +if(this.style=="line"){ +this._evaluateLineCharts(); +this._evaluateLineTicks(); }else{ -val=n1; +if(this.style=="pie"){ +this._evaluatePieCharts(); +this._evaluatePieTicks(); } } } -return val; -},hsvToRGB:function(hue,_4e0,_4e1,_4e2){ -if(arguments.length==1){ -var hsv=hue; -hue=hsv.h; -_4e0=hsv.s; -_4e1=hsv.v; -_4e2=hsv.a; +}; +PlotKit.Layout.prototype.hitTest=function(x,y){ +var f=MochiKit.Format.twoDigitFloat; +if((this.style=="bar")&&this.bars&&(this.bars.length>0)){ +for(var i=0;i=bar.x)&&(x<=bar.x+bar.w)&&(y>=bar.y)&&(y-bar.y<=bar.h)){ +return bar; +} } -var red; -var _4e5; -var blue; -if(_4e0===0){ -red=_4e1; -_4e5=_4e1; -blue=_4e1; }else{ -var i=Math.floor(hue*6); -var f=(hue*6)-i; -var p=_4e1*(1-_4e0); -var q=_4e1*(1-(_4e0*f)); -var t=_4e1*(1-(_4e0*(1-f))); -switch(i){ -case 1: -red=q; -_4e5=_4e1; -blue=p; -break; -case 2: -red=p; -_4e5=_4e1; -blue=t; -break; -case 3: -red=p; -_4e5=q; -blue=_4e1; -break; -case 4: -red=t; -_4e5=p; -blue=_4e1; -break; -case 5: -red=_4e1; -_4e5=p; -blue=q; -break; -case 6: -case 0: -red=_4e1; -_4e5=t; -blue=p; +if(this.style=="line"){ +if(this.hitTestCache.x2maxy==null){ +this._regenerateHitTestCache(); +} +var _62=x/this.xscale; +var _63=this.hitTestCache.xvalues; +var _64=null; +var _65=null; +for(var i=1;i<_63.length;i++){ +if(_63[i]>_62){ +_64=_63[i-1]; +_65=_63[i]; break; } } -return {r:red,g:_4e5,b:blue,a:_4e2}; -},hslToRGB:function(hue,_4ed,_4ee,_4ef){ -if(arguments.length==1){ -var hsl=hue; -hue=hsl.h; -_4ed=hsl.s; -_4ee=hsl.l; -_4ef=hsl.a; +if((_64!=null)){ +var _66=this.hitTestCache.x2maxy[_64]; +var _67=this.hitTestCache.x2maxy[_65]; +var _68=(1-y)/this.yscale; +var _69=(_67-_66)/(_65-_64); +var _70=_66+_69*(_62-_64); +if(_70>=_68){ +var obj={xval:_62,yval:_68,xafter:_65,yafter:_67,xbefore:_64,ybefore:_66,yprojected:_70}; +return obj; +} } -var red; -var _4f2; -var blue; -if(_4ed===0){ -red=_4ee; -_4f2=_4ee; -blue=_4ee; -}else{ -var m2; -if(_4ee<=0.5){ -m2=_4ee*(1+_4ed); }else{ -m2=_4ee+_4ed-(_4ee*_4ed); +if(this.style=="pie"){ +var _71=Math.sqrt((y-0.5)*(y-0.5)+(x-0.5)*(x-0.5)); +if(_71>this.options.pieRadius){ +return null; } -var m1=(2*_4ee)-m2; -var f=MochiKit.Color._hslValue; -var h6=hue*6; -red=f(m1,m2,h6+2); -_4f2=f(m1,m2,h6); -blue=f(m1,m2,h6-2); +var _72=Math.atan2(y-0.5,x-0.5)-Math.PI/2; +for(var i=0;i=_72){ +return _73; } -return {r:red,g:_4f2,b:blue,a:_4ef}; -},rgbToHSV:function(red,_4f9,blue,_4fb){ -if(arguments.length==1){ -var rgb=red; -red=rgb.r; -_4f9=rgb.g; -blue=rgb.b; -_4fb=rgb.a; -} -var max=Math.max(Math.max(red,_4f9),blue); -var min=Math.min(Math.min(red,_4f9),blue); -var hue; -var _500; -var _501=max; -if(min==max){ -hue=0; -_500=0; -}else{ -var _502=(max-min); -_500=_502/max; -if(red==max){ -hue=(_4f9-blue)/_502; -}else{ -if(_4f9==max){ -hue=2+((blue-red)/_502); -}else{ -hue=4+((red-_4f9)/_502); } } -hue/=6; -if(hue<0){ -hue+=1; } -if(hue>1){ -hue-=1; } +return null; +}; +PlotKit.Layout.prototype.rectForX=function(x){ +return null; +}; +PlotKit.Layout.prototype.angleRangeForX=function(x){ +return null; +}; +PlotKit.Layout.prototype._evaluateLimits=function(){ +var map=PlotKit.Base.map; +var _75=PlotKit.Base.items; +var _76=MochiKit.Base.itemgetter; +var _77=PlotKit.Base.collapse; +var _78=MochiKit.Base.listMin; +var _79=MochiKit.Base.listMax; +var _80=MochiKit.Base.isUndefinedOrNull; +var all=_77(map(_76(1),_75(this.datasets))); +if(_80(this.options.xAxis)){ +if(this.options.xOriginIsZero){ +this.minxval=0; +}else{ +this.minxval=_78(map(parseFloat,map(_76(0),all))); } -return {h:hue,s:_500,v:_501,a:_4fb}; -},rgbToHSL:function(red,_504,blue,_506){ -if(arguments.length==1){ -var rgb=red; -red=rgb.r; -_504=rgb.g; -blue=rgb.b; -_506=rgb.a; +this.maxxval=_79(map(parseFloat,map(_76(0),all))); +}else{ +this.minxval=this.options.xAxis[0]; +this.maxxval=this.options.xAxis[1]; +this.xscale=this.maxval-this.minxval; } -var max=Math.max(red,Math.max(_504,blue)); -var min=Math.min(red,Math.min(_504,blue)); -var hue; -var _50b; -var _50c=(max+min)/2; -var _50d=max-min; -if(_50d===0){ -hue=0; -_50b=0; +if(_80(this.options.yAxis)){ +if(this.options.yOriginIsZero){ +this.minyval=0; }else{ -if(_50c<=0.5){ -_50b=_50d/(max+min); +this.minyval=_78(map(parseFloat,map(_76(1),all))); +} +this.maxyval=_79(map(parseFloat,map(_76(1),all))); }else{ -_50b=_50d/(2-max-min); +this.minyval=this.options.yAxis[0]; +this.maxyval=this.options.yAxis[1]; +this.yscale=this.maxyval-this.minyval; } -if(red==max){ -hue=(_504-blue)/_50d; +}; +PlotKit.Layout.prototype._evaluateScales=function(){ +var _82=MochiKit.Base.isUndefinedOrNull; +this.xrange=this.maxxval-this.minxval; +if(this.xrange==0){ +this.xscale=1; }else{ -if(_504==max){ -hue=2+((blue-red)/_50d); +this.xscale=1/this.xrange; +} +this.yrange=this.maxyval-this.minyval; +if(this.yrange==0){ +this.yscale=1; }else{ -hue=4+((red-_504)/_50d); +this.yscale=1/this.yrange; } +}; +PlotKit.Layout.prototype._uniqueXValues=function(){ +var _83=PlotKit.Base.collapse; +var map=PlotKit.Base.map; +var _84=PlotKit.Base.uniq; +var _85=MochiKit.Base.itemgetter; +var _86=PlotKit.Base.items; +var _87=map(parseFloat,map(_85(0),_83(map(_85(1),_86(this.datasets))))); +_87.sort(MochiKit.Base.compare); +return _84(_87); +}; +PlotKit.Layout.prototype._evaluateBarCharts=function(){ +var _88=PlotKit.Base.items; +var _89=_88(this.datasets).length; +var _90=10000000; +var _91=this._uniqueXValues(); +for(var i=1;i<_91.length;i++){ +_90=Math.min(Math.abs(_91[i]-_91[i-1]),_90); } -hue/=6; -if(hue<0){ -hue+=1; +var _92=0; +var _93=0; +var _94=0; +if(_91.length==1){ +_90=1; +this.xscale=1; +this.minxval=_91[0]; +_92=1*this.options.barWidthFillFraction; +_93=_92/_89; +_94=(1-this.options.barWidthFillFraction)/2; +}else{ +if(this.xrange==1){ +this.xscale=0.5; +}else{ +if(this.xrange==2){ +this.xscale=1/3; +}else{ +this.xscale=(1-_90/this.xrange)/this.xrange; } -if(hue>1){ -hue-=1; } +_92=_90*this.xscale*this.options.barWidthFillFraction; +_93=_92/_89; +_94=_90*this.xscale*(1-this.options.barWidthFillFraction)/2; } -return {h:hue,s:_50b,l:_50c,a:_506}; -},toColorPart:function(num){ -num=Math.round(num); -var _50f=num.toString(16); -if(num<16){ -return "0"+_50f; +this.minxdelta=_90; +this.bars=new Array(); +var i=0; +for(var _95 in this.datasets){ +var _96=this.datasets[_95]; +if(PlotKit.Base.isFuncLike(_96)){ +continue; } -return _50f; -},__new__:function(){ -var m=MochiKit.Base; -this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]); -this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]); -var _511=1/3; -var _512={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_511,_511,_511],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_511,2*_511,2*_511],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]}; -var _513=function(name,r,g,b,a){ -var rval=this.fromRGB(r,g,b,a); -this[name]=function(){ -return rval; -}; -return rval; -}; -for(var k in _512){ -var name=k+"Color"; -var _51c=m.concat([_513,this.Color,name],_512[k]); -this.Color[name]=m.bind.apply(null,_51c); +for(var j=0;j<_96.length;j++){ +var _98=_96[j]; +var _99={x:((parseFloat(_98[0])-this.minxval)*this.xscale)+(i*_93)+_94,y:1-((parseFloat(_98[1])-this.minyval)*this.yscale),w:_93,h:((parseFloat(_98[1])-this.minyval)*this.yscale),xval:parseFloat(_98[0]),yval:parseFloat(_98[1]),name:_95}; +if((_99.x>=0)&&(_99.x<=1)&&(_99.y>=0)&&(_99.y<=1)){ +this.bars.push(_99); } -var _51d=function(){ -for(var i=0;i=1){ +rect.y=1; } +if((rect.x>=0)&&(rect.x<=1)){ +this.bars.push(rect); } -catch(e){ -throw "MochiKit.Signal depends on MochiKit.DOM!"; } -try{ -if(typeof (MochiKit.Style)=="undefined"){ -throw ""; +i++; } +}; +PlotKit.Layout.prototype._evaluateLineCharts=function(){ +var _111=PlotKit.Base.items; +var _112=_111(this.datasets).length; +this.points=new Array(); +var i=0; +for(var _113 in this.datasets){ +var _114=this.datasets[_113]; +if(PlotKit.Base.isFuncLike(_114)){ +continue; } -catch(e){ -throw "MochiKit.Signal depends on MochiKit.Style!"; +_114.sort(function(a,b){ +return compare(parseFloat(a[0]),parseFloat(b[0])); +}); +for(var j=0;j<_114.length;j++){ +var item=_114[j]; +var _117={x:((parseFloat(item[0])-this.minxval)*this.xscale),y:1-((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_113}; +if(_117.y<=0){ +_117.y=0; } -if(typeof (MochiKit.Signal)=="undefined"){ -MochiKit.Signal={}; +if(_117.y>=1){ +_117.y=1; } -MochiKit.Signal.NAME="MochiKit.Signal"; -MochiKit.Signal.VERSION="1.4"; -MochiKit.Signal._observers=[]; -MochiKit.Signal.Event=function(src,e){ -this._event=e||window.event; -this._src=src; -}; -MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){ -var repr=MochiKit.Base.repr; -var str="{event(): "+repr(this.event())+", src(): "+repr(this.src())+", type(): "+repr(this.type())+", target(): "+repr(this.target()); -if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){ -str+=", modifier(): "+"{alt: "+repr(this.modifier().alt)+", ctrl: "+repr(this.modifier().ctrl)+", meta: "+repr(this.modifier().meta)+", shift: "+repr(this.modifier().shift)+", any: "+repr(this.modifier().any)+"}"; +if((_117.x>=0)&&(_117.x<=1)){ +this.points.push(_117); } -if(this.type()&&this.type().indexOf("key")===0){ -str+=", key(): {code: "+repr(this.key().code)+", string: "+repr(this.key().string)+"}"; } -if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ -str+=", mouse(): {page: "+repr(this.mouse().page)+", client: "+repr(this.mouse().client); -if(this.type()!="mousemove"){ -str+=", button: {left: "+repr(this.mouse().button.left)+", middle: "+repr(this.mouse().button.middle)+", right: "+repr(this.mouse().button.right)+"}}"; -}else{ -str+="}"; -} -} -if(this.type()=="mouseover"||this.type()=="mouseout"){ -str+=", relatedTarget(): "+repr(this.relatedTarget()); -} -str+="}"; -return str; -},toString:function(){ -return this.__repr__(); -},src:function(){ -return this._src; -},event:function(){ -return this._event; -},type:function(){ -return this._event.type||undefined; -},target:function(){ -return this._event.target||this._event.srcElement; -},_relatedTarget:null,relatedTarget:function(){ -if(this._relatedTarget!==null){ -return this._relatedTarget; -} -var elem=null; -if(this.type()=="mouseover"){ -elem=(this._event.relatedTarget||this._event.fromElement); -}else{ -if(this.type()=="mouseout"){ -elem=(this._event.relatedTarget||this._event.toElement); -} -} -if(elem!==null){ -this._relatedTarget=elem; -return elem; -} -return undefined; -},_modifier:null,modifier:function(){ -if(this._modifier!==null){ -return this._modifier; -} -var m={}; -m.alt=this._event.altKey; -m.ctrl=this._event.ctrlKey; -m.meta=this._event.metaKey||false; -m.shift=this._event.shiftKey; -m.any=m.alt||m.ctrl||m.shift||m.meta; -this._modifier=m; -return m; -},_key:null,key:function(){ -if(this._key!==null){ -return this._key; -} -var k={}; -if(this.type()&&this.type().indexOf("key")===0){ -if(this.type()=="keydown"||this.type()=="keyup"){ -k.code=this._event.keyCode; -k.string=(MochiKit.Signal._specialKeys[k.code]||"KEY_UNKNOWN"); -this._key=k; -return k; -}else{ -if(this.type()=="keypress"){ -k.code=0; -k.string=""; -if(typeof (this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){ -k.code=this._event.charCode; -k.string=String.fromCharCode(k.code); -}else{ -if(this._event.keyCode&&typeof (this._event.charCode)=="undefined"){ -k.code=this._event.keyCode; -k.string=String.fromCharCode(k.code); -} -} -this._key=k; -return k; -} -} -} -return undefined; -},_mouse:null,mouse:function(){ -if(this._mouse!==null){ -return this._mouse; -} -var m={}; -var e=this._event; -if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ -m.client=new MochiKit.Style.Coordinates(0,0); -if(e.clientX||e.clientY){ -m.client.x=(!e.clientX||e.clientX<0)?0:e.clientX; -m.client.y=(!e.clientY||e.clientY<0)?0:e.clientY; -} -m.page=new MochiKit.Style.Coordinates(0,0); -if(e.pageX||e.pageY){ -m.page.x=(!e.pageX||e.pageX<0)?0:e.pageX; -m.page.y=(!e.pageY||e.pageY<0)?0:e.pageY; -}else{ -var de=MochiKit.DOM._document.documentElement; -var b=MochiKit.DOM._document.body; -m.page.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); -m.page.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0); -} -if(this.type()!="mousemove"){ -m.button={}; -m.button.left=false; -m.button.right=false; -m.button.middle=false; -if(e.which){ -m.button.left=(e.which==1); -m.button.middle=(e.which==2); -m.button.right=(e.which==3); -}else{ -m.button.left=!!(e.button&1); -m.button.right=!!(e.button&2); -m.button.middle=!!(e.button&4); -} -} -this._mouse=m; -return m; -} -return undefined; -},stop:function(){ -this.stopPropagation(); -this.preventDefault(); -},stopPropagation:function(){ -if(this._event.stopPropagation){ -this._event.stopPropagation(); -}else{ -this._event.cancelBubble=true; -} -},preventDefault:function(){ -if(this._event.preventDefault){ -this._event.preventDefault(); -}else{ -if(this._confirmUnload===null){ -this._event.returnValue=false; -} -} -},_confirmUnload:null,confirmUnload:function(msg){ -if(this.type()=="beforeunload"){ -this._confirmUnload=msg; -this._event.returnValue=msg; -} -}}); -MochiKit.Signal._specialMacKeys={3:"KEY_ENTER",63289:"KEY_NUM_PAD_CLEAR",63276:"KEY_PAGE_UP",63277:"KEY_PAGE_DOWN",63275:"KEY_END",63273:"KEY_HOME",63234:"KEY_ARROW_LEFT",63232:"KEY_ARROW_UP",63235:"KEY_ARROW_RIGHT",63233:"KEY_ARROW_DOWN",63302:"KEY_INSERT",63272:"KEY_DELETE"}; -(function(){ -var _52e=MochiKit.Signal._specialMacKeys; -for(i=63236;i<=63242;i++){ -_52e[i]="KEY_F"+(i-63236+1); -} -})(); -MochiKit.Signal._specialKeys={8:"KEY_BACKSPACE",9:"KEY_TAB",12:"KEY_NUM_PAD_CLEAR",13:"KEY_ENTER",16:"KEY_SHIFT",17:"KEY_CTRL",18:"KEY_ALT",19:"KEY_PAUSE",20:"KEY_CAPS_LOCK",27:"KEY_ESCAPE",32:"KEY_SPACEBAR",33:"KEY_PAGE_UP",34:"KEY_PAGE_DOWN",35:"KEY_END",36:"KEY_HOME",37:"KEY_ARROW_LEFT",38:"KEY_ARROW_UP",39:"KEY_ARROW_RIGHT",40:"KEY_ARROW_DOWN",44:"KEY_PRINT_SCREEN",45:"KEY_INSERT",46:"KEY_DELETE",59:"KEY_SEMICOLON",91:"KEY_WINDOWS_LEFT",92:"KEY_WINDOWS_RIGHT",93:"KEY_SELECT",106:"KEY_NUM_PAD_ASTERISK",107:"KEY_NUM_PAD_PLUS_SIGN",109:"KEY_NUM_PAD_HYPHEN-MINUS",110:"KEY_NUM_PAD_FULL_STOP",111:"KEY_NUM_PAD_SOLIDUS",144:"KEY_NUM_LOCK",145:"KEY_SCROLL_LOCK",186:"KEY_SEMICOLON",187:"KEY_EQUALS_SIGN",188:"KEY_COMMA",189:"KEY_HYPHEN-MINUS",190:"KEY_FULL_STOP",191:"KEY_SOLIDUS",192:"KEY_GRAVE_ACCENT",219:"KEY_LEFT_SQUARE_BRACKET",220:"KEY_REVERSE_SOLIDUS",221:"KEY_RIGHT_SQUARE_BRACKET",222:"KEY_APOSTROPHE"}; -(function(){ -var _52f=MochiKit.Signal._specialKeys; -for(var i=48;i<=57;i++){ -_52f[i]="KEY_"+(i-48); -} -for(i=65;i<=90;i++){ -_52f[i]="KEY_"+String.fromCharCode(i); -} -for(i=96;i<=105;i++){ -_52f[i]="KEY_NUM_PAD_"+(i-96); -} -for(i=112;i<=123;i++){ -_52f[i]="KEY_F"+(i-112+1); -} -})(); -MochiKit.Signal.Ident=function(_531){ -this.source=_531.source; -this.signal=_531.signal; -this.listener=_531.listener; -this.isDOM=_531.isDOM; -this.objOrFunc=_531.objOrFunc; -this.funcOrStr=_531.funcOrStr; -this.connected=_531.connected; -}; -MochiKit.Signal.Ident.prototype={}; -MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -},toString:function(){ -return this.__repr__(); -},_unloadCache:function(){ -var self=MochiKit.Signal; -var _533=self._observers; -for(var i=0;i<_533.length;i++){ -if(_533[i].signal!=="onload"&&_533[i].signal!=="onunload"){ -self._disconnect(_533[i]); -} -} -},_listener:function(src,sig,func,obj,_539){ -var self=MochiKit.Signal; -var E=self.Event; -if(!_539){ -return MochiKit.Base.bind(func,obj); -} -obj=obj||src; -if(typeof (func)=="string"){ -if(sig==="onload"||sig==="onunload"){ -return function(_53c){ -obj[func].apply(obj,[new E(src,_53c)]); -var _53d=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:obj,funcOrStr:func}); -MochiKit.Signal._disconnect(_53d); -}; -}else{ -return function(_53e){ -obj[func].apply(obj,[new E(src,_53e)]); -}; -} -}else{ -if(sig==="onload"||sig==="onunload"){ -return function(_53f){ -func.apply(obj,[new E(src,_53f)]); -MochiKit.Signal.disconnect(src,sig,func); -var _540=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:func}); -MochiKit.Signal._disconnect(_540); -}; -}else{ -return function(_541){ -func.apply(obj,[new E(src,_541)]); -}; -} -} -},_browserAlreadyHasMouseEnterAndLeave:function(){ -return /MSIE/.test(navigator.userAgent); -},_mouseEnterListener:function(src,sig,func,obj){ -var E=MochiKit.Signal.Event; -return function(_547){ -var e=new E(src,_547); -try{ -e.relatedTarget().nodeName; -} -catch(err){ -return; -} -e.stop(); -if(MochiKit.DOM.isChildNode(e.relatedTarget(),src)){ -return; -} -e.type=function(){ -return sig; -}; -if(typeof (func)=="string"){ -return obj[func].apply(obj,[e]); -}else{ -return func.apply(obj,[e]); -} -}; -},_getDestPair:function(_549,_54a){ -var obj=null; -var func=null; -if(typeof (_54a)!="undefined"){ -obj=_549; -func=_54a; -if(typeof (_54a)=="string"){ -if(typeof (_549[_54a])!="function"){ -throw new Error("'funcOrStr' must be a function on 'objOrFunc'"); -} -}else{ -if(typeof (_54a)!="function"){ -throw new Error("'funcOrStr' must be a function or string"); -} -} -}else{ -if(typeof (_549)!="function"){ -throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given"); -}else{ -func=_549; -} -} -return [obj,func]; -},connect:function(src,sig,_54f,_550){ -src=MochiKit.DOM.getElement(src); -var self=MochiKit.Signal; -if(typeof (sig)!="string"){ -throw new Error("'sig' must be a string"); -} -var _552=self._getDestPair(_54f,_550); -var obj=_552[0]; -var func=_552[1]; -if(typeof (obj)=="undefined"||obj===null){ -obj=src; -} -var _555=!!(src.addEventListener||src.attachEvent); -if(_555&&(sig==="onmouseenter"||sig==="onmouseleave")&&!self._browserAlreadyHasMouseEnterAndLeave()){ -var _556=self._mouseEnterListener(src,sig.substr(2),func,obj); -if(sig==="onmouseenter"){ -sig="onmouseover"; -}else{ -sig="onmouseout"; -} -}else{ -var _556=self._listener(src,sig,func,obj,_555); -} -if(src.addEventListener){ -src.addEventListener(sig.substr(2),_556,false); -}else{ -if(src.attachEvent){ -src.attachEvent(sig,_556); -} -} -var _557=new MochiKit.Signal.Ident({source:src,signal:sig,listener:_556,isDOM:_555,objOrFunc:_54f,funcOrStr:_550,connected:true}); -self._observers.push(_557); -if(!_555&&typeof (src.__connect__)=="function"){ -var args=MochiKit.Base.extend([_557],arguments,1); -src.__connect__.apply(src,args); -} -return _557; -},_disconnect:function(_559){ -if(!_559.connected){ -return; -} -_559.connected=false; -if(!_559.isDOM){ -return; -} -var src=_559.source; -var sig=_559.signal; -var _55c=_559.listener; -if(src.removeEventListener){ -src.removeEventListener(sig.substr(2),_55c,false); -}else{ -if(src.detachEvent){ -src.detachEvent(sig,_55c); -}else{ -throw new Error("'src' must be a DOM element"); -} -} -},disconnect:function(_55d){ -var self=MochiKit.Signal; -var _55f=self._observers; -var m=MochiKit.Base; -if(arguments.length>1){ -var src=MochiKit.DOM.getElement(arguments[0]); -var sig=arguments[1]; -var obj=arguments[2]; -var func=arguments[3]; -for(var i=_55f.length-1;i>=0;i--){ -var o=_55f[i]; -if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){ -self._disconnect(o); -if(!self._lock){ -_55f.splice(i,1); -}else{ -self._dirty=true; -} -return true; -} -} -}else{ -var idx=m.findIdentical(_55f,_55d); -if(idx>=0){ -self._disconnect(_55d); -if(!self._lock){ -_55f.splice(idx,1); -}else{ -self._dirty=true; -} -return true; -} -} -return false; -},disconnectAllTo:function(_568,_569){ -var self=MochiKit.Signal; -var _56b=self._observers; -var _56c=self._disconnect; -var _56d=self._lock; -var _56e=self._dirty; -if(typeof (_569)==="undefined"){ -_569=null; -} -for(var i=_56b.length-1;i>=0;i--){ -var _570=_56b[i]; -if(_570.objOrFunc===_568&&(_569===null||_570.funcOrStr===_569)){ -_56c(_570); -if(_56d){ -_56e=true; -}else{ -_56b.splice(i,1); -} -} -} -self._dirty=_56e; -},disconnectAll:function(src,sig){ -src=MochiKit.DOM.getElement(src); -var m=MochiKit.Base; -var _574=m.flattenArguments(m.extend(null,arguments,1)); -var self=MochiKit.Signal; -var _576=self._disconnect; -var _577=self._observers; -var i,_579; -var _57a=self._lock; -var _57b=self._dirty; -if(_574.length===0){ -for(i=_577.length-1;i>=0;i--){ -_579=_577[i]; -if(_579.source===src){ -_576(_579); -if(!_57a){ -_577.splice(i,1); -}else{ -_57b=true; -} -} -} -}else{ -var sigs={}; -for(i=0;i<_574.length;i++){ -sigs[_574[i]]=true; -} -for(i=_577.length-1;i>=0;i--){ -_579=_577[i]; -if(_579.source===src&&_579.signal in sigs){ -_576(_579); -if(!_57a){ -_577.splice(i,1); -}else{ -_57b=true; -} -} -} -} -self._dirty=_57b; -},signal:function(src,sig){ -var self=MochiKit.Signal; -var _580=self._observers; -src=MochiKit.DOM.getElement(src); -var args=MochiKit.Base.extend(null,arguments,2); -var _582=[]; -self._lock=true; -for(var i=0;i<_580.length;i++){ -var _584=_580[i]; -if(_584.source===src&&_584.signal===sig){ -try{ -_584.listener.apply(src,args); -} -catch(e){ -_582.push(e); -} -} -} -self._lock=false; -if(self._dirty){ -self._dirty=false; -for(var i=_580.length-1;i>=0;i--){ -if(!_580[i].connected){ -_580.splice(i,1); -} -} -} -if(_582.length==1){ -throw _582[0]; -}else{ -if(_582.length>1){ -var e=new Error("Multiple errors thrown in handling 'sig', see errors property"); -e.errors=_582; -throw e; -} -} -}}); -MochiKit.Signal.EXPORT_OK=[]; -MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"]; -MochiKit.Signal.__new__=function(win){ -var m=MochiKit.Base; -this._document=document; -this._window=win; -this._lock=false; -this._dirty=false; -try{ -this.connect(window,"onunload",this._unloadCache); -} -catch(e){ -} -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -MochiKit.Signal.__new__(this); -if(MochiKit.__export__){ -connect=MochiKit.Signal.connect; -disconnect=MochiKit.Signal.disconnect; -disconnectAll=MochiKit.Signal.disconnectAll; -signal=MochiKit.Signal.signal; -} -MochiKit.Base._exportSymbols(this,MochiKit.Signal); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Position"); -dojo.require("MochiKit.Base"); -dojo.require("MochiKit.DOM"); -dojo.require("MochiKit.Style"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -JSAN.use("MochiKit.DOM",[]); -JSAN.use("MochiKit.Style",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.Style)=="undefined"||typeof (MochiKit.DOM)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Style depends on MochiKit.Base, MochiKit.DOM, and MochiKit.Style!"; -} -if(typeof (MochiKit.Position)=="undefined"){ -MochiKit.Position={}; -} -MochiKit.Position.NAME="MochiKit.Position"; -MochiKit.Position.VERSION="1.4"; -MochiKit.Position.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Position.toString=function(){ -return this.__repr__(); -}; -MochiKit.Position.EXPORT_OK=[]; -MochiKit.Position.EXPORT=[]; -MochiKit.Base.update(MochiKit.Position,{includeScrollOffsets:false,prepare:function(){ -var _588=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0; -var _589=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0; -this.windowOffset=new MochiKit.Style.Coordinates(_588,_589); -},cumulativeOffset:function(_58a){ -var _58b=0; -var _58c=0; -do{ -_58b+=_58a.offsetTop||0; -_58c+=_58a.offsetLeft||0; -_58a=_58a.offsetParent; -}while(_58a); -return new MochiKit.Style.Coordinates(_58c,_58b); -},realOffset:function(_58d){ -var _58e=0; -var _58f=0; -do{ -_58e+=_58d.scrollTop||0; -_58f+=_58d.scrollLeft||0; -_58d=_58d.parentNode; -}while(_58d); -return new MochiKit.Style.Coordinates(_58f,_58e); -},within:function(_590,x,y){ -if(this.includeScrollOffsets){ -return this.withinIncludingScrolloffsets(_590,x,y); -} -this.xcomp=x; -this.ycomp=y; -this.offset=this.cumulativeOffset(_590); -if(_590.style.position=="fixed"){ -this.offset.x+=this.windowOffset.x; -this.offset.y+=this.windowOffset.y; -} -return (y>=this.offset.y&&y=this.offset.x&&x=this.offset.y&&this.ycomp=this.offset.x&&this.xcomp"+el.innerHTML+""; -},_roundTopCorners:function(el,_5c2,_5c3){ -var _5c4=this._createCorner(_5c3); -for(var i=0;i=0;i--){ -_5c9.appendChild(this._createCornerSlice(_5c7,_5c8,i,"bottom")); -} -el.style.paddingBottom=0; -el.appendChild(_5c9); -},_createCorner:function(_5cb){ -var dom=MochiKit.DOM; -return dom.DIV({style:{backgroundColor:_5cb.toString()}}); -},_createCornerSlice:function(_5cd,_5ce,n,_5d0){ -var _5d1=MochiKit.DOM.SPAN(); -var _5d2=_5d1.style; -_5d2.backgroundColor=_5cd.toString(); -_5d2.display="block"; -_5d2.height="1px"; -_5d2.overflow="hidden"; -_5d2.fontSize="1px"; -var _5d3=this._borderColor(_5cd,_5ce); -if(this.options.border&&n===0){ -_5d2.borderTopStyle="solid"; -_5d2.borderTopWidth="1px"; -_5d2.borderLeftWidth="0px"; -_5d2.borderRightWidth="0px"; -_5d2.borderBottomWidth="0px"; -_5d2.height="0px"; -_5d2.borderColor=_5d3.toString(); -}else{ -if(_5d3){ -_5d2.borderColor=_5d3.toString(); -_5d2.borderStyle="solid"; -_5d2.borderWidth="0px 1px"; -} -} -if(!this.options.compact&&(n==(this.options.numSlices-1))){ -_5d2.height="2px"; -} -this._setMargin(_5d1,n,_5d0); -this._setBorder(_5d1,n,_5d0); -return _5d1; -},_setOptions:function(_5d4){ -this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false,__unstable__wrapElement:false}; -MochiKit.Base.update(this.options,_5d4); -this.options.numSlices=(this.options.compact?2:4); -},_whichSideTop:function(){ -var _5d5=this.options.corners; -if(this._hasString(_5d5,"all","top")){ -return ""; -} -var _5d6=(_5d5.indexOf("tl")!=-1); -var _5d7=(_5d5.indexOf("tr")!=-1); -if(_5d6&&_5d7){ -return ""; -} -if(_5d6){ -return "left"; -} -if(_5d7){ -return "right"; -} -return ""; -},_whichSideBottom:function(){ -var _5d8=this.options.corners; -if(this._hasString(_5d8,"all","bottom")){ -return ""; -} -var _5d9=(_5d8.indexOf("bl")!=-1); -var _5da=(_5d8.indexOf("br")!=-1); -if(_5d9&&_5da){ -return ""; -} -if(_5d9){ -return "left"; -} -if(_5da){ -return "right"; -} -return ""; -},_borderColor:function(_5db,_5dc){ -if(_5db=="transparent"){ -return _5dc; -}else{ -if(this.options.border){ -return this.options.border; -}else{ -if(this.options.blend){ -return _5dc.blendedColor(_5db); -} -} -} -return ""; -},_setMargin:function(el,n,_5df){ -var _5e0=this._marginSize(n)+"px"; -var _5e1=(_5df=="top"?this._whichSideTop():this._whichSideBottom()); -var _5e2=el.style; -if(_5e1=="left"){ -_5e2.marginLeft=_5e0; -_5e2.marginRight="0px"; -}else{ -if(_5e1=="right"){ -_5e2.marginRight=_5e0; -_5e2.marginLeft="0px"; -}else{ -_5e2.marginLeft=_5e0; -_5e2.marginRight=_5e0; -} -} -},_setBorder:function(el,n,_5e5){ -var _5e6=this._borderSize(n)+"px"; -var _5e7=(_5e5=="top"?this._whichSideTop():this._whichSideBottom()); -var _5e8=el.style; -if(_5e7=="left"){ -_5e8.borderLeftWidth=_5e6; -_5e8.borderRightWidth="0px"; -}else{ -if(_5e7=="right"){ -_5e8.borderRightWidth=_5e6; -_5e8.borderLeftWidth="0px"; -}else{ -_5e8.borderLeftWidth=_5e6; -_5e8.borderRightWidth=_5e6; -} -} -},_marginSize:function(n){ -if(this.isTransparent){ -return 0; -} -var o=this.options; -if(o.compact&&o.blend){ -var _5eb=[1,0]; -return _5eb[n]; -}else{ -if(o.compact){ -var _5ec=[2,1]; -return _5ec[n]; -}else{ -if(o.blend){ -var _5ed=[3,2,1,0]; -return _5ed[n]; -}else{ -var _5ee=[5,3,2,1]; -return _5ee[n]; -} -} -} -},_borderSize:function(n){ -var o=this.options; -var _5f1; -if(o.compact&&(o.blend||this.isTransparent)){ -return 1; -}else{ -if(o.compact){ -_5f1=[1,0]; -}else{ -if(o.blend){ -_5f1=[2,1,1,1]; -}else{ -if(o.border){ -_5f1=[0,2,0,0]; -}else{ -if(this.isTransparent){ -_5f1=[5,3,2,1]; -}else{ -return 0; -} -} -} -} -} -return _5f1[n]; -},_hasString:function(str){ -for(var i=1;i=(_61c||i)){ -_61c=i; -} -},this.effects); -_618=_61c||_618; -break; -case "break": -ma(function(e){ -e.finalize(); -},this.effects); -break; -} -_617.startOn+=_618; -_617.finishOn+=_618; -if(!_617.options.queue.limit||this.effects.length<_617.options.queue.limit){ -this.effects.push(_617); -} -if(!this.interval){ -this.interval=this.startLoop(MochiKit.Base.bind(this.loop,this),40); -} -},startLoop:function(func,_621){ -return setInterval(func,_621); -},remove:function(_622){ -this.effects=MochiKit.Base.filter(function(e){ -return e!=_622; -},this.effects); -if(!this.effects.length){ -this.stopLoop(this.interval); -this.interval=null; -} -},stopLoop:function(_624){ -clearInterval(_624); -},loop:function(){ -var _625=new Date().getTime(); -MochiKit.Base.map(function(_626){ -_626.loop(_625); -},this.effects); -}}); -MochiKit.Visual.Queues={instances:{},get:function(_627){ -if(typeof (_627)!="string"){ -return _627; -} -if(!this.instances[_627]){ -this.instances[_627]=new MochiKit.Visual.ScopedQueue(); -} -return this.instances[_627]; -}}; -MochiKit.Visual.Queue=MochiKit.Visual.Queues.get("global"); -MochiKit.Visual.DefaultOptions={transition:MochiKit.Visual.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"}; -MochiKit.Visual.Base=function(){ -}; -MochiKit.Visual.Base.prototype={__class__:MochiKit.Visual.Base,start:function(_628){ -var v=MochiKit.Visual; -this.options=MochiKit.Base.setdefault(_628||{},v.DefaultOptions); -this.currentFrame=0; -this.state="idle"; -this.startOn=this.options.delay*1000; -this.finishOn=this.startOn+(this.options.duration*1000); -this.event("beforeStart"); -if(!this.options.sync){ -v.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).add(this); -} -},loop:function(_62a){ -if(_62a>=this.startOn){ -if(_62a>=this.finishOn){ -return this.finalize(); -} -var pos=(_62a-this.startOn)/(this.finishOn-this.startOn); -var _62c=Math.round(pos*this.options.fps*this.options.duration); -if(_62c>this.currentFrame){ -this.render(pos); -this.currentFrame=_62c; -} -} -},render:function(pos){ -if(this.state=="idle"){ -this.state="running"; -this.event("beforeSetup"); -this.setup(); -this.event("afterSetup"); -} -if(this.state=="running"){ -if(this.options.transition){ -pos=this.options.transition(pos); -} -pos*=(this.options.to-this.options.from); -pos+=this.options.from; -this.event("beforeUpdate"); -this.update(pos); -this.event("afterUpdate"); -} -},cancel:function(){ -if(!this.options.sync){ -MochiKit.Visual.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).remove(this); -} -this.state="finished"; -},finalize:function(){ -this.render(1); -this.cancel(); -this.event("beforeFinish"); -this.finish(); -this.event("afterFinish"); -},setup:function(){ -},finish:function(){ -},update:function(_62e){ -},event:function(_62f){ -if(this.options[_62f+"Internal"]){ -this.options[_62f+"Internal"](this); -} -if(this.options[_62f]){ -this.options[_62f](this); -} -},repr:function(){ -return "["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"; -}}; -MochiKit.Visual.Parallel=function(_630,_631){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_630,_631); -} -this.__init__(_630,_631); -}; -MochiKit.Visual.Parallel.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Parallel.prototype,{__class__:MochiKit.Visual.Parallel,__init__:function(_633,_634){ -this.effects=_633||[]; -this.start(_634); -},update:function(_635){ -MochiKit.Base.map(function(_636){ -_636.render(_635); -},this.effects); -},finish:function(){ -MochiKit.Base.map(function(_637){ -_637.finalize(); -},this.effects); -}}); -MochiKit.Visual.Opacity=function(_638,_639){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_638,_639); -} -this.__init__(_638,_639); -}; -MochiKit.Visual.Opacity.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Opacity.prototype,{__class__:MochiKit.Visual.Opacity,__init__:function(_63b,_63c){ -var b=MochiKit.Base; -var s=MochiKit.Style; -this.element=MochiKit.DOM.getElement(_63b); -if(this.element.currentStyle&&(!this.element.currentStyle.hasLayout)){ -s.setStyle(this.element,{zoom:1}); -} -_63c=b.update({from:s.getStyle(this.element,"opacity")||0,to:1},_63c||{}); -this.start(_63c); -},update:function(_63f){ -MochiKit.Style.setStyle(this.element,{"opacity":_63f}); -}}); -MochiKit.Visual.Move=function(_640,_641){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_640,_641); -} -this.__init__(_640,_641); -}; -MochiKit.Visual.Move.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Move.prototype,{__class__:MochiKit.Visual.Move,__init__:function(_643,_644){ -this.element=MochiKit.DOM.getElement(_643); -_644=MochiKit.Base.update({x:0,y:0,mode:"relative"},_644||{}); -this.start(_644); -},setup:function(){ -MochiKit.DOM.makePositioned(this.element); -var s=this.element.style; -var _646=s.visibility; -var _647=s.display; -if(_647=="none"){ -s.visibility="hidden"; -s.display=""; -} -this.originalLeft=parseFloat(MochiKit.Style.getStyle(this.element,"left")||"0"); -this.originalTop=parseFloat(MochiKit.Style.getStyle(this.element,"top")||"0"); -if(this.options.mode=="absolute"){ -this.options.x-=this.originalLeft; -this.options.y-=this.originalTop; -} -if(_647=="none"){ -s.visibility=_646; -s.display=_647; -} -},update:function(_648){ -MochiKit.Style.setStyle(this.element,{left:Math.round(this.options.x*_648+this.originalLeft)+"px",top:Math.round(this.options.y*_648+this.originalTop)+"px"}); -}}); -MochiKit.Visual.Scale=function(_649,_64a,_64b){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_649,_64a,_64b); -} -this.__init__(_649,_64a,_64b); -}; -MochiKit.Visual.Scale.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Scale.prototype,{__class__:MochiKit.Visual.Scale,__init__:function(_64d,_64e,_64f){ -this.element=MochiKit.DOM.getElement(_64d); -_64f=MochiKit.Base.update({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_64e},_64f||{}); -this.start(_64f); -},setup:function(){ -this.restoreAfterFinish=this.options.restoreAfterFinish||false; -this.elementPositioning=MochiKit.Style.getStyle(this.element,"position"); -var ma=MochiKit.Base.map; -var b=MochiKit.Base.bind; -this.originalStyle={}; -ma(b(function(k){ -this.originalStyle[k]=this.element.style[k]; -},this),["top","left","width","height","fontSize"]); -this.originalTop=this.element.offsetTop; -this.originalLeft=this.element.offsetLeft; -var _653=MochiKit.Style.getStyle(this.element,"font-size")||"100%"; -ma(b(function(_654){ -if(_653.indexOf(_654)>0){ -this.fontSize=parseFloat(_653); -this.fontSizeType=_654; -} -},this),["em","px","%"]); -this.factor=(this.options.scaleTo-this.options.scaleFrom)/100; -if(/^content/.test(this.options.scaleMode)){ -this.dims=[this.element.scrollHeight,this.element.scrollWidth]; -}else{ -if(this.options.scaleMode=="box"){ -this.dims=[this.element.offsetHeight,this.element.offsetWidth]; -}else{ -this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]; -} -} -},update:function(_655){ -var _656=(this.options.scaleFrom/100)+(this.factor*_655); -if(this.options.scaleContent&&this.fontSize){ -MochiKit.Style.setStyle(this.element,{fontSize:this.fontSize*_656+this.fontSizeType}); -} -this.setDimensions(this.dims[0]*_656,this.dims[1]*_656); -},finish:function(){ -if(this.restoreAfterFinish){ -MochiKit.Style.setStyle(this.element,this.originalStyle); -} -},setDimensions:function(_657,_658){ -var d={}; -var r=Math.round; -if(/MSIE/.test(navigator.userAgent)){ -r=Math.ceil; -} -if(this.options.scaleX){ -d.width=r(_658)+"px"; -} -if(this.options.scaleY){ -d.height=r(_657)+"px"; -} -if(this.options.scaleFromCenter){ -var topd=(_657-this.dims[0])/2; -var _65c=(_658-this.dims[1])/2; -if(this.elementPositioning=="absolute"){ -if(this.options.scaleY){ -d.top=this.originalTop-topd+"px"; -} -if(this.options.scaleX){ -d.left=this.originalLeft-_65c+"px"; -} -}else{ -if(this.options.scaleY){ -d.top=-topd+"px"; -} -if(this.options.scaleX){ -d.left=-_65c+"px"; -} -} -} -MochiKit.Style.setStyle(this.element,d); -}}); -MochiKit.Visual.Highlight=function(_65d,_65e){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_65d,_65e); -} -this.__init__(_65d,_65e); -}; -MochiKit.Visual.Highlight.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Highlight.prototype,{__class__:MochiKit.Visual.Highlight,__init__:function(_660,_661){ -this.element=MochiKit.DOM.getElement(_660); -_661=MochiKit.Base.update({startcolor:"#ffff99"},_661||{}); -this.start(_661); -},setup:function(){ -var b=MochiKit.Base; -var s=MochiKit.Style; -if(s.getStyle(this.element,"display")=="none"){ -this.cancel(); -return; -} -this.oldStyle={backgroundImage:s.getStyle(this.element,"background-image")}; -s.setStyle(this.element,{backgroundImage:"none"}); -if(!this.options.endcolor){ -this.options.endcolor=MochiKit.Color.Color.fromBackground(this.element).toHexString(); -} -if(b.isUndefinedOrNull(this.options.restorecolor)){ -this.options.restorecolor=s.getStyle(this.element,"background-color"); -} -this._base=b.map(b.bind(function(i){ -return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16); -},this),[0,1,2]); -this._delta=b.map(b.bind(function(i){ -return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]; -},this),[0,1,2]); -},update:function(_666){ -var m="#"; -MochiKit.Base.map(MochiKit.Base.bind(function(i){ -m+=MochiKit.Color.toColorPart(Math.round(this._base[i]+this._delta[i]*_666)); -},this),[0,1,2]); -MochiKit.Style.setStyle(this.element,{backgroundColor:m}); -},finish:function(){ -MochiKit.Style.setStyle(this.element,MochiKit.Base.update(this.oldStyle,{backgroundColor:this.options.restorecolor})); -}}); -MochiKit.Visual.ScrollTo=function(_669,_66a){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_669,_66a); -} -this.__init__(_669,_66a); -}; -MochiKit.Visual.ScrollTo.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.ScrollTo.prototype,{__class__:MochiKit.Visual.ScrollTo,__init__:function(_66c,_66d){ -this.element=MochiKit.DOM.getElement(_66c); -this.start(_66d||{}); -},setup:function(){ -var p=MochiKit.Position; -p.prepare(); -var _66f=p.cumulativeOffset(this.element); -if(this.options.offset){ -_66f.y+=this.options.offset; -} -var max; -if(window.innerHeight){ -max=window.innerHeight-window.height; -}else{ -if(document.documentElement&&document.documentElement.clientHeight){ -max=document.documentElement.clientHeight-document.body.scrollHeight; -}else{ -if(document.body){ -max=document.body.clientHeight-document.body.scrollHeight; -} -} -} -this.scrollStart=p.windowOffset.y; -this.delta=(_66f.y>max?max:_66f.y)-this.scrollStart; -},update:function(_671){ -var p=MochiKit.Position; -p.prepare(); -window.scrollTo(p.windowOffset.x,this.scrollStart+(_671*this.delta)); -}}); -MochiKit.Visual.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; -MochiKit.Visual.Morph=function(_673,_674){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_673,_674); -} -this.__init__(_673,_674); -}; -MochiKit.Visual.Morph.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Morph.prototype,{__class__:MochiKit.Visual.Morph,__init__:function(_676,_677){ -this.element=MochiKit.DOM.getElement(_676); -this.start(_677||{}); -},setup:function(){ -var b=MochiKit.Base; -var _679=this.options.style; -this.styleStart={}; -this.styleEnd={}; -this.units={}; -var _67a,unit; -for(var s in _679){ -_67a=_679[s]; -s=b.camelize(s); -if(MochiKit.Visual.CSS_LENGTH.test(_67a)){ -var _67d=_67a.match(/^([\+\-]?[0-9\.]+)(.*)$/); -_67a=parseFloat(_67d[1]); -unit=(_67d.length==3)?_67d[2]:null; -this.styleEnd[s]=_67a; -this.units[s]=unit; -_67a=MochiKit.Style.getStyle(this.element,s); -_67d=_67a.match(/^([\+\-]?[0-9\.]+)(.*)$/); -_67a=parseFloat(_67d[1]); -this.styleStart[s]=_67a; -}else{ -var c=MochiKit.Color.Color; -_67a=c.fromString(_67a); -if(_67a){ -this.units[s]="color"; -this.styleEnd[s]=_67a.toHexString(); -_67a=MochiKit.Style.getStyle(this.element,s); -this.styleStart[s]=c.fromString(_67a).toHexString(); -this.styleStart[s]=b.map(b.bind(function(i){ -return parseInt(this.styleStart[s].slice(i*2+1,i*2+3),16); -},this),[0,1,2]); -this.styleEnd[s]=b.map(b.bind(function(i){ -return parseInt(this.styleEnd[s].slice(i*2+1,i*2+3),16); -},this),[0,1,2]); -} -} -} -},update:function(_681){ -var _682; -for(var s in this.styleStart){ -if(this.units[s]=="color"){ -var m="#"; -var _685=this.styleStart[s]; -var end=this.styleEnd[s]; -MochiKit.Base.map(MochiKit.Base.bind(function(i){ -m+=MochiKit.Color.toColorPart(Math.round(_685[i]+(end[i]-_685[i])*_681)); -},this),[0,1,2]); -this.element.style[s]=m; -}else{ -_682=this.styleStart[s]+Math.round((this.styleEnd[s]-this.styleStart[s])*_681*1000)/1000+this.units[s]; -this.element.style[s]=_682; -} -} -}}); -MochiKit.Visual.fade=function(_688,_689){ -var s=MochiKit.Style; -var _68b=s.getStyle(_688,"opacity"); -_689=MochiKit.Base.update({from:s.getStyle(_688,"opacity")||1,to:0,afterFinishInternal:function(_68c){ -if(_68c.options.to!==0){ -return; -} -s.hideElement(_68c.element); -s.setStyle(_68c.element,{"opacity":_68b}); -}},_689||{}); -return new MochiKit.Visual.Opacity(_688,_689); -}; -MochiKit.Visual.appear=function(_68d,_68e){ -var s=MochiKit.Style; -var v=MochiKit.Visual; -_68e=MochiKit.Base.update({from:(s.getStyle(_68d,"display")=="none"?0:s.getStyle(_68d,"opacity")||0),to:1,afterFinishInternal:function(_691){ -v.forceRerendering(_691.element); -},beforeSetupInternal:function(_692){ -s.setStyle(_692.element,{"opacity":_692.options.from}); -s.showElement(_692.element); -}},_68e||{}); -return new v.Opacity(_68d,_68e); -}; -MochiKit.Visual.puff=function(_693,_694){ -var s=MochiKit.Style; -var v=MochiKit.Visual; -_693=MochiKit.DOM.getElement(_693); -var _697={position:s.getStyle(_693,"position"),top:_693.style.top,left:_693.style.left,width:_693.style.width,height:_693.style.height,opacity:s.getStyle(_693,"opacity")}; -_694=MochiKit.Base.update({beforeSetupInternal:function(_698){ -MochiKit.Position.absolutize(_698.effects[0].element); -},afterFinishInternal:function(_699){ -s.hideElement(_699.effects[0].element); -s.setStyle(_699.effects[0].element,_697); -},scaleContent:true,scaleFromCenter:true},_694||{}); -return new v.Parallel([new v.Scale(_693,200,{sync:true,scaleFromCenter:_694.scaleFromCenter,scaleContent:_694.scaleContent,restoreAfterFinish:true}),new v.Opacity(_693,{sync:true,to:0})],_694); -}; -MochiKit.Visual.blindUp=function(_69a,_69b){ -var d=MochiKit.DOM; -_69a=d.getElement(_69a); -var _69d=d.makeClipping(_69a); -_69b=MochiKit.Base.update({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_69e){ -MochiKit.Style.hideElement(_69e.element); -d.undoClipping(_69e.element,_69d); -}},_69b||{}); -return new MochiKit.Visual.Scale(_69a,0,_69b); -}; -MochiKit.Visual.blindDown=function(_69f,_6a0){ -var d=MochiKit.DOM; -var s=MochiKit.Style; -_69f=d.getElement(_69f); -var _6a3=s.getElementDimensions(_69f); -var _6a4; -_6a0=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_6a3.h,originalWidth:_6a3.w},restoreAfterFinish:true,afterSetupInternal:function(_6a5){ -_6a4=d.makeClipping(_6a5.element); -s.setStyle(_6a5.element,{height:"0px"}); -s.showElement(_6a5.element); -},afterFinishInternal:function(_6a6){ -d.undoClipping(_6a6.element,_6a4); -}},_6a0||{}); -return new MochiKit.Visual.Scale(_69f,100,_6a0); -}; -MochiKit.Visual.switchOff=function(_6a7,_6a8){ -var d=MochiKit.DOM; -_6a7=d.getElement(_6a7); -var _6aa=MochiKit.Style.getStyle(_6a7,"opacity"); -var _6ab; -_6a8=MochiKit.Base.update({duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetupInternal:function(_6ac){ -d.makePositioned(_6ac.element); -_6ab=d.makeClipping(_6ac.element); -},afterFinishInternal:function(_6ad){ -MochiKit.Style.hideElement(_6ad.element); -d.undoClipping(_6ad.element,_6ab); -d.undoPositioned(_6ad.element); -MochiKit.Style.setStyle(_6ad.element,{"opacity":_6aa}); -}},_6a8||{}); -var v=MochiKit.Visual; -return new v.appear(_6a7,{duration:0.4,from:0,transition:v.Transitions.flicker,afterFinishInternal:function(_6af){ -new v.Scale(_6af.element,1,_6a8); -}}); -}; -MochiKit.Visual.dropOut=function(_6b0,_6b1){ -var d=MochiKit.DOM; -var s=MochiKit.Style; -_6b0=d.getElement(_6b0); -var _6b4={top:s.getStyle(_6b0,"top"),left:s.getStyle(_6b0,"left"),opacity:s.getStyle(_6b0,"opacity")}; -_6b1=MochiKit.Base.update({duration:0.5,distance:100,beforeSetupInternal:function(_6b5){ -d.makePositioned(_6b5.effects[0].element); -},afterFinishInternal:function(_6b6){ -s.hideElement(_6b6.effects[0].element); -d.undoPositioned(_6b6.effects[0].element); -s.setStyle(_6b6.effects[0].element,_6b4); -}},_6b1||{}); -var v=MochiKit.Visual; -return new v.Parallel([new v.Move(_6b0,{x:0,y:_6b1.distance,sync:true}),new v.Opacity(_6b0,{sync:true,to:0})],_6b1); -}; -MochiKit.Visual.shake=function(_6b8,_6b9){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_6b8=d.getElement(_6b8); -_6b9=MochiKit.Base.update({x:-20,y:0,duration:0.05,afterFinishInternal:function(_6bd){ -d.undoPositioned(_6bd.element); -s.setStyle(_6bd.element,_6be); -}},_6b9||{}); -var _6be={top:s.getStyle(_6b8,"top"),left:s.getStyle(_6b8,"left")}; -return new v.Move(_6b8,{x:20,y:0,duration:0.05,afterFinishInternal:function(_6bf){ -new v.Move(_6bf.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_6c0){ -new v.Move(_6c0.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_6c1){ -new v.Move(_6c1.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_6c2){ -new v.Move(_6c2.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_6c3){ -new v.Move(_6c3.element,_6b9); -}}); -}}); -}}); -}}); -}}); -}; -MochiKit.Visual.slideDown=function(_6c4,_6c5){ -var d=MochiKit.DOM; -var b=MochiKit.Base; -var s=MochiKit.Style; -_6c4=d.getElement(_6c4); -if(!_6c4.firstChild){ -throw "MochiKit.Visual.slideDown must be used on a element with a child"; -} -d.removeEmptyTextNodes(_6c4); -var _6c9=s.getStyle(_6c4.firstChild,"bottom")||0; -var _6ca=s.getElementDimensions(_6c4); -var _6cb; -_6c5=b.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_6ca.h,originalWidth:_6ca.w},restoreAfterFinish:true,afterSetupInternal:function(_6cc){ -d.makePositioned(_6cc.element); -d.makePositioned(_6cc.element.firstChild); -if(/Opera/.test(navigator.userAgent)){ -s.setStyle(_6cc.element,{top:""}); -} -_6cb=d.makeClipping(_6cc.element); -s.setStyle(_6cc.element,{height:"0px"}); -s.showElement(_6cc.element); -},afterUpdateInternal:function(_6cd){ -s.setStyle(_6cd.element.firstChild,{bottom:(_6cd.dims[0]-_6cd.element.clientHeight)+"px"}); -},afterFinishInternal:function(_6ce){ -d.undoClipping(_6ce.element,_6cb); -if(/MSIE/.test(navigator.userAgent)){ -d.undoPositioned(_6ce.element); -d.undoPositioned(_6ce.element.firstChild); -}else{ -d.undoPositioned(_6ce.element.firstChild); -d.undoPositioned(_6ce.element); -} -s.setStyle(_6ce.element.firstChild,{bottom:_6c9}); -}},_6c5||{}); -return new MochiKit.Visual.Scale(_6c4,100,_6c5); -}; -MochiKit.Visual.slideUp=function(_6cf,_6d0){ -var d=MochiKit.DOM; -var b=MochiKit.Base; -var s=MochiKit.Style; -_6cf=d.getElement(_6cf); -if(!_6cf.firstChild){ -throw "MochiKit.Visual.slideUp must be used on a element with a child"; -} -d.removeEmptyTextNodes(_6cf); -var _6d4=s.getStyle(_6cf.firstChild,"bottom"); -var _6d5; -_6d0=b.update({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_6d6){ -d.makePositioned(_6d6.element); -d.makePositioned(_6d6.element.firstChild); -if(/Opera/.test(navigator.userAgent)){ -s.setStyle(_6d6.element,{top:""}); -} -_6d5=d.makeClipping(_6d6.element); -s.showElement(_6d6.element); -},afterUpdateInternal:function(_6d7){ -s.setStyle(_6d7.element.firstChild,{bottom:(_6d7.dims[0]-_6d7.element.clientHeight)+"px"}); -},afterFinishInternal:function(_6d8){ -s.hideElement(_6d8.element); -d.undoClipping(_6d8.element,_6d5); -d.undoPositioned(_6d8.element.firstChild); -d.undoPositioned(_6d8.element); -s.setStyle(_6d8.element.firstChild,{bottom:_6d4}); -}},_6d0||{}); -return new MochiKit.Visual.Scale(_6cf,0,_6d0); -}; -MochiKit.Visual.squish=function(_6d9,_6da){ -var d=MochiKit.DOM; -var b=MochiKit.Base; -var _6dd; -_6da=b.update({restoreAfterFinish:true,beforeSetupInternal:function(_6de){ -_6dd=d.makeClipping(_6de.element); -},afterFinishInternal:function(_6df){ -MochiKit.Style.hideElement(_6df.element); -d.undoClipping(_6df.element,_6dd); -}},_6da||{}); -return new MochiKit.Visual.Scale(_6d9,/Opera/.test(navigator.userAgent)?1:0,_6da); -}; -MochiKit.Visual.grow=function(_6e0,_6e1){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_6e0=d.getElement(_6e0); -_6e1=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.full,scaleContent:true,scaleFromCenter:false},_6e1||{}); -var _6e5={top:_6e0.style.top,left:_6e0.style.left,height:_6e0.style.height,width:_6e0.style.width,opacity:s.getStyle(_6e0,"opacity")}; -var dims=s.getElementDimensions(_6e0); -var _6e7,_6e8; -var _6e9,_6ea; -switch(_6e1.direction){ -case "top-left": -_6e7=_6e8=_6e9=_6ea=0; -break; -case "top-right": -_6e7=dims.w; -_6e8=_6ea=0; -_6e9=-dims.w; -break; -case "bottom-left": -_6e7=_6e9=0; -_6e8=dims.h; -_6ea=-dims.h; -break; -case "bottom-right": -_6e7=dims.w; -_6e8=dims.h; -_6e9=-dims.w; -_6ea=-dims.h; -break; -case "center": -_6e7=dims.w/2; -_6e8=dims.h/2; -_6e9=-dims.w/2; -_6ea=-dims.h/2; -break; -} -var _6eb=MochiKit.Base.update({beforeSetupInternal:function(_6ec){ -s.setStyle(_6ec.effects[0].element,{height:"0px"}); -s.showElement(_6ec.effects[0].element); -},afterFinishInternal:function(_6ed){ -d.undoClipping(_6ed.effects[0].element); -d.undoPositioned(_6ed.effects[0].element); -s.setStyle(_6ed.effects[0].element,_6e5); -}},_6e1||{}); -return new v.Move(_6e0,{x:_6e7,y:_6e8,duration:0.01,beforeSetupInternal:function(_6ee){ -s.hideElement(_6ee.element); -d.makeClipping(_6ee.element); -d.makePositioned(_6ee.element); -},afterFinishInternal:function(_6ef){ -new v.Parallel([new v.Opacity(_6ef.element,{sync:true,to:1,from:0,transition:_6e1.opacityTransition}),new v.Move(_6ef.element,{x:_6e9,y:_6ea,sync:true,transition:_6e1.moveTransition}),new v.Scale(_6ef.element,100,{scaleMode:{originalHeight:dims.h,originalWidth:dims.w},sync:true,scaleFrom:/Opera/.test(navigator.userAgent)?1:0,transition:_6e1.scaleTransition,scaleContent:_6e1.scaleContent,scaleFromCenter:_6e1.scaleFromCenter,restoreAfterFinish:true})],_6eb); -}}); -}; -MochiKit.Visual.shrink=function(_6f0,_6f1){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_6f0=d.getElement(_6f0); -_6f1=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.none,scaleContent:true,scaleFromCenter:false},_6f1||{}); -var _6f5={top:_6f0.style.top,left:_6f0.style.left,height:_6f0.style.height,width:_6f0.style.width,opacity:s.getStyle(_6f0,"opacity")}; -var dims=s.getElementDimensions(_6f0); -var _6f7,_6f8; -switch(_6f1.direction){ -case "top-left": -_6f7=_6f8=0; -break; -case "top-right": -_6f7=dims.w; -_6f8=0; -break; -case "bottom-left": -_6f7=0; -_6f8=dims.h; -break; -case "bottom-right": -_6f7=dims.w; -_6f8=dims.h; -break; -case "center": -_6f7=dims.w/2; -_6f8=dims.h/2; -break; -} -var _6f9; -var _6fa=MochiKit.Base.update({beforeStartInternal:function(_6fb){ -_6f9=d.makePositioned(_6fb.effects[0].element); -d.makeClipping(_6fb.effects[0].element); -},afterFinishInternal:function(_6fc){ -s.hideElement(_6fc.effects[0].element); -d.undoClipping(_6fc.effects[0].element,_6f9); -d.undoPositioned(_6fc.effects[0].element); -s.setStyle(_6fc.effects[0].element,_6f5); -}},_6f1||{}); -return new v.Parallel([new v.Opacity(_6f0,{sync:true,to:0,from:1,transition:_6f1.opacityTransition}),new v.Scale(_6f0,/Opera/.test(navigator.userAgent)?1:0,{sync:true,transition:_6f1.scaleTransition,scaleContent:_6f1.scaleContent,scaleFromCenter:_6f1.scaleFromCenter,restoreAfterFinish:true}),new v.Move(_6f0,{x:_6f7,y:_6f8,sync:true,transition:_6f1.moveTransition})],_6fa); -}; -MochiKit.Visual.pulsate=function(_6fd,_6fe){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var b=MochiKit.Base; -var _702=MochiKit.Style.getStyle(_6fd,"opacity"); -_6fe=b.update({duration:3,from:0,afterFinishInternal:function(_703){ -MochiKit.Style.setStyle(_703.element,{"opacity":_702}); -}},_6fe||{}); -var _704=_6fe.transition||v.Transitions.sinoidal; -var _705=b.bind(function(pos){ -return _704(1-v.Transitions.pulse(pos,_6fe.pulses)); -},_704); -b.bind(_705,_704); -return new v.Opacity(_6fd,b.update({transition:_705},_6fe)); -}; -MochiKit.Visual.fold=function(_707,_708){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_707=d.getElement(_707); -var _70c={top:_707.style.top,left:_707.style.left,width:_707.style.width,height:_707.style.height}; -var _70d=d.makeClipping(_707); -_708=MochiKit.Base.update({scaleContent:false,scaleX:false,afterFinishInternal:function(_70e){ -new v.Scale(_707,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_70f){ -s.hideElement(_70f.element); -d.undoClipping(_70f.element,_70d); -s.setStyle(_70f.element,_70c); -}}); -}},_708||{}); -return new v.Scale(_707,5,_708); -}; -MochiKit.Visual.Color=MochiKit.Color.Color; -MochiKit.Visual.getElementsComputedStyle=MochiKit.DOM.computedStyle; -MochiKit.Visual.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -MochiKit.Visual.EXPORT=["roundElement","roundClass","tagifyText","multiple","toggle","Parallel","Opacity","Move","Scale","Highlight","ScrollTo","Morph","fade","appear","puff","blindUp","blindDown","switchOff","dropOut","shake","slideDown","slideUp","squish","grow","shrink","pulsate","fold"]; -MochiKit.Visual.EXPORT_OK=["Base","PAIRS"]; -MochiKit.Visual.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Visual); -if(typeof (MochiKit)=="undefined"){ -MochiKit={}; -} -if(typeof (MochiKit.MochiKit)=="undefined"){ -MochiKit.MochiKit={}; -} -MochiKit.MochiKit.NAME="MochiKit.MochiKit"; -MochiKit.MochiKit.VERSION="1.4"; -MochiKit.MochiKit.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.MochiKit.toString=function(){ -return this.__repr__(); -}; -MochiKit.MochiKit.SUBMODULES=["Base","Iter","Logging","DateTime","Format","Async","DOM","Selector","Style","LoggingPane","Color","Signal","Position","Visual"]; -if(typeof (JSAN)!="undefined"||typeof (dojo)!="undefined"){ -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.MochiKit"); -dojo.require("MochiKit.*"); -} -if(typeof (JSAN)!="undefined"){ -(function(lst){ -for(var i=0;i"); -} -} -})(); -} - - -/*** - - PlotKit.PlotKit 0.9.1 : PACKED VERSION - - THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please - diff against the source tree, not this file. - - For more information, . - - Copyright (c) 2006. Alastair Tse. - -***/ - -try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"||typeof (MochiKit.Format)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format}"; -} -MochiKit.Base.update(MochiKit.Color.Color.prototype,{asFillColor:function(){ -return this.lighterColorWithLevel(0.3); -},asStrokeColor:function(){ -return this.darkerColorWithLevel(0.1); -},asPointColor:function(){ -return this.lighterColorWithLevel(0.1); -}}); -if(typeof (PlotKit)=="undefined"){ -PlotKit={}; -} -PlotKit.NAME="PlotKit"; -PlotKit.VERSION="0.8"; -PlotKit.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.toString=function(){ -return this.__repr__(); -}; -if(typeof (PlotKit.Base)=="undefined"){ -PlotKit.Base={}; -} -PlotKit.Base.NAME="PlotKit.Base"; -PlotKit.Base.VERSION=PlotKit.VERSION; -PlotKit.Base.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.Base.toString=function(){ -return this.__repr__(); -}; -PlotKit.Base.usingPrototype=function(){ -try{ -return (typeof (Object.extend)=="function"); -} -catch(e){ -return false; -} -}; -MochiKit.Base.update(PlotKit.Base,{roundInterval:function(_1,_2,_3){ -var _4=MochiKit.Format.roundToFixed; -var _5=_1/_2; -return parseFloat(_4(_5,_3)); -},collapse:function(_6){ -var m=MochiKit.Base; -var _8=new Array(); -for(var i=0;i<_6.length;i++){ -_8=m.concat(_8,_6[i]); -} -if(PlotKit.Base.usingPrototype()){ -delete _8.extend; -delete _8.from; -delete _8.inspect; -} -return _8; -},uniq:function(_10){ -var m=MochiKit.Base; -if(!m.isArrayLike(_10)||(_10.length<1)){ -return new Array(); -} -var _11=new Array(); -var _12=_10[0]; -_11.push(_10[0]); -for(var i=1;i<_10.length;i++){ -if(m.compare(_10[i],_12)!=0){ -_12=_10[i]; -_11.push(_10[i]); -} -} -return _11; -},colorScheme:function(){ -var mb=MochiKit.Base; -var mc=MochiKit.Color; -var _15=["red","orange","yellow","green","cyan","blue","purple","magenta"]; -var _16=function(_17){ -return mc.Color[_17+"Color"](); -}; -return mb.map(_16,_15); -},baseDarkPrimaryColors:function(){ -var _18=MochiKit.Color.Color.fromHexString; -return [_18("#ad3f40"),_18("#ddac2c"),_18("#dfdd0c"),_18("#5276c4"),_18("#739c5a")]; -},basePrimaryColors:function(){ -var _19=MochiKit.Color.Color.fromHexString; -return [_19("#d24c4d"),_19("#f2b32f"),_19("#ece90e"),_19("#5d83da"),_19("#78a15d")]; -},baseBlueColors:function(){ -var _20=MochiKit.Color.Color.fromHexString; -return [_20("#4b6b94"),_20("#5d81b4"),_20("#acbad2")]; -},palette:function(_21,_22,_23,_24){ -var _25=MochiKit.Base.isUndefinedOrNull; -var _26=new Array(); -if(_25(_24)){ -_24=0.1; -} -if(_25(_23)){ -_23=0.4; -} -if(_25(_22)){ -_22=-0.2; -} -var _27=_22; -while(_27<=_23){ -_26.push(_27); -_27+=_24; -} -var _28=function(_29,_30){ -return _29.lighterColorWithLevel(_30); -}; -return MochiKit.Base.map(partial(_28,_21),_26); -},excanvasSupported:function(){ -if(/MSIE/.test(navigator.userAgent)&&!window.opera){ -return true; -} -return false; -},findPosX:function(obj){ -var _32=0; -if(obj.offsetParent){ -while(obj.offsetParent){ -_32+=obj.offsetLeft; -obj=obj.offsetParent; -} -}else{ -if(obj.x){ -_32+=obj.x; -} -} -return _32; -},findPosY:function(obj){ -var _33=0; -if(obj.offsetParent){ -while(obj.offsetParent){ -_33+=obj.offsetTop; -obj=obj.offsetParent; -} -}else{ -if(obj.y){ -_33+=obj.y; -} -} -return _33; -},isFuncLike:function(obj){ -return (typeof (obj)=="function"); -}}); -PlotKit.Base.map=function(fn,lst){ -if(PlotKit.Base.usingPrototype()){ -var _36=[]; -for(var x in lst){ -if(typeof (lst[x])=="function"){ -continue; -} -_36.push(fn(lst[x])); -} -return _36; -}else{ -return MochiKit.Base.map(fn,lst); -} -}; -PlotKit.Base.items=function(lst){ -if(PlotKit.Base.usingPrototype()){ -var _38=[]; -for(var x in lst){ -if(typeof (lst[x])=="function"){ -continue; -} -_38.push([x,lst[x]]); -} -return _38; -}else{ -return MochiKit.Base.items(lst); -} -}; -PlotKit.Base.keys=function(lst){ -if(PlotKit.Base.usingPrototype()){ -var _39=[]; -for(var x in lst){ -if(typeof (lst[x])=="function"){ -continue; -} -_39.push(x); -} -return _39; -}else{ -return MochiKit.Base.keys(lst); -} -}; -PlotKit.Base.baseColors=function(){ -var _40=MochiKit.Color.Color.fromHexString; -return [_40("#476fb2"),_40("#be2c2b"),_40("#85b730"),_40("#734a99"),_40("#26a1c5"),_40("#fb8707"),_40("#000000")]; -}; -PlotKit.Base.officeBaseStyle={"axisLineWidth":2,"axisLabelColor":Color.grayColor(),"axisLineColor":Color.whiteColor(),"padding":{top:5,bottom:10,left:30,right:30}}; -MochiKit.Base.update(PlotKit.Base,{officeBlue:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"backgroundColor":PlotKit.Base.baseColors()[0].lighterColorWithLevel(0.45)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeRed:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"backgroundColor":PlotKit.Base.baseColors()[1].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeGreen:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[2]),"backgroundColor":PlotKit.Base.baseColors()[2].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officePurple:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[3]),"backgroundColor":PlotKit.Base.baseColors()[3].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeCyan:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[4]),"backgroundColor":PlotKit.Base.baseColors()[4].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeOrange:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[5]),"backgroundColor":PlotKit.Base.baseColors()[5].lighterColorWithLevel(0.4)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeBlack:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[6],0,0.6),"backgroundColor":PlotKit.Base.baseColors()[6].lighterColorWithLevel(0.9)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -}}); -PlotKit.Base.EXPORT=["baseColors","collapse","colorScheme","findPosX","findPosY","officeBaseStyle","officeBlue","officeRed","officeGreen","officePurple","officeCyan","officeOrange","officeBlack","roundInterval","uniq","isFuncLike","excanvasSupported"]; -PlotKit.Base.EXPORT_OK=[]; -PlotKit.Base.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.Base.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.Base); -try{ -if(typeof (PlotKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Base"; -} -if(typeof (PlotKit.Layout)=="undefined"){ -PlotKit.Layout={}; -} -PlotKit.Layout.NAME="PlotKit.Layout"; -PlotKit.Layout.VERSION=PlotKit.VERSION; -PlotKit.Layout.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.Layout.toString=function(){ -return this.__repr__(); -}; -PlotKit.Layout.valid_styles=["bar","line","pie","point"]; -PlotKit.Layout=function(_42,_43){ -this.options={"barWidthFillFraction":0.75,"barOrientation":"vertical","xOriginIsZero":true,"yOriginIsZero":true,"xAxis":null,"yAxis":null,"xTicks":null,"yTicks":null,"xNumberOfTicks":10,"yNumberOfTicks":5,"xTickPrecision":1,"yTickPrecision":1,"pieRadius":0.4}; -this.style=_42; -MochiKit.Base.update(this.options,_43?_43:{}); -if(!MochiKit.Base.isUndefinedOrNull(this.options.xAxis)){ -this.minxval=this.options.xAxis[0]; -this.maxxval=this.options.xAxis[1]; -this.xscale=this.maxxval-this.minxval; -}else{ -this.minxval=0; -this.maxxval=null; -this.xscale=null; -} -if(!MochiKit.Base.isUndefinedOrNull(this.options.yAxis)){ -this.minyval=this.options.yAxis[0]; -this.maxyval=this.options.yAxis[1]; -this.yscale=this.maxyval-this.minyval; -}else{ -this.minyval=0; -this.maxyval=null; -this.yscale=null; -} -this.bars=new Array(); -this.points=new Array(); -this.slices=new Array(); -this.xticks=new Array(); -this.yticks=new Array(); -this.datasets=new Array(); -this.minxdelta=0; -this.xrange=1; -this.yrange=1; -this.hitTestCache={x2maxy:null}; -}; -PlotKit.Layout.prototype.addDataset=function(_44,_45){ -this.datasets[_44]=_45; -}; -PlotKit.Layout.prototype.removeDataset=function(_46,_47){ -delete this.datasets[_46]; -}; -PlotKit.Layout.prototype.addDatasetFromTable=function(_48,_49,_50,_51,_52){ -var _53=MochiKit.Base.isUndefinedOrNull; -var _54=MochiKit.DOM.scrapeText; -var _55=MochiKit.Format.strip; -if(_53(_50)){ -_50=0; -} -if(_53(_51)){ -_51=1; -} -if(_53(_52)){ -_52=-1; -} -var _56=_49.tBodies[0].rows; -var _57=new Array(); -var _58=new Array(); -if(!_53(_56)){ -for(var i=0;i<_56.length;i++){ -_57.push([parseFloat(_55(_54(_56[i].cells[_50]))),parseFloat(_55(_54(_56[i].cells[_51])))]); -if(_52>=0){ -_58.push({v:parseFloat(_55(_54(_56[i].cells[_50]))),label:_55(_54(_56[i].cells[_52]))}); -} -} -this.addDataset(_48,_57); -if(_52>=0){ -this.options.xTicks=_58; -} -return true; -} -return false; -}; -PlotKit.Layout.prototype.evaluate=function(){ -this._evaluateLimits(); -this._evaluateScales(); -if(this.style=="bar"){ -if(this.options.barOrientation=="horizontal"){ -this._evaluateHorizBarCharts(); -}else{ -this._evaluateBarCharts(); -} -this._evaluateBarTicks(); -}else{ -if(this.style=="line"){ -this._evaluateLineCharts(); -this._evaluateLineTicks(); -}else{ -if(this.style=="pie"){ -this._evaluatePieCharts(); -this._evaluatePieTicks(); -} -} -} -}; -PlotKit.Layout.prototype.hitTest=function(x,y){ -var f=MochiKit.Format.twoDigitFloat; -if((this.style=="bar")&&this.bars&&(this.bars.length>0)){ -for(var i=0;i=bar.x)&&(x<=bar.x+bar.w)&&(y>=bar.y)&&(y-bar.y<=bar.h)){ -return bar; -} -} -}else{ -if(this.style=="line"){ -if(this.hitTestCache.x2maxy==null){ -this._regenerateHitTestCache(); -} -var _62=x/this.xscale; -var _63=this.hitTestCache.xvalues; -var _64=null; -var _65=null; -for(var i=1;i<_63.length;i++){ -if(_63[i]>_62){ -_64=_63[i-1]; -_65=_63[i]; -break; -} -} -if((_64!=null)){ -var _66=this.hitTestCache.x2maxy[_64]; -var _67=this.hitTestCache.x2maxy[_65]; -var _68=(1-y)/this.yscale; -var _69=(_67-_66)/(_65-_64); -var _70=_66+_69*(_62-_64); -if(_70>=_68){ -var obj={xval:_62,yval:_68,xafter:_65,yafter:_67,xbefore:_64,ybefore:_66,yprojected:_70}; -return obj; -} -} -}else{ -if(this.style=="pie"){ -var _71=Math.sqrt((y-0.5)*(y-0.5)+(x-0.5)*(x-0.5)); -if(_71>this.options.pieRadius){ -return null; -} -var _72=Math.atan2(y-0.5,x-0.5)-Math.PI/2; -for(var i=0;i=_72){ -return _73; -} -} -} -} -} -return null; -}; -PlotKit.Layout.prototype.rectForX=function(x){ -return null; -}; -PlotKit.Layout.prototype.angleRangeForX=function(x){ -return null; -}; -PlotKit.Layout.prototype._evaluateLimits=function(){ -var map=PlotKit.Base.map; -var _75=PlotKit.Base.items; -var _76=MochiKit.Base.itemgetter; -var _77=PlotKit.Base.collapse; -var _78=MochiKit.Base.listMin; -var _79=MochiKit.Base.listMax; -var _80=MochiKit.Base.isUndefinedOrNull; -var all=_77(map(_76(1),_75(this.datasets))); -if(_80(this.options.xAxis)){ -if(this.options.xOriginIsZero){ -this.minxval=0; -}else{ -this.minxval=_78(map(parseFloat,map(_76(0),all))); -} -this.maxxval=_79(map(parseFloat,map(_76(0),all))); -}else{ -this.minxval=this.options.xAxis[0]; -this.maxxval=this.options.xAxis[1]; -this.xscale=this.maxval-this.minxval; -} -if(_80(this.options.yAxis)){ -if(this.options.yOriginIsZero){ -this.minyval=0; -}else{ -this.minyval=_78(map(parseFloat,map(_76(1),all))); -} -this.maxyval=_79(map(parseFloat,map(_76(1),all))); -}else{ -this.minyval=this.options.yAxis[0]; -this.maxyval=this.options.yAxis[1]; -this.yscale=this.maxyval-this.minyval; -} -}; -PlotKit.Layout.prototype._evaluateScales=function(){ -var _82=MochiKit.Base.isUndefinedOrNull; -this.xrange=this.maxxval-this.minxval; -if(this.xrange==0){ -this.xscale=1; -}else{ -this.xscale=1/this.xrange; -} -this.yrange=this.maxyval-this.minyval; -if(this.yrange==0){ -this.yscale=1; -}else{ -this.yscale=1/this.yrange; -} -}; -PlotKit.Layout.prototype._uniqueXValues=function(){ -var _83=PlotKit.Base.collapse; -var map=PlotKit.Base.map; -var _84=PlotKit.Base.uniq; -var _85=MochiKit.Base.itemgetter; -var _86=PlotKit.Base.items; -var _87=map(parseFloat,map(_85(0),_83(map(_85(1),_86(this.datasets))))); -_87.sort(MochiKit.Base.compare); -return _84(_87); -}; -PlotKit.Layout.prototype._evaluateBarCharts=function(){ -var _88=PlotKit.Base.items; -var _89=_88(this.datasets).length; -var _90=10000000; -var _91=this._uniqueXValues(); -for(var i=1;i<_91.length;i++){ -_90=Math.min(Math.abs(_91[i]-_91[i-1]),_90); -} -var _92=0; -var _93=0; -var _94=0; -if(_91.length==1){ -_90=1; -this.xscale=1; -this.minxval=_91[0]; -_92=1*this.options.barWidthFillFraction; -_93=_92/_89; -_94=(1-this.options.barWidthFillFraction)/2; -}else{ -if(this.xrange==1){ -this.xscale=0.5; -}else{ -if(this.xrange==2){ -this.xscale=1/3; -}else{ -this.xscale=(1-_90/this.xrange)/this.xrange; -} -} -_92=_90*this.xscale*this.options.barWidthFillFraction; -_93=_92/_89; -_94=_90*this.xscale*(1-this.options.barWidthFillFraction)/2; -} -this.minxdelta=_90; -this.bars=new Array(); -var i=0; -for(var _95 in this.datasets){ -var _96=this.datasets[_95]; -if(PlotKit.Base.isFuncLike(_96)){ -continue; -} -for(var j=0;j<_96.length;j++){ -var _98=_96[j]; -var _99={x:((parseFloat(_98[0])-this.minxval)*this.xscale)+(i*_93)+_94,y:1-((parseFloat(_98[1])-this.minyval)*this.yscale),w:_93,h:((parseFloat(_98[1])-this.minyval)*this.yscale),xval:parseFloat(_98[0]),yval:parseFloat(_98[1]),name:_95}; -if((_99.x>=0)&&(_99.x<=1)&&(_99.y>=0)&&(_99.y<=1)){ -this.bars.push(_99); -} -} -i++; -} -}; -PlotKit.Layout.prototype._evaluateHorizBarCharts=function(){ -var _100=PlotKit.Base.items; -var _101=_100(this.datasets).length; -var _102=10000000; -var _103=this._uniqueXValues(); -for(var i=1;i<_103.length;i++){ -_102=Math.min(Math.abs(_103[i]-_103[i-1]),_102); -} -var _104=0; -var _105=0; -var _106=0; -if(_103.length==1){ -_102=1; -this.xscale=1; -this.minxval=_103[0]; -_104=1*this.options.barWidthFillFraction; -_105=_104/_101; -_106=(1-this.options.barWidthFillFraction)/2; -}else{ -this.xscale=(1-_102/this.xrange)/this.xrange; -_104=_102*this.xscale*this.options.barWidthFillFraction; -_105=_104/_101; -_106=_102*this.xscale*(1-this.options.barWidthFillFraction)/2; -} -this.minxdelta=_102; -this.bars=new Array(); -var i=0; -for(var _107 in this.datasets){ -var _108=this.datasets[_107]; -if(PlotKit.Base.isFuncLike(_108)){ -continue; -} -for(var j=0;j<_108.length;j++){ -var item=_108[j]; -var rect={y:((parseFloat(item[0])-this.minxval)*this.xscale)+(i*_105)+_106,x:0,h:_105,w:((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_107}; -if(rect.y<=0){ -rect.y=0; -} -if(rect.y>=1){ -rect.y=1; -} -if((rect.x>=0)&&(rect.x<=1)){ -this.bars.push(rect); -} -} -i++; -} -}; -PlotKit.Layout.prototype._evaluateLineCharts=function(){ -var _111=PlotKit.Base.items; -var _112=_111(this.datasets).length; -this.points=new Array(); -var i=0; -for(var _113 in this.datasets){ -var _114=this.datasets[_113]; -if(PlotKit.Base.isFuncLike(_114)){ -continue; -} -_114.sort(function(a,b){ -return compare(parseFloat(a[0]),parseFloat(b[0])); -}); -for(var j=0;j<_114.length;j++){ -var item=_114[j]; -var _117={x:((parseFloat(item[0])-this.minxval)*this.xscale),y:1-((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_113}; -if(_117.y<=0){ -_117.y=0; -} -if(_117.y>=1){ -_117.y=1; -} -if((_117.x>=0)&&(_117.x<=1)){ -this.points.push(_117); -} -} -i++; -} -}; -PlotKit.Layout.prototype._evaluatePieCharts=function(){ -var _118=PlotKit.Base.items; -var sum=MochiKit.Iter.sum; -var _120=MochiKit.Base.itemgetter; -var _121=_118(this.datasets).length; -var _122=_118(this.datasets)[0][1]; -var _123=sum(map(_120(1),_122)); -this.slices=new Array(); -var _124=0; -for(var i=0;i<_122.length;i++){ -var _125=_122[i][1]/_123; -var _126=_124*Math.PI*2; -var _127=(_124+_125)*Math.PI*2; -var _128={fraction:_125,xval:_122[i][0],yval:_122[i][1],startAngle:_126,endAngle:_127}; -if(_122[i][1]!=0){ -this.slices.push(_128); -} -_124+=_125; -} -}; -PlotKit.Layout.prototype._evaluateLineTicksForXAxis=function(){ -var _129=MochiKit.Base.isUndefinedOrNull; -if(this.options.xTicks){ -this.xticks=new Array(); -var _130=function(tick){ -var _132=tick.label; -if(_129(_132)){ -_132=tick.v.toString(); -} -var pos=this.xscale*(tick.v-this.minxval); -if((pos>=0)&&(pos<=1)){ -this.xticks.push([pos,_132]); -} -}; -MochiKit.Iter.forEach(this.options.xTicks,bind(_130,this)); -}else{ -if(this.options.xNumberOfTicks){ -var _134=this._uniqueXValues(); -var _135=this.xrange/this.options.xNumberOfTicks; -var _136=0; -this.xticks=new Array(); -for(var i=0;i<=_134.length;i++){ -if((_134[i]-this.minxval)>=(_136*_135)){ -var pos=this.xscale*(_134[i]-this.minxval); -if((pos>1)||(pos<0)){ -continue; -} -this.xticks.push([pos,_134[i]]); -_136++; -} -if(_136>this.options.xNumberOfTicks){ -break; -} -} -} -} -}; -PlotKit.Layout.prototype._evaluateLineTicksForYAxis=function(){ -var _137=MochiKit.Base.isUndefinedOrNull; -if(this.options.yTicks){ -this.yticks=new Array(); -var _138=function(tick){ -var _139=tick.label; -if(_137(_139)){ -_139=tick.v.toString(); -} -var pos=1-(this.yscale*(tick.v-this.minyval)); -if((pos>=0)&&(pos<=1)){ -this.yticks.push([pos,_139]); -} -}; -MochiKit.Iter.forEach(this.options.yTicks,bind(_138,this)); -}else{ -if(this.options.yNumberOfTicks){ -this.yticks=new Array(); -var _140=PlotKit.Base.roundInterval; -var prec=this.options.yTickPrecision; -var _142=_140(this.yrange,this.options.yNumberOfTicks,prec); -for(var i=0;i<=this.options.yNumberOfTicks;i++){ -var yval=this.minyval+(i*_142); -var pos=1-((yval-this.minyval)*this.yscale); -if((pos>1)||(pos<0)){ -continue; -} -this.yticks.push([pos,MochiKit.Format.roundToFixed(yval,prec)]); -} -} -} -}; -PlotKit.Layout.prototype._evaluateLineTicks=function(){ -this._evaluateLineTicksForXAxis(); -this._evaluateLineTicksForYAxis(); -}; -PlotKit.Layout.prototype._evaluateBarTicks=function(){ -this._evaluateLineTicks(); -var _144=function(tick){ -return [tick[0]+(this.minxdelta*this.xscale)/2,tick[1]]; -}; -this.xticks=MochiKit.Base.map(bind(_144,this),this.xticks); -if(this.options.barOrientation=="horizontal"){ -var _145=this.xticks; -this.xticks=this.yticks; -this.yticks=_145; -var _146=function(tick){ -return [1-tick[0],tick[1]]; -}; -this.xticks=MochiKit.Base.map(_146,this.xticks); -} -}; -PlotKit.Layout.prototype._evaluatePieTicks=function(){ -var _147=MochiKit.Base.isUndefinedOrNull; -var _148=MochiKit.Format.numberFormatter("#%"); -this.xticks=new Array(); -if(this.options.xTicks){ -var _149=new Array(); -for(var i=0;i0){ -this.__init__(_158,_159,_160); -} -}; -PlotKit.CanvasRenderer.prototype.__init__=function(_161,_162,_163){ -var _164=MochiKit.Base.isUndefinedOrNull; -var _165=MochiKit.Color.Color; -this.options={"drawBackground":true,"backgroundColor":_165.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_165.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_165.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_165.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true}; -MochiKit.Base.update(this.options,_163?_163:{}); -this.layout=_162; -this.element=MochiKit.DOM.getElement(_161); -this.container=this.element.parentNode; -this.isIE=PlotKit.Base.excanvasSupported(); -if(this.isIE&&!_164(G_vmlCanvasManager)){ -this.IEDelay=0.5; -this.maxTries=5; -this.renderDelay=null; -this.clearDelay=null; -this.element=G_vmlCanvasManager.initElement(this.element); -} -this.height=this.element.height; -this.width=this.element.width; -if(_164(this.element)){ -throw "CanvasRenderer() - passed canvas is not found"; -} -if(!this.isIE&&!(PlotKit.CanvasRenderer.isSupported(this.element))){ -throw "CanvasRenderer() - Canvas is not supported."; -} -if(_164(this.container)||(this.container.nodeName.toLowerCase()!="div")){ -throw "CanvasRenderer() - needs to be enclosed in
"; -} -this.xlabels=new Array(); -this.ylabels=new Array(); -this.isFirstRender=true; -this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom}; -MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}}); -}; -PlotKit.CanvasRenderer.prototype.render=function(){ -if(this.isIE){ -try{ -if(this.renderDelay){ -this.renderDelay.cancel(); -this.renderDelay=null; -} -var _166=this.element.getContext("2d"); -} -catch(e){ -this.isFirstRender=false; -if(this.maxTries-->0){ -this.renderDelay=MochiKit.Async.wait(this.IEDelay); -this.renderDelay.addCallback(bind(this.render,this)); -} -return; -} -} -if(this.options.drawBackground){ -this._renderBackground(); -} -if(this.layout.style=="bar"){ -this._renderBarChart(); -this._renderBarAxis(); -}else{ -if(this.layout.style=="pie"){ -this._renderPieChart(); -this._renderPieAxis(); -}else{ -if(this.layout.style=="line"){ -this._renderLineChart(); -this._renderLineAxis(); -} -} -} -}; -PlotKit.CanvasRenderer.prototype._renderBarChartWrap=function(data,_168){ -var _169=this.element.getContext("2d"); -var _170=this.options.colorScheme.length; -var _171=this.options.colorScheme; -var _172=MochiKit.Base.keys(this.layout.datasets); -var _173=_172.length; -for(var i=0;i<_173;i++){ -var _174=_172[i]; -var _175=_171[i%_170]; -_169.save(); -_169.fillStyle=_175.toRGBString(); -if(this.options.strokeColor){ -_169.strokeStyle=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_169.strokeStyle=_175[this.options.strokeColorTransform]().toRGBString(); -} -} -_169.lineWidth=this.options.strokeWidth; -var _176=function(obj){ -if(obj.name==_174){ -_168(_169,obj); -} -}; -MochiKit.Iter.forEach(data,bind(_176,this)); -_169.restore(); -} -}; -PlotKit.CanvasRenderer.prototype._renderBarChart=function(){ -var bind=MochiKit.Base.bind; -var _178=function(_179,bar){ -var x=this.area.w*bar.x+this.area.x; -var y=this.area.h*bar.y+this.area.y; -var w=this.area.w*bar.w; -var h=this.area.h*bar.h; -if((w<1)||(h<1)){ -return; -} -if(this.options.shouldFill){ -_179.fillRect(x,y,w,h); -} -if(this.options.shouldStroke){ -_179.strokeRect(x,y,w,h); -} -}; -this._renderBarChartWrap(this.layout.bars,bind(_178,this)); -}; -PlotKit.CanvasRenderer.prototype._renderLineChart=function(){ -var _182=this.element.getContext("2d"); -var _183=this.options.colorScheme.length; -var _184=this.options.colorScheme; -var _185=MochiKit.Base.keys(this.layout.datasets); -var _186=_185.length; -var bind=MochiKit.Base.bind; -var _187=MochiKit.Base.partial; -for(var i=0;i<_186;i++){ -var _188=_185[i]; -var _189=_184[i%_183]; -var _190=this.options.strokeColorTransform; -_182.save(); -_182.fillStyle=_189.toRGBString(); -if(this.options.strokeColor){ -_182.strokeStyle=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_182.strokeStyle=_189[_190]().toRGBString(); -} -} -_182.lineWidth=this.options.strokeWidth; -var _191=function(ctx){ -ctx.beginPath(); -ctx.moveTo(this.area.x,this.area.y+this.area.h); -var _193=function(ctx_,_195){ -if(_195.name==_188){ -ctx_.lineTo(this.area.w*_195.x+this.area.x,this.area.h*_195.y+this.area.y); -} -}; -MochiKit.Iter.forEach(this.layout.points,_187(_193,ctx),this); -ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y); -ctx.lineTo(this.area.x,this.area.y+this.area.h); -ctx.closePath(); -}; -if(this.options.shouldFill){ -bind(_191,this)(_182); -_182.fill(); -} -if(this.options.shouldStroke){ -bind(_191,this)(_182); -_182.stroke(); -} -_182.restore(); -} -}; -PlotKit.CanvasRenderer.prototype._renderPieChart=function(){ -var _196=this.element.getContext("2d"); -var _197=this.options.colorScheme.length; -var _198=this.layout.slices; -var _199=this.area.x+this.area.w*0.5; -var _200=this.area.y+this.area.h*0.5; -var _201=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -if(this.isIE){ -_199=parseInt(_199); -_200=parseInt(_200); -_201=parseInt(_201); -} -for(var i=0;i<_198.length;i++){ -var _202=this.options.colorScheme[i%_197]; -_196.save(); -_196.fillStyle=_202.toRGBString(); -var _203=function(){ -_196.beginPath(); -_196.moveTo(_199,_200); -_196.arc(_199,_200,_201,_198[i].startAngle-Math.PI/2,_198[i].endAngle-Math.PI/2,false); -_196.lineTo(_199,_200); -_196.closePath(); -}; -if(Math.abs(_198[i].startAngle-_198[i].endAngle)>0.001){ -if(this.options.shouldFill){ -_203(); -_196.fill(); -} -if(this.options.shouldStroke){ -_203(); -_196.lineWidth=this.options.strokeWidth; -if(this.options.strokeColor){ -_196.strokeStyle=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_196.strokeStyle=_202[this.options.strokeColorTransform]().toRGBString(); -} -} -_196.stroke(); -} -} -_196.restore(); -} -}; -PlotKit.CanvasRenderer.prototype._renderBarAxis=function(){ -this._renderAxis(); -}; -PlotKit.CanvasRenderer.prototype._renderLineAxis=function(){ -this._renderAxis(); -}; -PlotKit.CanvasRenderer.prototype._renderAxis=function(){ -if(!this.options.drawXAxis&&!this.options.drawYAxis){ -return; -} -var _204=this.element.getContext("2d"); -var _205={"style":{"position":"absolute","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}}; -_204.save(); -_204.strokeStyle=this.options.axisLineColor.toRGBString(); -_204.lineWidth=this.options.axisLineWidth; -if(this.options.drawYAxis){ -if(this.layout.yticks){ -var _206=function(tick){ -if(typeof (tick)=="function"){ -return; -} -var x=this.area.x; -var y=this.area.y+tick[0]*this.area.h; -_204.beginPath(); -_204.moveTo(x,y); -_204.lineTo(x-this.options.axisTickSize,y); -_204.closePath(); -_204.stroke(); -var _207=DIV(_205,tick[1]); -_207.style.top=(y-this.options.axisLabelFontSize)+"px"; -_207.style.left=(x-this.options.padding.left-this.options.axisTickSize)+"px"; -_207.style.textAlign="right"; -_207.style.width=(this.options.padding.left-this.options.axisTickSize*2)+"px"; -MochiKit.DOM.appendChildNodes(this.container,_207); -this.ylabels.push(_207); -}; -MochiKit.Iter.forEach(this.layout.yticks,bind(_206,this)); -} -_204.beginPath(); -_204.moveTo(this.area.x,this.area.y); -_204.lineTo(this.area.x,this.area.y+this.area.h); -_204.closePath(); -_204.stroke(); -} -if(this.options.drawXAxis){ -if(this.layout.xticks){ -var _206=function(tick){ -if(typeof (dataset)=="function"){ -return; -} -var x=this.area.x+tick[0]*this.area.w; -var y=this.area.y+this.area.h; -_204.beginPath(); -_204.moveTo(x,y); -_204.lineTo(x,y+this.options.axisTickSize); -_204.closePath(); -_204.stroke(); -var _208=DIV(_205,tick[1]); -_208.style.top=(y+this.options.axisTickSize)+"px"; -_208.style.left=(x-this.options.axisLabelWidth/2)+"px"; -_208.style.textAlign="center"; -_208.style.width=this.options.axisLabelWidth+"px"; -MochiKit.DOM.appendChildNodes(this.container,_208); -this.xlabels.push(_208); +i++; +} }; -MochiKit.Iter.forEach(this.layout.xticks,bind(_206,this)); +PlotKit.Layout.prototype._evaluatePieCharts=function(){ +var _118=PlotKit.Base.items; +var sum=MochiKit.Iter.sum; +var _120=MochiKit.Base.itemgetter; +var _121=_118(this.datasets).length; +var _122=_118(this.datasets)[0][1]; +var _123=sum(map(_120(1),_122)); +this.slices=new Array(); +var _124=0; +for(var i=0;i<_122.length;i++){ +var _125=_122[i][1]/_123; +var _126=_124*Math.PI*2; +var _127=(_124+_125)*Math.PI*2; +var _128={fraction:_125,xval:_122[i][0],yval:_122[i][1],startAngle:_126,endAngle:_127}; +if(_122[i][1]!=0){ +this.slices.push(_128); } -_204.beginPath(); -_204.moveTo(this.area.x,this.area.y+this.area.h); -_204.lineTo(this.area.x+this.area.w,this.area.y+this.area.h); -_204.closePath(); -_204.stroke(); +_124+=_125; } -_204.restore(); }; -PlotKit.CanvasRenderer.prototype._renderPieAxis=function(){ -if(!this.options.drawXAxis){ -return; +PlotKit.Layout.prototype._evaluateLineTicksForXAxis=function(){ +var _129=MochiKit.Base.isUndefinedOrNull; +if(this.options.xTicks){ +this.xticks=new Array(); +var _130=function(tick){ +var _132=tick.label; +if(_129(_132)){ +_132=tick.v.toString(); } -if(this.layout.xticks){ -var _209=new Array(); -for(var i=0;i=0)&&(pos<=1)){ +this.xticks.push([pos,_132]); } -var _210=this.area.x+this.area.w*0.5; -var _211=this.area.y+this.area.h*0.5; -var _212=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -var _213=this.options.axisLabelWidth; -for(var i=0;i=(_136*_135)){ +var pos=this.xscale*(_134[i]-this.minxval); +if((pos>1)||(pos<0)){ continue; } -var _215=(_214.startAngle+_214.endAngle)/2; -var _216=_215; -if(_216>Math.PI*2){ -_216=_216-Math.PI*2; -}else{ -if(_216<0){ -_216=_216+Math.PI*2; +this.xticks.push([pos,_134[i]]); +_136++; } +if(_136>this.options.xNumberOfTicks){ +break; } -var _217=_210+Math.sin(_216)*(_212+10); -var _218=_211-Math.cos(_216)*(_212+10); -var _219={"position":"absolute","zIndex":11,"width":_213+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()}; -if(_216<=Math.PI*0.5){ -_219["textAlign"]="left"; -_219["verticalAlign"]="top"; -_219["left"]=_217+"px"; -_219["top"]=(_218-this.options.axisLabelFontSize)+"px"; -}else{ -if((_216>Math.PI*0.5)&&(_216<=Math.PI)){ -_219["textAlign"]="left"; -_219["verticalAlign"]="bottom"; -_219["left"]=_217+"px"; -_219["top"]=_218+"px"; -}else{ -if((_216>Math.PI)&&(_216<=Math.PI*1.5)){ -_219["textAlign"]="right"; -_219["verticalAlign"]="bottom"; -_219["left"]=(_217-_213)+"px"; -_219["top"]=_218+"px"; -}else{ -_219["textAlign"]="right"; -_219["verticalAlign"]="bottom"; -_219["left"]=(_217-_213)+"px"; -_219["top"]=(_218-this.options.axisLabelFontSize)+"px"; } } } -var _220=DIV({"style":_219},this.layout.xticks[i][1]); -this.xlabels.push(_220); -MochiKit.DOM.appendChildNodes(this.container,_220); +}; +PlotKit.Layout.prototype._evaluateLineTicksForYAxis=function(){ +var _137=MochiKit.Base.isUndefinedOrNull; +if(this.options.yTicks){ +this.yticks=new Array(); +var _138=function(tick){ +var _139=tick.label; +if(_137(_139)){ +_139=tick.v.toString(); } +var pos=1-(this.yscale*(tick.v-this.minyval)); +if((pos>=0)&&(pos<=1)){ +this.yticks.push([pos,_139]); } }; -PlotKit.CanvasRenderer.prototype._renderBackground=function(){ -var _221=this.element.getContext("2d"); -_221.save(); -_221.fillStyle=this.options.backgroundColor.toRGBString(); -_221.fillRect(0,0,this.width,this.height); -_221.restore(); -}; -PlotKit.CanvasRenderer.prototype.clear=function(){ -if(this.isIE){ -try{ -if(this.clearDelay){ -this.clearDelay.cancel(); -this.clearDelay=null; +MochiKit.Iter.forEach(this.options.yTicks,bind(_138,this)); +}else{ +if(this.options.yNumberOfTicks){ +this.yticks=new Array(); +var _140=PlotKit.Base.roundInterval; +var prec=this.options.yTickPrecision; +var _142=_140(this.yrange,this.options.yNumberOfTicks,prec); +for(var i=0;i<=this.options.yNumberOfTicks;i++){ +var yval=this.minyval+(i*_142); +var pos=1-((yval-this.minyval)*this.yscale); +if((pos>1)||(pos<0)){ +continue; } -var _222=this.element.getContext("2d"); +this.yticks.push([pos,MochiKit.Format.roundToFixed(yval,prec)]); } -catch(e){ -this.isFirstRender=false; -this.clearDelay=MochiKit.Async.wait(this.IEDelay); -this.clearDelay.addCallback(bind(this.clear,this)); -return; } } -var _222=this.element.getContext("2d"); -_222.clearRect(0,0,this.width,this.height); -MochiKit.Iter.forEach(this.xlabels,MochiKit.DOM.removeElement); -MochiKit.Iter.forEach(this.ylabels,MochiKit.DOM.removeElement); -this.xlabels=new Array(); -this.ylabels=new Array(); }; -PlotKit.CanvasRenderer.prototype._initialiseEvents=function(){ -var _223=MochiKit.Signal.connect; -var bind=MochiKit.Base.bind; -_223(this.element,"onclick",bind(this.onclick,this)); +PlotKit.Layout.prototype._evaluateLineTicks=function(){ +this._evaluateLineTicksForXAxis(); +this._evaluateLineTicksForYAxis(); }; -PlotKit.CanvasRenderer.prototype._resolveObject=function(e){ -var x=(e.mouse().page.x-PlotKit.Base.findPosX(this.element)-this.area.x)/this.area.w; -var y=(e.mouse().page.y-PlotKit.Base.findPosY(this.element)-this.area.y)/this.area.h; -var _225=this.layout.hitTest(x,y); -if(_225){ -return _225; -} -return null; +PlotKit.Layout.prototype._evaluateBarTicks=function(){ +this._evaluateLineTicks(); +var _144=function(tick){ +return [tick[0]+(this.minxdelta*this.xscale)/2,tick[1]]; }; -PlotKit.CanvasRenderer.prototype._createEventObject=function(_226,e){ -if(_226==null){ -return null; -} -e.chart=_226; -return e; +this.xticks=MochiKit.Base.map(bind(_144,this),this.xticks); +if(this.options.barOrientation=="horizontal"){ +var _145=this.xticks; +this.xticks=this.yticks; +this.yticks=_145; +var _146=function(tick){ +return [1-tick[0],tick[1]]; }; -PlotKit.CanvasRenderer.prototype.onclick=function(e){ -var _227=this._resolveObject(e); -var _228=this._createEventObject(_227,e); -if(_228!=null){ -MochiKit.Signal.signal(this,"onclick",_228); +this.xticks=MochiKit.Base.map(_146,this.xticks); } }; -PlotKit.CanvasRenderer.prototype.onmouseover=function(e){ -var _229=this._resolveObject(e); -var _230=this._createEventObject(_229,e); -if(_230!=null){ -signal(this,"onmouseover",_230); +PlotKit.Layout.prototype._evaluatePieTicks=function(){ +var _147=MochiKit.Base.isUndefinedOrNull; +var _148=MochiKit.Format.numberFormatter("#%"); +this.xticks=new Array(); +if(this.options.xTicks){ +var _149=new Array(); +for(var i=0;i0){ -this.__init__(_240,_241,_242); +if(typeof (PlotKit.CanvasRenderer)=="undefined"){ +PlotKit.CanvasRenderer={}; } -}; -PlotKit.SVGRenderer.NAME="PlotKit.SVGRenderer"; -PlotKit.SVGRenderer.VERSION=PlotKit.VERSION; -PlotKit.SVGRenderer.__repr__=function(){ +PlotKit.CanvasRenderer.NAME="PlotKit.CanvasRenderer"; +PlotKit.CanvasRenderer.VERSION=PlotKit.VERSION; +PlotKit.CanvasRenderer.__repr__=function(){ return "["+this.NAME+" "+this.VERSION+"]"; }; -PlotKit.SVGRenderer.toString=function(){ +PlotKit.CanvasRenderer.toString=function(){ return this.__repr__(); }; -PlotKit.SVGRenderer.SVGNS="http://www.w3.org/2000/svg"; -PlotKit.SVGRenderer.prototype.__init__=function(_243,_244,_245){ -var _246=MochiKit.Base.isUndefinedOrNull; -this.options={"drawBackground":true,"backgroundColor":Color.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"strokeColor":Color.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":Color.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":Color.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"axisLabelUseDiv":true,"pieRadius":0.4,"enableEvents":true}; -MochiKit.Base.update(this.options,_245?_245:{}); -this.layout=_244; -this.element=MochiKit.DOM.getElement(_243); +PlotKit.CanvasRenderer=function(_158,_159,_160){ +if(arguments.length>0){ +this.__init__(_158,_159,_160); +} +}; +PlotKit.CanvasRenderer.prototype.__init__=function(_161,_162,_163){ +var _164=MochiKit.Base.isUndefinedOrNull; +var _165=MochiKit.Color.Color; +this.options={"drawBackground":true,"backgroundColor":_165.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_165.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_165.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_165.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true}; +MochiKit.Base.update(this.options,_163?_163:{}); +this.layout=_162; +this.element=MochiKit.DOM.getElement(_161); this.container=this.element.parentNode; -this.height=parseInt(this.element.getAttribute("height")); -this.width=parseInt(this.element.getAttribute("width")); -this.document=document; -this.root=this.element; -try{ -this.document=this.element.getSVGDocument(); -this.root=_246(this.document.documentElement)?this.element:this.document.documentElement; +this.isIE=PlotKit.Base.excanvasSupported(); +if(this.isIE&&!_164(G_vmlCanvasManager)){ +this.IEDelay=0.5; +this.maxTries=5; +this.renderDelay=null; +this.clearDelay=null; +this.element=G_vmlCanvasManager.initElement(this.element); } -catch(e){ +this.height=this.element.height; +this.width=this.element.width; +if(_164(this.element)){ +throw "CanvasRenderer() - passed canvas is not found"; } -this.element.style.zIndex=1; -if(_246(this.element)){ -throw "SVGRenderer() - passed SVG object is not found"; +if(!this.isIE&&!(PlotKit.CanvasRenderer.isSupported(this.element))){ +throw "CanvasRenderer() - Canvas is not supported."; } -if(_246(this.container)||this.container.nodeName.toLowerCase()!="div"){ -throw "SVGRenderer() - No DIV's around the SVG."; +if(_164(this.container)||(this.container.nodeName.toLowerCase()!="div")){ +throw "CanvasRenderer() - needs to be enclosed in
"; } this.xlabels=new Array(); this.ylabels=new Array(); -this.defs=this.createSVGElement("defs"); +this.isFirstRender=true; this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom}; MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}}); }; -PlotKit.SVGRenderer.prototype.render=function(){ +PlotKit.CanvasRenderer.prototype.render=function(){ +if(this.isIE){ +try{ +if(this.renderDelay){ +this.renderDelay.cancel(); +this.renderDelay=null; +} +var _166=this.element.getContext("2d"); +} +catch(e){ +this.isFirstRender=false; +if(this.maxTries-->0){ +this.renderDelay=MochiKit.Async.wait(this.IEDelay); +this.renderDelay.addCallback(bind(this.render,this)); +} +return; +} +} if(this.options.drawBackground){ this._renderBackground(); } @@ -8240,844 +4346,401 @@ this._renderLineAxis(); } } }; -PlotKit.SVGRenderer.prototype._renderBarOrLine=function(data,_247,_248,_249){ -var _250=this.options.colorScheme.length; -var _251=this.options.colorScheme; -var _252=MochiKit.Base.keys(this.layout.datasets); -var _253=_252.length; -for(var i=0;i<_253;i++){ -var _254=_252[i]; -var _255=new Array(); -var _256=_251[i%_250]; -if(this.options.shouldFill){ -_255["fill"]=_256.toRGBString(); -}else{ -_255["fill"]="none"; -} -if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){ +PlotKit.CanvasRenderer.prototype._renderBarChartWrap=function(data,_168){ +var _169=this.element.getContext("2d"); +var _170=this.options.colorScheme.length; +var _171=this.options.colorScheme; +var _172=MochiKit.Base.keys(this.layout.datasets); +var _173=_172.length; +for(var i=0;i<_173;i++){ +var _174=_172[i]; +var _175=_171[i%_170]; +_169.save(); +_169.fillStyle=_175.toRGBString(); if(this.options.strokeColor){ -_255["stroke"]=this.options.strokeColor.toRGBString(); +_169.strokeStyle=this.options.strokeColor.toRGBString(); }else{ if(this.options.strokeColorTransform){ -_255["stroke"]=_256[this.options.strokeColorTransform]().toRGBString(); -} -} -_255["strokeWidth"]=this.options.strokeWidth; +_169.strokeStyle=_175[this.options.strokeColorTransform]().toRGBString(); } -if(_248){ -_248(_255); } -var _257=function(obj){ -if(obj.name==_254){ -_247(_255,obj); +_169.lineWidth=this.options.strokeWidth; +var _176=function(obj){ +if(obj.name==_174){ +_168(_169,obj); } }; -MochiKit.Iter.forEach(data,bind(_257,this)); -if(_249){ -_249(_255); -} +MochiKit.Iter.forEach(data,bind(_176,this)); +_169.restore(); } }; -PlotKit.SVGRenderer.prototype._renderBarChart=function(){ +PlotKit.CanvasRenderer.prototype._renderBarChart=function(){ var bind=MochiKit.Base.bind; -var _258=function(_259,bar){ +var _178=function(_179,bar){ var x=this.area.w*bar.x+this.area.x; var y=this.area.h*bar.y+this.area.y; var w=this.area.w*bar.w; var h=this.area.h*bar.h; -this._drawRect(x,y,w,h,_259); +if((w<1)||(h<1)){ +return; +} +if(this.options.shouldFill){ +_179.fillRect(x,y,w,h); +} +if(this.options.shouldStroke){ +_179.strokeRect(x,y,w,h); +} }; -this._renderBarOrLine(this.layout.bars,bind(_258,this)); +this._renderBarChartWrap(this.layout.bars,bind(_178,this)); }; -PlotKit.SVGRenderer.prototype._renderLineChart=function(){ +PlotKit.CanvasRenderer.prototype._renderLineChart=function(){ +var _182=this.element.getContext("2d"); +var _183=this.options.colorScheme.length; +var _184=this.options.colorScheme; +var _185=MochiKit.Base.keys(this.layout.datasets); +var _186=_185.length; var bind=MochiKit.Base.bind; -var _260=function(_261,_262){ -this._tempPointsBuffer+=(this.area.w*_262.x+this.area.x)+","+(this.area.h*_262.y+this.area.y)+" "; -}; -var _263=function(_264){ -this._tempPointsBuffer=""; -this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" "; -}; -var _265=function(_266){ -this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y); -_266["points"]=this._tempPointsBuffer; -var elem=this.createSVGElement("polygon",_266); -this.root.appendChild(elem); -}; -this._renderBarOrLine(this.layout.points,bind(_260,this),bind(_263,this),bind(_265,this)); -}; -PlotKit.SVGRenderer.prototype._renderPieChart=function(){ -var _268=this.options.colorScheme.length; -var _269=this.layout.slices; -var _270=this.area.x+this.area.w*0.5; -var _271=this.area.y+this.area.h*0.5; -var _272=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -if(_269.length==1&&(Math.abs(_269[0].startAngle)-Math.abs(_269[0].endAngle)<0.1)){ -var _273={"cx":_270,"cy":_271,"r":_272}; -var _274=this.options.colorScheme[0]; -if(this.options.shouldFill){ -_273["fill"]=_274.toRGBString(); -}else{ -_273["fill"]="none"; -} -if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){ +var _187=MochiKit.Base.partial; +for(var i=0;i<_186;i++){ +var _188=_185[i]; +var _189=_184[i%_183]; +var _190=this.options.strokeColorTransform; +_182.save(); +_182.fillStyle=_189.toRGBString(); if(this.options.strokeColor){ -_273["stroke"]=this.options.strokeColor.toRGBString(); +_182.strokeStyle=this.options.strokeColor.toRGBString(); }else{ if(this.options.strokeColorTransform){ -_273["stroke"]=_274[this.options.strokeColorTransform]().toRGBString(); +_182.strokeStyle=_189[_190]().toRGBString(); } } -_273["style"]="stroke-width: "+this.options.strokeWidth; +_182.lineWidth=this.options.strokeWidth; +var _191=function(ctx){ +ctx.beginPath(); +ctx.moveTo(this.area.x,this.area.y+this.area.h); +var _193=function(ctx_,_195){ +if(_195.name==_188){ +ctx_.lineTo(this.area.w*_195.x+this.area.x,this.area.h*_195.y+this.area.y); +} +}; +MochiKit.Iter.forEach(this.layout.points,_187(_193,ctx),this); +ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y); +ctx.lineTo(this.area.x,this.area.y+this.area.h); +ctx.closePath(); +}; +if(this.options.shouldFill){ +bind(_191,this)(_182); +_182.fill(); } -this.root.appendChild(this.createSVGElement("circle",_273)); -return; +if(this.options.shouldStroke){ +bind(_191,this)(_182); +_182.stroke(); +} +_182.restore(); +} +}; +PlotKit.CanvasRenderer.prototype._renderPieChart=function(){ +var _196=this.element.getContext("2d"); +var _197=this.options.colorScheme.length; +var _198=this.layout.slices; +var _199=this.area.x+this.area.w*0.5; +var _200=this.area.y+this.area.h*0.5; +var _201=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); +if(this.isIE){ +_199=parseInt(_199); +_200=parseInt(_200); +_201=parseInt(_201); } -for(var i=0;i<_269.length;i++){ -var _273=new Array(); -var _274=this.options.colorScheme[i%_268]; +for(var i=0;i<_198.length;i++){ +var _202=this.options.colorScheme[i%_197]; +_196.save(); +_196.fillStyle=_202.toRGBString(); +var _203=function(){ +_196.beginPath(); +_196.moveTo(_199,_200); +_196.arc(_199,_200,_201,_198[i].startAngle-Math.PI/2,_198[i].endAngle-Math.PI/2,false); +_196.lineTo(_199,_200); +_196.closePath(); +}; +if(Math.abs(_198[i].startAngle-_198[i].endAngle)>0.001){ if(this.options.shouldFill){ -_273["fill"]=_274.toRGBString(); -}else{ -_273["fill"]="none"; +_203(); +_196.fill(); } -if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){ +if(this.options.shouldStroke){ +_203(); +_196.lineWidth=this.options.strokeWidth; if(this.options.strokeColor){ -_273["stroke"]=this.options.strokeColor.toRGBString(); +_196.strokeStyle=this.options.strokeColor.toRGBString(); }else{ if(this.options.strokeColorTransform){ -_273["stroke"]=_274[this.options.strokeColorTransform]().toRGBString(); +_196.strokeStyle=_202[this.options.strokeColorTransform]().toRGBString(); } } -_273["style"]="stroke-width:"+this.options.strokeWidth; +_196.stroke(); } -var _275=0; -if(Math.abs(_269[i].endAngle-_269[i].startAngle)>Math.PI){ -_275=1; } -var x1=Math.cos(_269[i].startAngle-Math.PI/2)*_272; -var y1=Math.sin(_269[i].startAngle-Math.PI/2)*_272; -var x2=Math.cos(_269[i].endAngle-Math.PI/2)*_272; -var y2=Math.sin(_269[i].endAngle-Math.PI/2)*_272; -var rx=x2-x1; -var ry=y2-y1; -var _282="M"+_270+","+_271+" "; -_282+="l"+x1+","+y1+" "; -_282+="a"+_272+","+_272+" 0 "+_275+",1 "+rx+","+ry+" z"; -_273["d"]=_282; -var elem=this.createSVGElement("path",_273); -this.root.appendChild(elem); +_196.restore(); } }; -PlotKit.SVGRenderer.prototype._renderBarAxis=function(){ +PlotKit.CanvasRenderer.prototype._renderBarAxis=function(){ this._renderAxis(); }; -PlotKit.SVGRenderer.prototype._renderLineAxis=function(){ +PlotKit.CanvasRenderer.prototype._renderLineAxis=function(){ this._renderAxis(); }; -PlotKit.SVGRenderer.prototype._renderAxis=function(){ +PlotKit.CanvasRenderer.prototype._renderAxis=function(){ if(!this.options.drawXAxis&&!this.options.drawYAxis){ return; } -var _283={"style":{"position":"absolute","textAlign":"center","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}}; -var _284={"stroke":this.options.axisLineColor.toRGBString(),"strokeWidth":this.options.axisLineWidth}; +var _204=this.element.getContext("2d"); +var _205={"style":{"position":"absolute","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}}; +_204.save(); +_204.strokeStyle=this.options.axisLineColor.toRGBString(); +_204.lineWidth=this.options.axisLineWidth; if(this.options.drawYAxis){ if(this.layout.yticks){ -var _285=function(tick){ +var _206=function(tick){ +if(typeof (tick)=="function"){ +return; +} var x=this.area.x; var y=this.area.y+tick[0]*this.area.h; -this._drawLine(x,y,x-3,y,_284); -if(this.options.axisLabelUseDiv){ -var _286=DIV(_283,tick[1]); -_286.style.top=(y-this.options.axisLabelFontSize)+"px"; -_286.style.left=(x-this.options.padding.left+this.options.axisTickSize)+"px"; -_286.style.textAlign="left"; -_286.style.width=(this.options.padding.left-3)+"px"; -MochiKit.DOM.appendChildNodes(this.container,_286); -this.ylabels.push(_286); -}else{ -var _287={y:y+3,x:(x-this.options.padding.left+3),width:(this.options.padding.left-this.options.axisTickSize)+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString()}; -var _286=this.createSVGElement("text",_287); -_286.appendChild(this.document.createTextNode(tick[1])); -this.root.appendChild(_286); -} +_204.beginPath(); +_204.moveTo(x,y); +_204.lineTo(x-this.options.axisTickSize,y); +_204.closePath(); +_204.stroke(); +var _207=DIV(_205,tick[1]); +_207.style.top=(y-this.options.axisLabelFontSize)+"px"; +_207.style.left=(x-this.options.padding.left-this.options.axisTickSize)+"px"; +_207.style.textAlign="right"; +_207.style.width=(this.options.padding.left-this.options.axisTickSize*2)+"px"; +MochiKit.DOM.appendChildNodes(this.container,_207); +this.ylabels.push(_207); }; -MochiKit.Iter.forEach(this.layout.yticks,bind(_285,this)); +MochiKit.Iter.forEach(this.layout.yticks,bind(_206,this)); } -this._drawLine(this.area.x,this.area.y,this.area.x,this.area.y+this.area.h,_284); +_204.beginPath(); +_204.moveTo(this.area.x,this.area.y); +_204.lineTo(this.area.x,this.area.y+this.area.h); +_204.closePath(); +_204.stroke(); } if(this.options.drawXAxis){ if(this.layout.xticks){ -var _285=function(tick){ +var _206=function(tick){ +if(typeof (dataset)=="function"){ +return; +} var x=this.area.x+tick[0]*this.area.w; var y=this.area.y+this.area.h; -this._drawLine(x,y,x,y+this.options.axisTickSize,_284); -if(this.options.axisLabelUseDiv){ -var _288=DIV(_283,tick[1]); -_288.style.top=(y+this.options.axisTickSize)+"px"; -_288.style.left=(x-this.options.axisLabelWidth/2)+"px"; -_288.style.textAlign="center"; -_288.style.width=this.options.axisLabelWidth+"px"; -MochiKit.DOM.appendChildNodes(this.container,_288); -this.xlabels.push(_288); -}else{ -var _289={y:(y+this.options.axisTickSize+this.options.axisLabelFontSize),x:x-3,width:this.options.axisLabelWidth+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString(),textAnchor:"middle"}; -var _288=this.createSVGElement("text",_289); -_288.appendChild(this.document.createTextNode(tick[1])); -this.root.appendChild(_288); +_204.beginPath(); +_204.moveTo(x,y); +_204.lineTo(x,y+this.options.axisTickSize); +_204.closePath(); +_204.stroke(); +var _208=DIV(_205,tick[1]); +_208.style.top=(y+this.options.axisTickSize)+"px"; +_208.style.left=(x-this.options.axisLabelWidth/2)+"px"; +_208.style.textAlign="center"; +_208.style.width=this.options.axisLabelWidth+"px"; +MochiKit.DOM.appendChildNodes(this.container,_208); +this.xlabels.push(_208); +}; +MochiKit.Iter.forEach(this.layout.xticks,bind(_206,this)); +} +_204.beginPath(); +_204.moveTo(this.area.x,this.area.y+this.area.h); +_204.lineTo(this.area.x+this.area.w,this.area.y+this.area.h); +_204.closePath(); +_204.stroke(); } +_204.restore(); }; -MochiKit.Iter.forEach(this.layout.xticks,bind(_285,this)); -} -this._drawLine(this.area.x,this.area.y+this.area.h,this.area.x+this.area.w,this.area.y+this.area.h,_284); +PlotKit.CanvasRenderer.prototype._renderPieAxis=function(){ +if(!this.options.drawXAxis){ +return; } -}; -PlotKit.SVGRenderer.prototype._renderPieAxis=function(){ if(this.layout.xticks){ -var _290=new Array(); +var _209=new Array(); for(var i=0;iMath.PI*2){ -_297=_297-Math.PI*2; +var _215=(_214.startAngle+_214.endAngle)/2; +var _216=_215; +if(_216>Math.PI*2){ +_216=_216-Math.PI*2; }else{ -if(_297<0){ -_297=_297+Math.PI*2; +if(_216<0){ +_216=_216+Math.PI*2; } } -var _298=_291+Math.sin(_297)*(_293+10); -var _299=_292-Math.cos(_297)*(_293+10); -var _300={"position":"absolute","zIndex":11,"width":_294+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()}; -var _301={"width":_294+"px","fontSize":this.options.axisLabelFontSize+"px","height":(this.options.axisLabelFontSize+3)+"px","fill":this.options.axisLabelColor.toRGBString()}; -if(_297<=Math.PI*0.5){ -MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"top","left":_298+"px","top":(_299-this.options.axisLabelFontSize)+"px"}); -MochiKit.Base.update(_301,{"x":_298,"y":(_299-this.options.axisLabelFontSize),"textAnchor":"left"}); +var _217=_210+Math.sin(_216)*(_212+10); +var _218=_211-Math.cos(_216)*(_212+10); +var _219={"position":"absolute","zIndex":11,"width":_213+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()}; +if(_216<=Math.PI*0.5){ +_219["textAlign"]="left"; +_219["verticalAlign"]="top"; +_219["left"]=_217+"px"; +_219["top"]=(_218-this.options.axisLabelFontSize)+"px"; }else{ -if((_297>Math.PI*0.5)&&(_297<=Math.PI)){ -MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"bottom","left":_298+"px","top":_299+"px"}); -MochiKit.Base.update(_301,{"textAnchor":"left","x":_298,"y":_299}); +if((_216>Math.PI*0.5)&&(_216<=Math.PI)){ +_219["textAlign"]="left"; +_219["verticalAlign"]="bottom"; +_219["left"]=_217+"px"; +_219["top"]=_218+"px"; }else{ -if((_297>Math.PI)&&(_297<=Math.PI*1.5)){ -MochiKit.Base.update(_300,{"textAlign":"right","verticalAlign":"bottom","left":_298+"px","top":_299+"px"}); -MochiKit.Base.update(_301,{"textAnchor":"right","x":_298-_294,"y":_299}); +if((_216>Math.PI)&&(_216<=Math.PI*1.5)){ +_219["textAlign"]="right"; +_219["verticalAlign"]="bottom"; +_219["left"]=(_217-_213)+"px"; +_219["top"]=_218+"px"; }else{ -MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"bottom","left":_298+"px","top":_299+"px"}); -MochiKit.Base.update(_301,{"textAnchor":"left","x":_298-_294,"y":_299-this.options.axisLabelFontSize}); -} -} +_219["textAlign"]="right"; +_219["verticalAlign"]="bottom"; +_219["left"]=(_217-_213)+"px"; +_219["top"]=(_218-this.options.axisLabelFontSize)+"px"; } -if(this.options.axisLabelUseDiv){ -var _302=DIV({"style":_300},this.layout.xticks[i][1]); -this.xlabels.push(_302); -MochiKit.DOM.appendChildNodes(this.container,_302); -}else{ -var _302=this.createSVGElement("text",_301); -_302.appendChild(this.document.createTextNode(this.layout.xticks[i][1])); -this.root.appendChild(_302); } } +var _220=DIV({"style":_219},this.layout.xticks[i][1]); +this.xlabels.push(_220); +MochiKit.DOM.appendChildNodes(this.container,_220); } -}; -PlotKit.SVGRenderer.prototype._renderBackground=function(){ -var opts={"stroke":"none","fill":this.options.backgroundColor.toRGBString()}; -this._drawRect(0,0,this.width,this.height,opts); -}; -PlotKit.SVGRenderer.prototype._drawRect=function(x,y,w,h,_304){ -var _305={x:x+"px",y:y+"px",width:w+"px",height:h+"px"}; -if(_304){ -MochiKit.Base.update(_305,_304); } -var elem=this.createSVGElement("rect",_305); -this.root.appendChild(elem); }; -PlotKit.SVGRenderer.prototype._drawLine=function(x1,y1,x2,y2,_306){ -var _307={x1:x1+"px",y1:y1+"px",x2:x2+"px",y2:y2+"px"}; -if(_306){ -MochiKit.Base.update(_307,_306); -} -var elem=this.createSVGElement("line",_307); -this.root.appendChild(elem); +PlotKit.CanvasRenderer.prototype._renderBackground=function(){ +var _221=this.element.getContext("2d"); +_221.save(); +_221.fillStyle=this.options.backgroundColor.toRGBString(); +_221.fillRect(0,0,this.width,this.height); +_221.restore(); }; -PlotKit.SVGRenderer.prototype.clear=function(){ -while(this.element.firstChild){ -this.element.removeChild(this.element.firstChild); +PlotKit.CanvasRenderer.prototype.clear=function(){ +if(this.isIE){ +try{ +if(this.clearDelay){ +this.clearDelay.cancel(); +this.clearDelay=null; } -if(this.options.axisLabelUseDiv){ -for(var i=0;i=6)&&(!_313)){ -var _314=_312["width"]?_312["width"]:"100"; -var _315=_312["height"]?_312["height"]:"100"; -var eid=_312["id"]?_312["id"]:"notunique"; -var html=""; -var _318=document.createElement(html); -var _319=_318.getSVGDocument().createElementNS(PlotKit.SVGRenderer.SVGNS,"svg"); -_319.setAttribute("width",_314); -_319.setAttribute("height",_315); -_318.getSVGDocument().appendChild(_319); -return _318; -}else{ -return PlotKit.SVGRenderer.prototype.createSVGElement("svg",_312); -} -}; -PlotKit.SVGRenderer.isSupported=function(){ -var _320=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1); -var _321=navigator.appVersion.match(/MSIE (\d\.\d)/); -var _322=navigator.userAgent.match(/AppleWebKit\/(\d+)/); -var _323=navigator.userAgent.match(/Opera\/(\d*\.\d*)/); -var _324=navigator.userAgent.match(/rv:(\d*\.\d*).*Gecko/); -var _325="http://www.w3.org/TR/SVG11/feature#SVG"; -if(_321&&(_321[1]>=6)&&!_320){ -return document.implementation.hasFeature(_325,"1.1"); -} -if(_323&&(_323[1]>8.9)){ -return true; -} -if(_324&&(_324>1.7)){ -return true; +PlotKit.CanvasRenderer.prototype._resolveObject=function(e){ +var x=(e.mouse().page.x-PlotKit.Base.findPosX(this.element)-this.area.x)/this.area.w; +var y=(e.mouse().page.y-PlotKit.Base.findPosY(this.element)-this.area.y)/this.area.h; +var _225=this.layout.hitTest(x,y); +if(_225){ +return _225; } -return false; -}; -PlotKit.SVG={}; -PlotKit.SVG.SVGRenderer=PlotKit.SVGRenderer; -PlotKit.SVG.EXPORT=["SVGRenderer"]; -PlotKit.SVG.EXPORT_OK=["SVGRenderer"]; -PlotKit.SVG.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; +return null; }; -PlotKit.SVG.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.SVG); -try{ -if(typeof (PlotKit.CanvasRenderer)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "SweetCanvas depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, Canvas}"; -} -if(typeof (PlotKit.SweetCanvasRenderer)=="undefined"){ -PlotKit.SweetCanvasRenderer={}; -} -PlotKit.SweetCanvasRenderer=function(_326,_327,_328){ -if(arguments.length>0){ -this.__init__(_326,_327,_328); +PlotKit.CanvasRenderer.prototype._createEventObject=function(_226,e){ +if(_226==null){ +return null; } +e.chart=_226; +return e; }; -PlotKit.SweetCanvasRenderer.NAME="PlotKit.SweetCanvasRenderer"; -PlotKit.SweetCanvasRenderer.VERSION=PlotKit.VERSION; -PlotKit.SweetCanvasRenderer.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.SweetCanvasRenderer.toString=function(){ -return this.__repr__(); -}; -PlotKit.SweetCanvasRenderer.prototype=new PlotKit.CanvasRenderer(); -PlotKit.SweetCanvasRenderer.prototype.constructor=PlotKit.SweetCanvasRenderer; -PlotKit.SweetCanvasRenderer.__super__=PlotKit.CanvasRenderer.prototype; -PlotKit.SweetCanvasRenderer.prototype.__init__=function(el,_330,opts){ -var _331=PlotKit.Base.officeBlue(); -MochiKit.Base.update(_331,opts); -PlotKit.SweetCanvasRenderer.__super__.__init__.call(this,el,_330,_331); -}; -PlotKit.SweetCanvasRenderer.prototype._renderBarChart=function(){ -var bind=MochiKit.Base.bind; -var _332=Color.blackColor().colorWithAlpha(0.1).toRGBString(); -var _333=function(_334,x,y,w,h){ -_334.fillStyle=_332; -_334.fillRect(x-2,y-2,w+4,h+2); -_334.fillStyle=_332; -_334.fillRect(x-1,y-1,w+2,h+1); -}; -var _335=this.options.colorScheme.length; -var _336=this.options.colorScheme; -var _337=PlotKit.Base.keys(this.layout.datasets); -var _338=_337.length; -var _339=function(name){ -for(var i=0;i<_338;i++){ -if(name==_337[i]){ -return _336[i%_335]; -} -} -return _336[0]; -}; -var _340=function(_341,bar){ -var x=this.area.w*bar.x+this.area.x; -var y=this.area.h*bar.y+this.area.y; -var w=this.area.w*bar.w; -var h=this.area.h*bar.h; -if((w<1)||(h<1)){ -return; -} -_341.save(); -_341.shadowBlur=5; -_341.shadowColor=Color.fromHexString("#888888").toRGBString(); -if(this.isIE){ -_341.save(); -_341.fillStyle="#cccccc"; -_341.fillRect(x-2,y-2,w+4,h+2); -_341.restore(); -}else{ -_333(_341,x,y,w,h); -} -if(this.options.shouldFill){ -_341.fillStyle=_339(bar.name).toRGBString(); -_341.fillRect(x,y,w,h); -} -_341.shadowBlur=0; -_341.strokeStyle=Color.whiteColor().toRGBString(); -_341.lineWidth=2; -if(this.options.shouldStroke){ -_341.strokeRect(x,y,w,h); +PlotKit.CanvasRenderer.prototype.onclick=function(e){ +var _227=this._resolveObject(e); +var _228=this._createEventObject(_227,e); +if(_228!=null){ +MochiKit.Signal.signal(this,"onclick",_228); } -_341.restore(); -}; -this._renderBarChartWrap(this.layout.bars,bind(_340,this)); }; -PlotKit.SweetCanvasRenderer.prototype._renderLineChart=function(){ -var _342=this.element.getContext("2d"); -var _343=this.options.colorScheme.length; -var _344=this.options.colorScheme; -var _345=PlotKit.Base.keys(this.layout.datasets); -var _346=_345.length; -var bind=MochiKit.Base.bind; -for(var i=0;i<_346;i++){ -var _347=_345[i]; -var _348=_344[i%_343]; -var _349=this.options.strokeColorTransform; -_342.save(); -var _350=function(ctx){ -ctx.beginPath(); -ctx.moveTo(this.area.x,this.area.y+this.area.h); -var _351=function(ctx_,_352){ -if(_352.name==_347){ -ctx_.lineTo(this.area.w*_352.x+this.area.x,this.area.h*_352.y+this.area.y); +PlotKit.CanvasRenderer.prototype.onmouseover=function(e){ +var _229=this._resolveObject(e); +var _230=this._createEventObject(_229,e); +if(_230!=null){ +signal(this,"onmouseover",_230); } }; -MochiKit.Iter.forEach(this.layout.points,partial(_351,ctx),this); -ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y); -ctx.lineTo(this.area.x,this.area.y+this.area.h); -ctx.closePath(); -}; -if(this.options.shouldFill){ -_342.save(); -if(this.isIE){ -_342.fillStyle="#cccccc"; +PlotKit.CanvasRenderer.prototype.onmouseout=function(e){ +var _231=this._resolveObject(e); +var _232=this._createEventObject(_231,e); +if(_232==null){ +signal(this,"onmouseout",e); }else{ -_342.fillStyle=Color.blackColor().colorWithAlpha(0.2).toRGBString(); -} -_342.translate(-1,-2); -bind(_350,this)(_342); -if(this.options.shouldFill){ -_342.fill(); -} -_342.restore(); -} -_342.shadowBlur=5; -_342.shadowColor=Color.fromHexString("#888888").toRGBString(); -_342.fillStyle=_348.toRGBString(); -_342.lineWidth=2; -_342.strokeStyle=Color.whiteColor().toRGBString(); -if(this.options.shouldFill){ -bind(_350,this)(_342); -_342.fill(); -} -if(this.options.shouldStroke){ -bind(_350,this)(_342); -_342.stroke(); -} -_342.restore(); -} -}; -PlotKit.SweetCanvasRenderer.prototype._renderPieChart=function(){ -var _353=this.element.getContext("2d"); -var _354=this.options.colorScheme.length; -var _355=this.layout.slices; -var _356=this.area.x+this.area.w*0.5; -var _357=this.area.y+this.area.h*0.5; -var _358=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -if(this.isIE){ -_356=parseInt(_356); -_357=parseInt(_357); -_358=parseInt(_358); -} -if(!this.isIE){ -_353.save(); -var _359=Color.blackColor().colorWithAlpha(0.2); -_353.fillStyle=_359.toRGBString(); -_353.shadowBlur=5; -_353.shadowColor=Color.fromHexString("#888888").toRGBString(); -_353.translate(1,1); -_353.beginPath(); -_353.moveTo(_356,_357); -_353.arc(_356,_357,_358+2,0,Math.PI*2,false); -_353.closePath(); -_353.fill(); -_353.restore(); -} -_353.save(); -_353.strokeStyle=Color.whiteColor().toRGBString(); -_353.lineWidth=2; -for(var i=0;i<_355.length;i++){ -var _360=this.options.colorScheme[i%_354]; -_353.fillStyle=_360.toRGBString(); -var _361=function(){ -_353.beginPath(); -_353.moveTo(_356,_357); -_353.arc(_356,_357,_358,_355[i].startAngle-Math.PI/2,_355[i].endAngle-Math.PI/2,false); -_353.lineTo(_356,_357); -_353.closePath(); -}; -if(Math.abs(_355[i].startAngle-_355[i].endAngle)>0.0001){ -if(this.options.shouldFill){ -_361(); -_353.fill(); -} -if(this.options.shouldStroke){ -_361(); -_353.stroke(); -} -} -} -_353.restore(); -}; -PlotKit.SweetCanvasRenderer.prototype._renderBackground=function(){ -var _362=this.element.getContext("2d"); -if(this.layout.style=="bar"||this.layout.style=="line"){ -_362.save(); -_362.fillStyle=this.options.backgroundColor.toRGBString(); -_362.fillRect(this.area.x,this.area.y,this.area.w,this.area.h); -_362.strokeStyle=this.options.axisLineColor.toRGBString(); -_362.lineWidth=1; -var _363=this.layout.yticks; -var _364=false; -if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){ -_363=this.layout.xticks; -_364=true; -} -for(var i=0;i<_363.length;i++){ -var x1=0; -var y1=0; -var x2=0; -var y2=0; -if(_364){ -x1=_363[i][0]*this.area.w+this.area.x; -y1=this.area.y; -x2=x1; -y2=y1+this.area.h; -}else{ -x1=this.area.x; -y1=_363[i][0]*this.area.h+this.area.y; -x2=x1+this.area.w; -y2=y1; -} -_362.beginPath(); -_362.moveTo(x1,y1); -_362.lineTo(x2,y2); -_362.closePath(); -_362.stroke(); -} -_362.restore(); -}else{ -PlotKit.SweetCanvasRenderer.__super__._renderBackground.call(this); -} -}; -PlotKit.SweetCanvas={}; -PlotKit.SweetCanvas.SweetCanvasRenderer=PlotKit.SweetCanvasRenderer; -PlotKit.SweetCanvas.EXPORT=["SweetCanvasRenderer"]; -PlotKit.SweetCanvas.EXPORT_OK=["SweetCanvasRenderer"]; -PlotKit.SweetCanvas.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.SweetCanvas.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.SweetCanvas); -try{ -if(typeof (PlotKit.SVGRenderer)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "SweetSVG depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, SVG}"; -} -if(typeof (PlotKit.SweetSVGRenderer)=="undefined"){ -PlotKit.SweetSVGRenderer={}; -} -PlotKit.SweetSVGRenderer=function(_365,_366,_367){ -if(arguments.length>0){ -this.__init__(_365,_366,_367); +signal(this,"onmouseout",_232); } }; -PlotKit.SweetSVGRenderer.NAME="PlotKit.SweetSVGRenderer"; -PlotKit.SweetSVGRenderer.VERSION=PlotKit.VERSION; -PlotKit.SweetSVGRenderer.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.SweetSVGRenderer.toString=function(){ -return this.__repr__(); -}; -PlotKit.SweetSVGRenderer.prototype=new PlotKit.SVGRenderer(); -PlotKit.SweetSVGRenderer.prototype.constructor=PlotKit.SweetSVGRenderer; -PlotKit.SweetSVGRenderer.__super__=PlotKit.SVGRenderer.prototype; -PlotKit.SweetSVGRenderer.prototype.__init__=function(_368,_369,_370){ -var _371=PlotKit.Base.officeBlue(); -MochiKit.Base.update(_371,_370); -PlotKit.SweetSVGRenderer.__super__.__init__.call(this,_368,_369,_371); -}; -PlotKit.SweetSVGRenderer.prototype._addDropShadowFilter=function(){ -var _372=this.createSVGElement("filter",{x:0,y:0,"id":"dropShadow"}); -var _373=this.createSVGElement("feOffset",{"in":"SourceGraphic","dx":0,"dy":0,"result":"topCopy"}); -var blur=this.createSVGElement("feGaussianBlur",{"in":"SourceAlpha","StdDeviation":2,"result":"shadow"}); -var _375=this.createSVGElement("feOffset",{"in":"shadow","dx":-1,"dy":-2,"result":"movedShadow"}); -var _376=this.createSVGElement("feMerge"); -var _377=this.createSVGElement("feMergeNode",{"in":"topCopy"}); -var _378=this.createSVGElement("feMergeNode",{"in":"movedShadow"}); -_376.appendChild(_377); -_376.appendChild(_378); -_372.appendChild(_373); -_372.appendChild(blur); -_372.appendChild(_375); -_372.appendChild(_376); -this.defs.appendChild(_372); -}; -PlotKit.SweetSVGRenderer.prototype._renderBarChart=function(){ -var bind=MochiKit.Base.bind; -var _379=Color.blackColor().toRGBString(); -var _380="fill:"+_379+";fill-opacity:0.15"; -var _381="stroke-width: 2.0; stroke:"+Color.whiteColor().toRGBString(); -var _382=function(_383,bar){ -var x=this.area.w*bar.x+this.area.x; -var y=this.area.h*bar.y+this.area.y; -var w=this.area.w*bar.w; -var h=this.area.h*bar.h; -if((w<1)||(h<1)){ +PlotKit.CanvasRenderer.prototype.onmousemove=function(e){ +var _233=this._resolveObject(e); +var _234=this._createEventObject(_233,e); +if((_233==null)&&(this.event_isinside==null)){ return; } -_383["style"]=_381; -this._drawRect(x-2,y-1,w+4,h+2,{"style":_380}); -this._drawRect(x,y,w,h,_383); -}; -this._renderBarOrLine(this.layout.bars,bind(_382,this)); -}; -PlotKit.SweetSVGRenderer.prototype._renderLineChart=function(){ -var bind=MochiKit.Base.bind; -var _384=Color.blackColor().toRGBString(); -var _385="fill:"+_384+";fill-opacity:0.15"; -var _386="stroke-width: 2.0; stroke:"+Color.whiteColor().toRGBString(); -var _387=function(_388,_389){ -this._tempPointsBuffer+=(this.area.w*_389.x+this.area.x)+","+(this.area.h*_389.y+this.area.y)+" "; -}; -var _390=function(_391){ -this._tempPointsBuffer=""; -this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" "; -}; -var _392=function(_393){ -this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y); -_393["points"]=this._tempPointsBuffer; -_393["stroke"]="none"; -_393["transform"]="translate(-2, -1)"; -_393["style"]=_385; -var _394=this.createSVGElement("polygon",_393); -this.root.appendChild(_394); -_393["transform"]=""; -_393["style"]=_386; -var elem=this.createSVGElement("polygon",_393); -this.root.appendChild(elem); -}; -this._renderBarOrLine(this.layout.points,bind(_387,this),bind(_390,this),bind(_392,this)); -}; -PlotKit.SweetSVGRenderer.prototype._renderPieChart=function(){ -var _395=this.area.x+this.area.w*0.5; -var _396=this.area.y+this.area.h*0.5; -var _397=Color.blackColor().toRGBString(); -var _398=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -var _399="fill:"+_397+";fill-opacity:0.15"; -var _400=this.createSVGElement("circle",{"style":_399,"cx":_395+1,"cy":_396+1,"r":_398+1}); -this.root.appendChild(_400); -PlotKit.SweetSVGRenderer.__super__._renderPieChart.call(this); -}; -PlotKit.SweetSVGRenderer.prototype._renderBackground=function(){ -var _401={"fill":this.options.backgroundColor.toRGBString(),"stroke":"none"}; -if(this.layout.style=="bar"||this.layout.style=="line"){ -this._drawRect(this.area.x,this.area.y,this.area.w,this.area.h,_401); -var _402=this.layout.yticks; -var _403=false; -if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){ -_402=this.layout.xticks; -_403=true; -} -for(var i=0;i<_402.length;i++){ -var x=0; -var y=0; -var w=0; -var h=0; -if(_403){ -x=_402[i][0]*this.area.w+this.area.x; -y=this.area.y; -w=1; -h=this.area.w; -}else{ -x=this.area.x; -y=_402[i][0]*this.area.h+this.area.y; -w=this.area.w; -h=1; -} -this._drawRect(x,y,w,h,{"fill":this.options.axisLineColor.toRGBString()}); -} -}else{ -PlotKit.SweetSVGRenderer.__super__._renderBackground.call(this); -} -}; -PlotKit.SweetSVG={}; -PlotKit.SweetSVG.SweetSVGRenderer=PlotKit.SweetSVGRenderer; -PlotKit.SweetSVG.EXPORT=["SweetSVGRenderer"]; -PlotKit.SweetSVG.EXPORT_OK=["SweetSVGRenderer"]; -PlotKit.SweetSVG.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.SweetSVG.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.SweetSVG); -try{ -if(typeof (PlotKit.CanvasRenderer)=="undefined"){ -throw ""; -} +if((_233!=null)&&(this.event_isinside==null)){ +signal(this,"onmouseover",_234); } -catch(e){ -throw "PlotKit.EasyPlot depends on all of PlotKit's components"; +if((_233==null)&&(this.event_isinside!=null)){ +signal(this,"onmouseout",_234); } -if(typeof (PlotKit.EasyPlot)=="undefined"){ -PlotKit.EasyPlot={}; +if((_233!=null)&&(this.event_isinside!=null)){ +signal(this,"onmousemove",_234); } -PlotKit.EasyPlot.NAME="PlotKit.EasyPlot"; -PlotKit.EasyPlot.VERSION=PlotKit.VERSION; -PlotKit.EasyPlot.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.EasyPlot.toString=function(){ -return this.__repr__(); +this.event_isinside=_233; }; -PlotKit.EasyPlot=function(_404,_405,_406,_407){ -this.layout=new Layout(_404,_405); -this.divElem=_406; -this.width=parseInt(_406.getAttribute("width")); -this.height=parseInt(_406.getAttribute("height")); -this.deferredCount=0; -if(this.width<1){ -this.width=this.divElem.width?this.divElem.width:300; -} -if(this.height<1){ -this.height=this.divElem.height?this.divElem.height:300; -} -if(isArrayLike(_407)){ -for(var i=0;i<_407.length;i++){ -if(typeof (_407[i])=="string"){ -this.deferredCount++; -var d=MochiKit.Async.doSimpleXMLHttpRequest(_407[i]); -d.addCallback(MochiKit.Base.bind(PlotKit.EasyPlot.onDataLoaded,this)); -}else{ -if(isArrayLike(_407[i])){ -this.layout.addDataset("data-"+i,_407[i]); -} -} -} -}else{ -if(!isUndefinedOrNull(_407)){ -throw "Passed datasources are not Array like"; -} -} -if(CanvasRenderer.isSupported()){ -this.element=CANVAS({"id":this.divElem.getAttribute("id")+"-canvas","width":this.width,"height":this.height},""); -this.divElem.appendChild(this.element); -this.renderer=new SweetCanvasRenderer(this.element,this.layout,_405); +PlotKit.CanvasRenderer.isSupported=function(_235){ +var _236=null; +try{ +if(MochiKit.Base.isUndefinedOrNull(_235)){ +_236=MochiKit.DOM.CANVAS({}); }else{ -if(SVGRenderer.isSupported()){ -this.element=SVGRenderer.SVG({"id":this.divElem.getAttribute("id")+"-svg","width":this.width,"height":this.height,"version":"1.1","baseProfile":"full"},""); -this.divElem.appendChild(this.element); -this.renderer=new SweetSVGRenderer(this.element,this.layout,_405); -} -} -if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){ -this.layout.evaluate(); -this.renderer.clear(); -this.renderer.render(); +_236=MochiKit.DOM.getElement(_235); } -}; -PlotKit.EasyPlot.onDataLoaded=function(_409){ -var _410=new Array(); -var _411=_409.responseText.split("\n"); -for(var i=0;i<_411.length;i++){ -var _412=MochiKit.Format.strip(_411[i]); -if((_412.length>1)&&(_412.charAt(0)!="#")){ -_410.push(_412.split(",")); +var _237=_236.getContext("2d"); } +catch(e){ +var ie=navigator.appVersion.match(/MSIE (\d\.\d)/); +var _239=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1); +if((!ie)||(ie[1]<6)||(_239)){ +return false; } -this.layout.addDataset("data-ajax-"+this.deferredCount,_410); -this.deferredCount--; -if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){ -this.layout.evaluate(); -this.renderer.clear(); -this.renderer.render(); +return true; } +return true; }; -PlotKit.EasyPlot.prototype.reload=function(){ -this.layout.evaluate(); -this.renderer.clear(); -this.renderer.render(); -}; -PlotKit.EasyPlotModule={}; -PlotKit.EasyPlotModule.EasyPlot=PlotKit.EasyPlot; -PlotKit.EasyPlotModule.EXPORT=["EasyPlot"]; -PlotKit.EasyPlotModule.EXPORT_OK=[]; -PlotKit.EasyPlotModule.__new__=function(){ +PlotKit.Canvas={}; +PlotKit.Canvas.CanvasRenderer=PlotKit.CanvasRenderer; +PlotKit.Canvas.EXPORT=["CanvasRenderer"]; +PlotKit.Canvas.EXPORT_OK=["CanvasRenderer"]; +PlotKit.Canvas.__new__=function(){ var m=MochiKit.Base; m.nameFunctions(this); this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; }; -PlotKit.EasyPlotModule.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.EasyPlotModule); +PlotKit.Canvas.__new__(); +MochiKit.Base._exportSymbols(this,PlotKit.Canvas); // Copyright 2006 Dan Vanderkam (danvdk@gmail.com) @@ -9456,7 +5119,7 @@ DateGraph.prototype.__init__ = function(div, file, labels, attrs) { this.createRollInterface_(); this.createDragInterface_(); - MochiKit.DOM.addLoadEvent(this.start_()); + connect(window, 'onload', this, function(e) { this.start_(); }); }; /** diff --git a/dygraph-combined.js b/dygraph-combined.js index 7ed5828..f0123ae 100644 --- a/dygraph-combined.js +++ b/dygraph-combined.js @@ -1002,955 +1002,6 @@ serializeJSON=MochiKit.Base.serializeJSON; } MochiKit.Base._exportSymbols(this,MochiKit.Base); if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Iter"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Iter depends on MochiKit.Base!"; -} -if(typeof (MochiKit.Iter)=="undefined"){ -MochiKit.Iter={}; -} -MochiKit.Iter.NAME="MochiKit.Iter"; -MochiKit.Iter.VERSION="1.4"; -MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -},toString:function(){ -return this.__repr__(); -},registerIteratorFactory:function(name,_14e,_14f,_150){ -MochiKit.Iter.iteratorRegistry.register(name,_14e,_14f,_150); -},iter:function(_151,_152){ -var self=MochiKit.Iter; -if(arguments.length==2){ -return self.takewhile(function(a){ -return a!=_152; -},_151); -} -if(typeof (_151.next)=="function"){ -return _151; -}else{ -if(typeof (_151.iter)=="function"){ -return _151.iter(); -} -} -try{ -return self.iteratorRegistry.match(_151); -} -catch(e){ -var m=MochiKit.Base; -if(e==m.NotFound){ -e=new TypeError(typeof (_151)+": "+m.repr(_151)+" is not iterable"); -} -throw e; -} -},count:function(n){ -if(!n){ -n=0; -} -var m=MochiKit.Base; -return {repr:function(){ -return "count("+n+")"; -},toString:m.forwardCall("repr"),next:m.counter(n)}; -},cycle:function(p){ -var self=MochiKit.Iter; -var m=MochiKit.Base; -var lst=[]; -var _15c=self.iter(p); -return {repr:function(){ -return "cycle(...)"; -},toString:m.forwardCall("repr"),next:function(){ -try{ -var rval=_15c.next(); -lst.push(rval); -return rval; -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -if(lst.length===0){ -this.next=function(){ -throw self.StopIteration; -}; -}else{ -var i=-1; -this.next=function(){ -i=(i+1)%lst.length; -return lst[i]; -}; -} -return this.next(); -} -}}; -},repeat:function(elem,n){ -var m=MochiKit.Base; -if(typeof (n)=="undefined"){ -return {repr:function(){ -return "repeat("+m.repr(elem)+")"; -},toString:m.forwardCall("repr"),next:function(){ -return elem; -}}; -} -return {repr:function(){ -return "repeat("+m.repr(elem)+", "+n+")"; -},toString:m.forwardCall("repr"),next:function(){ -if(n<=0){ -throw MochiKit.Iter.StopIteration; -} -n-=1; -return elem; -}}; -},next:function(_162){ -return _162.next(); -},izip:function(p,q){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -var next=self.next; -var _168=m.map(self.iter,arguments); -return {repr:function(){ -return "izip(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return m.map(next,_168); -}}; -},ifilter:function(pred,seq){ -var m=MochiKit.Base; -seq=MochiKit.Iter.iter(seq); -if(pred===null){ -pred=m.operator.truth; -} -return {repr:function(){ -return "ifilter(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(true){ -var rval=seq.next(); -if(pred(rval)){ -return rval; -} -} -return undefined; -}}; -},ifilterfalse:function(pred,seq){ -var m=MochiKit.Base; -seq=MochiKit.Iter.iter(seq); -if(pred===null){ -pred=m.operator.truth; -} -return {repr:function(){ -return "ifilterfalse(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(true){ -var rval=seq.next(); -if(!pred(rval)){ -return rval; -} -} -return undefined; -}}; -},islice:function(seq){ -var self=MochiKit.Iter; -var m=MochiKit.Base; -seq=self.iter(seq); -var _174=0; -var stop=0; -var step=1; -var i=-1; -if(arguments.length==2){ -stop=arguments[1]; -}else{ -if(arguments.length==3){ -_174=arguments[1]; -stop=arguments[2]; -}else{ -_174=arguments[1]; -stop=arguments[2]; -step=arguments[3]; -} -} -return {repr:function(){ -return "islice("+["...",_174,stop,step].join(", ")+")"; -},toString:m.forwardCall("repr"),next:function(){ -var rval; -while(i<_174){ -rval=seq.next(); -i++; -} -if(_174>=stop){ -throw self.StopIteration; -} -_174+=step; -return rval; -}}; -},imap:function(fun,p,q){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -var _17e=m.map(self.iter,m.extend(null,arguments,1)); -var map=m.map; -var next=self.next; -return {repr:function(){ -return "imap(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return fun.apply(this,map(next,_17e)); -}}; -},applymap:function(fun,seq,self){ -seq=MochiKit.Iter.iter(seq); -var m=MochiKit.Base; -return {repr:function(){ -return "applymap(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return fun.apply(self,seq.next()); -}}; -},chain:function(p,q){ -var self=MochiKit.Iter; -var m=MochiKit.Base; -if(arguments.length==1){ -return self.iter(arguments[0]); -} -var _189=m.map(self.iter,arguments); -return {repr:function(){ -return "chain(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(_189.length>1){ -try{ -return _189[0].next(); -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -_189.shift(); -} -} -if(_189.length==1){ -var arg=_189.shift(); -this.next=m.bind("next",arg); -return this.next(); -} -throw self.StopIteration; -}}; -},takewhile:function(pred,seq){ -var self=MochiKit.Iter; -seq=self.iter(seq); -return {repr:function(){ -return "takewhile(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -var rval=seq.next(); -if(!pred(rval)){ -this.next=function(){ -throw self.StopIteration; -}; -this.next(); -} -return rval; -}}; -},dropwhile:function(pred,seq){ -seq=MochiKit.Iter.iter(seq); -var m=MochiKit.Base; -var bind=m.bind; -return {"repr":function(){ -return "dropwhile(...)"; -},"toString":m.forwardCall("repr"),"next":function(){ -while(true){ -var rval=seq.next(); -if(!pred(rval)){ -break; -} -} -this.next=bind("next",seq); -return rval; -}}; -},_tee:function(_194,sync,_196){ -sync.pos[_194]=-1; -var m=MochiKit.Base; -var _198=m.listMin; -return {repr:function(){ -return "tee("+_194+", ...)"; -},toString:m.forwardCall("repr"),next:function(){ -var rval; -var i=sync.pos[_194]; -if(i==sync.max){ -rval=_196.next(); -sync.deque.push(rval); -sync.max+=1; -sync.pos[_194]+=1; -}else{ -rval=sync.deque[i-sync.min]; -sync.pos[_194]+=1; -if(i==sync.min&&_198(sync.pos)!=sync.min){ -sync.min+=1; -sync.deque.shift(); -} -} -return rval; -}}; -},tee:function(_19b,n){ -var rval=[]; -var sync={"pos":[],"deque":[],"max":-1,"min":-1}; -if(arguments.length==1||typeof (n)=="undefined"||n===null){ -n=2; -} -var self=MochiKit.Iter; -_19b=self.iter(_19b); -var _tee=self._tee; -for(var i=0;i0&&_1ac>=stop)||(step<0&&_1ac<=stop)){ -throw MochiKit.Iter.StopIteration; -} -var rval=_1ac; -_1ac+=step; -return rval; -},repr:function(){ -return "range("+[_1ac,stop,step].join(", ")+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -},sum:function(_1b0,_1b1){ -if(typeof (_1b1)=="undefined"||_1b1===null){ -_1b1=0; -} -var x=_1b1; -var self=MochiKit.Iter; -_1b0=self.iter(_1b0); -try{ -while(true){ -x+=_1b0.next(); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -return x; -},exhaust:function(_1b4){ -var self=MochiKit.Iter; -_1b4=self.iter(_1b4); -try{ -while(true){ -_1b4.next(); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -},forEach:function(_1b6,func,self){ -var m=MochiKit.Base; -if(arguments.length>2){ -func=m.bind(func,self); -} -if(m.isArrayLike(_1b6)){ -try{ -for(var i=0;i<_1b6.length;i++){ -func(_1b6[i]); -} -} -catch(e){ -if(e!=MochiKit.Iter.StopIteration){ -throw e; -} -} -}else{ -self=MochiKit.Iter; -self.exhaust(self.imap(func,_1b6)); -} -},every:function(_1bb,func){ -var self=MochiKit.Iter; -try{ -self.ifilterfalse(func,_1bb).next(); -return false; -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -return true; -} -},sorted:function(_1be,cmp){ -var rval=MochiKit.Iter.list(_1be); -if(arguments.length==1){ -cmp=MochiKit.Base.compare; -} -rval.sort(cmp); -return rval; -},reversed:function(_1c1){ -var rval=MochiKit.Iter.list(_1c1); -rval.reverse(); -return rval; -},some:function(_1c3,func){ -var self=MochiKit.Iter; -try{ -self.ifilter(func,_1c3).next(); -return true; -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -return false; -} -},iextend:function(lst,_1c7){ -if(MochiKit.Base.isArrayLike(_1c7)){ -for(var i=0;i<_1c7.length;i++){ -lst.push(_1c7[i]); -} -}else{ -var self=MochiKit.Iter; -_1c7=self.iter(_1c7); -try{ -while(true){ -lst.push(_1c7.next()); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -} -return lst; -},groupby:function(_1ca,_1cb){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_1cb=m.operator.identity; -} -_1ca=self.iter(_1ca); -var pk=undefined; -var k=undefined; -var v; -function fetch(){ -v=_1ca.next(); -k=_1cb(v); -} -function eat(){ -var ret=v; -v=undefined; -return ret; -} -var _1d2=true; -var _1d3=m.compare; -return {repr:function(){ -return "groupby(...)"; -},next:function(){ -while(_1d3(k,pk)===0){ -fetch(); -if(_1d2){ -_1d2=false; -break; -} -} -pk=k; -return [k,{next:function(){ -if(v==undefined){ -fetch(); -} -if(_1d3(k,pk)!==0){ -throw self.StopIteration; -} -return eat(); -}}]; -}}; -},groupby_as_array:function(_1d4,_1d5){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_1d5=m.operator.identity; -} -_1d4=self.iter(_1d4); -var _1d8=[]; -var _1d9=true; -var _1da; -var _1db=m.compare; -while(true){ -try{ -var _1dc=_1d4.next(); -var key=_1d5(_1dc); -} -catch(e){ -if(e==self.StopIteration){ -break; -} -throw e; -} -if(_1d9||_1db(key,_1da)!==0){ -var _1de=[]; -_1d8.push([key,_1de]); -} -_1de.push(_1dc); -_1d9=false; -_1da=key; -} -return _1d8; -},arrayLikeIter:function(_1df){ -var i=0; -return {repr:function(){ -return "arrayLikeIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -if(i>=_1df.length){ -throw MochiKit.Iter.StopIteration; -} -return _1df[i++]; -}}; -},hasIterateNext:function(_1e1){ -return (_1e1&&typeof (_1e1.iterateNext)=="function"); -},iterateNextIter:function(_1e2){ -return {repr:function(){ -return "iterateNextIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -var rval=_1e2.iterateNext(); -if(rval===null||rval===undefined){ -throw MochiKit.Iter.StopIteration; -} -return rval; -}}; -}}); -MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter",]; -MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"]; -MochiKit.Iter.__new__=function(){ -var m=MochiKit.Base; -if(typeof (StopIteration)!="undefined"){ -this.StopIteration=StopIteration; -}else{ -this.StopIteration=new m.NamedError("StopIteration"); -} -this.iteratorRegistry=new m.AdapterRegistry(); -this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter); -this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -MochiKit.Iter.__new__(); -if(MochiKit.__export__){ -reduce=MochiKit.Iter.reduce; -} -MochiKit.Base._exportSymbols(this,MochiKit.Iter); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Logging"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Logging depends on MochiKit.Base!"; -} -if(typeof (MochiKit.Logging)=="undefined"){ -MochiKit.Logging={}; -} -MochiKit.Logging.NAME="MochiKit.Logging"; -MochiKit.Logging.VERSION="1.4"; -MochiKit.Logging.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Logging.toString=function(){ -return this.__repr__(); -}; -MochiKit.Logging.EXPORT=["LogLevel","LogMessage","Logger","alertListener","logger","log","logError","logDebug","logFatal","logWarning"]; -MochiKit.Logging.EXPORT_OK=["logLevelAtLeast","isLogMessage","compareLogMessage"]; -MochiKit.Logging.LogMessage=function(num,_1e6,info){ -this.num=num; -this.level=_1e6; -this.info=info; -this.timestamp=new Date(); -}; -MochiKit.Logging.LogMessage.prototype={repr:function(){ -var m=MochiKit.Base; -return "LogMessage("+m.map(m.repr,[this.num,this.level,this.info]).join(", ")+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_1e9){ -var self=MochiKit.Logging; -if(typeof (_1e9)=="string"){ -_1e9=self.LogLevel[_1e9]; -} -return function(msg){ -var _1ec=msg.level; -if(typeof (_1ec)=="string"){ -_1ec=self.LogLevel[_1ec]; -} -return _1ec>=_1e9; -}; -},isLogMessage:function(){ -var _1ed=MochiKit.Logging.LogMessage; -for(var i=0;i=0&&this._messages.length>this.maxSize){ -this._messages.shift(); -} -},getMessages:function(_1ff){ -var _200=0; -if(!(typeof (_1ff)=="undefined"||_1ff===null)){ -_200=Math.max(0,this._messages.length-_1ff); -} -return this._messages.slice(_200); -},getMessageText:function(_201){ -if(typeof (_201)=="undefined"||_201===null){ -_201=30; -} -var _202=this.getMessages(_201); -if(_202.length){ -var lst=map(function(m){ -return "\n ["+m.num+"] "+m.level+": "+m.info.join(" "); -},_202); -lst.unshift("LAST "+_202.length+" MESSAGES:"); -return lst.join(""); -} -return ""; -},debuggingBookmarklet:function(_205){ -if(typeof (MochiKit.LoggingPane)=="undefined"){ -alert(this.getMessageText()); -}else{ -MochiKit.LoggingPane.createLoggingPane(_205||false); -} -}}; -MochiKit.Logging.__new__=function(){ -this.LogLevel={ERROR:40,FATAL:50,WARNING:30,INFO:20,DEBUG:10}; -var m=MochiKit.Base; -m.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage); -var _207=m.partial; -var _208=this.Logger; -var _209=_208.prototype.baseLog; -m.update(this.Logger.prototype,{debug:_207(_209,"DEBUG"),log:_207(_209,"INFO"),error:_207(_209,"ERROR"),fatal:_207(_209,"FATAL"),warning:_207(_209,"WARNING")}); -var self=this; -var _20b=function(name){ -return function(){ -self.logger[name].apply(self.logger,arguments); -}; -}; -this.log=_20b("log"); -this.logError=_20b("error"); -this.logDebug=_20b("debug"); -this.logFatal=_20b("fatal"); -this.logWarning=_20b("warning"); -this.logger=new _208(); -this.logger.useNativeConsole=true; -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -if(typeof (printfire)=="undefined"&&typeof (document)!="undefined"&&document.createEvent&&typeof (dispatchEvent)!="undefined"){ -printfire=function(){ -printfire.args=arguments; -var ev=document.createEvent("Events"); -ev.initEvent("printfire",false,true); -dispatchEvent(ev); -}; -} -MochiKit.Logging.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Logging); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.DateTime"); -} -if(typeof (MochiKit)=="undefined"){ -MochiKit={}; -} -if(typeof (MochiKit.DateTime)=="undefined"){ -MochiKit.DateTime={}; -} -MochiKit.DateTime.NAME="MochiKit.DateTime"; -MochiKit.DateTime.VERSION="1.4"; -MochiKit.DateTime.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.DateTime.toString=function(){ -return this.__repr__(); -}; -MochiKit.DateTime.isoDate=function(str){ -str=str+""; -if(typeof (str)!="string"||str.length===0){ -return null; -} -var iso=str.split("-"); -if(iso.length===0){ -return null; -} -return new Date(iso[0],iso[1]-1,iso[2]); -}; -MochiKit.DateTime._isoRegexp=/(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/; -MochiKit.DateTime.isoTimestamp=function(str){ -str=str+""; -if(typeof (str)!="string"||str.length===0){ -return null; -} -var res=str.match(MochiKit.DateTime._isoRegexp); -if(typeof (res)=="undefined"||res===null){ -return null; -} -var year,_213,day,hour,min,sec,msec; -year=parseInt(res[1],10); -if(typeof (res[2])=="undefined"||res[2]===""){ -return new Date(year); -} -_213=parseInt(res[2],10)-1; -day=parseInt(res[3],10); -if(typeof (res[4])=="undefined"||res[4]===""){ -return new Date(year,_213,day); -} -hour=parseInt(res[4],10); -min=parseInt(res[5],10); -sec=(typeof (res[6])!="undefined"&&res[6]!=="")?parseInt(res[6],10):0; -if(typeof (res[7])!="undefined"&&res[7]!==""){ -msec=Math.round(1000*parseFloat("0."+res[7])); -}else{ -msec=0; -} -if((typeof (res[8])=="undefined"||res[8]==="")&&(typeof (res[9])=="undefined"||res[9]==="")){ -return new Date(year,_213,day,hour,min,sec,msec); -} -var ofs; -if(typeof (res[9])!="undefined"&&res[9]!==""){ -ofs=parseInt(res[10],10)*3600000; -if(typeof (res[11])!="undefined"&&res[11]!==""){ -ofs+=parseInt(res[11],10)*60000; -} -if(res[9]=="-"){ -ofs=-ofs; -} -}else{ -ofs=0; -} -return new Date(Date.UTC(year,_213,day,hour,min,sec,msec)-ofs); -}; -MochiKit.DateTime.toISOTime=function(date,_21b){ -if(typeof (date)=="undefined"||date===null){ -return null; -} -var hh=date.getHours(); -var mm=date.getMinutes(); -var ss=date.getSeconds(); -var lst=[((_21b&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)]; -return lst.join(":"); -}; -MochiKit.DateTime.toISOTimestamp=function(date,_221){ -if(typeof (date)=="undefined"||date===null){ -return null; -} -var sep=_221?"T":" "; -var foot=_221?"Z":""; -if(_221){ -date=new Date(date.getTime()+(date.getTimezoneOffset()*60000)); -} -return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_221)+foot; -}; -MochiKit.DateTime.toISODate=function(date){ -if(typeof (date)=="undefined"||date===null){ -return null; -} -var _225=MochiKit.DateTime._padTwo; -return [date.getFullYear(),_225(date.getMonth()+1),_225(date.getDate())].join("-"); -}; -MochiKit.DateTime.americanDate=function(d){ -d=d+""; -if(typeof (d)!="string"||d.length===0){ -return null; -} -var a=d.split("/"); -return new Date(a[2],a[0]-1,a[1]); -}; -MochiKit.DateTime._padTwo=function(n){ -return (n>9)?n:"0"+n; -}; -MochiKit.DateTime.toPaddedAmericanDate=function(d){ -if(typeof (d)=="undefined"||d===null){ -return null; -} -var _22a=MochiKit.DateTime._padTwo; -return [_22a(d.getMonth()+1),_22a(d.getDate()),d.getFullYear()].join("/"); -}; -MochiKit.DateTime.toAmericanDate=function(d){ -if(typeof (d)=="undefined"||d===null){ -return null; -} -return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/"); -}; -MochiKit.DateTime.EXPORT=["isoDate","isoTimestamp","toISOTime","toISOTimestamp","toISODate","americanDate","toPaddedAmericanDate","toAmericanDate"]; -MochiKit.DateTime.EXPORT_OK=[]; -MochiKit.DateTime.EXPORT_TAGS={":common":MochiKit.DateTime.EXPORT,":all":MochiKit.DateTime.EXPORT}; -MochiKit.DateTime.__new__=function(){ -var base=this.NAME+"."; -for(var k in this){ -var o=this[k]; -if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ -try{ -o.NAME=base+k; -} -catch(e){ -} -} -} -}; -MochiKit.DateTime.__new__(); -if(typeof (MochiKit.Base)!="undefined"){ -MochiKit.Base._exportSymbols(this,MochiKit.DateTime); -}else{ -(function(_22f,_230){ -if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){ -var all=_230.EXPORT_TAGS[":all"]; -for(var i=0;i_23a){ -var i=_242.length-_23a; -res=fmt.separator+_242.substring(i,_242.length)+res; -_242=_242.substring(0,i); +if(_154){ +while(_15c.length>_154){ +var i=_15c.length-_154; +res=fmt.separator+_15c.substring(i,_15c.length)+res; +_15c=_15c.substring(0,i); } } -res=_242+res; -if(_238>0){ -while(frac.length<_23b){ +res=_15c+res; +if(_152>0){ +while(frac.length<_155){ frac=frac+"0"; } res=res+fmt.decimal+frac; } -return _23d+res+_23e; +return _157+res+_158; }; }; -MochiKit.Format.numberFormatter=function(_246,_247,_248){ -if(typeof (_247)=="undefined"){ -_247=""; +MochiKit.Format.numberFormatter=function(_160,_161,_162){ +if(typeof (_161)=="undefined"){ +_161=""; } -var _249=_246.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); -if(!_249){ +var _163=_160.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); +if(!_163){ throw TypeError("Invalid pattern"); } -var _24a=_246.substr(0,_249.index); -var _24b=_246.substr(_249.index+_249[0].length); -if(_24a.search(/-/)==-1){ -_24a=_24a+"-"; +var _164=_160.substr(0,_163.index); +var _165=_160.substr(_163.index+_163[0].length); +if(_164.search(/-/)==-1){ +_164=_164+"-"; } -var _24c=_249[1]; -var frac=(typeof (_249[2])=="string"&&_249[2]!="")?_249[2]:""; -var _24e=(typeof (_249[3])=="string"&&_249[3]!=""); -var tmp=_24c.split(/,/); -var _250; -if(typeof (_248)=="undefined"){ -_248="default"; +var _166=_163[1]; +var frac=(typeof (_163[2])=="string"&&_163[2]!="")?_163[2]:""; +var _168=(typeof (_163[3])=="string"&&_163[3]!=""); +var tmp=_166.split(/,/); +var _16a; +if(typeof (_162)=="undefined"){ +_162="default"; } if(tmp.length==1){ -_250=null; +_16a=null; }else{ -_250=tmp[1].length; +_16a=tmp[1].length; } -var _251=_24c.length-_24c.replace(/0/g,"").length; -var _252=frac.length-frac.replace(/0/g,"").length; -var _253=frac.length; -var rval=MochiKit.Format._numberFormatter(_247,_24a,_24b,_248,_24e,_253,_251,_250,_252); +var _16b=_166.length-_166.replace(/0/g,"").length; +var _16c=frac.length-frac.replace(/0/g,"").length; +var _16d=frac.length; +var rval=MochiKit.Format._numberFormatter(_161,_164,_165,_162,_168,_16d,_16b,_16a,_16c); var m=MochiKit.Base; if(m){ var fn=arguments.callee; var args=m.concat(arguments); rval.repr=function(){ return [self.NAME,"(",map(m.repr,args).join(", "),")"].join(""); -}; -} -return rval; -}; -MochiKit.Format.formatLocale=function(_258){ -if(typeof (_258)=="undefined"||_258===null){ -_258="default"; -} -if(typeof (_258)=="string"){ -var rval=MochiKit.Format.LOCALE[_258]; -if(typeof (rval)=="string"){ -rval=arguments.callee(rval); -MochiKit.Format.LOCALE[_258]=rval; -} -return rval; -}else{ -return _258; -} -}; -MochiKit.Format.twoDigitAverage=function(_25a,_25b){ -if(_25b){ -var res=_25a/_25b; -if(!isNaN(res)){ -return MochiKit.Format.twoDigitFloat(_25a/_25b); -} -} -return "0"; -}; -MochiKit.Format.twoDigitFloat=function(_25d){ -var sign=(_25d<0?"-":""); -var s=Math.floor(Math.abs(_25d)*100).toString(); -if(s=="0"){ -return s; -} -if(s.length<3){ -while(s.charAt(s.length-1)=="0"){ -s=s.substring(0,s.length-1); -} -return sign+"0."+s; -} -var head=sign+s.substring(0,s.length-2); -var tail=s.substring(s.length-2,s.length); -if(tail=="00"){ -return head; -}else{ -if(tail.charAt(1)=="0"){ -return head+"."+tail.charAt(0); -}else{ -return head+"."+tail; -} -} -}; -MochiKit.Format.lstrip=function(str,_263){ -str=str+""; -if(typeof (str)!="string"){ -return null; -} -if(!_263){ -return str.replace(/^\s+/,""); -}else{ -return str.replace(new RegExp("^["+_263+"]+"),""); -} -}; -MochiKit.Format.rstrip=function(str,_265){ -str=str+""; -if(typeof (str)!="string"){ -return null; -} -if(!_265){ -return str.replace(/\s+$/,""); -}else{ -return str.replace(new RegExp("["+_265+"]+$"),""); -} -}; -MochiKit.Format.strip=function(str,_267){ -var self=MochiKit.Format; -return self.rstrip(self.lstrip(str,_267),_267); -}; -MochiKit.Format.truncToFixed=function(_269,_26a){ -_269=Math.floor(_269*Math.pow(10,_26a)); -var res=(_269*Math.pow(10,-_26a)).toFixed(_26a); -if(res.charAt(0)=="."){ -res="0"+res; -} -return res; -}; -MochiKit.Format.roundToFixed=function(_26c,_26d){ -return MochiKit.Format.truncToFixed(_26c+0.5*Math.pow(10,-_26d),_26d); -}; -MochiKit.Format.percentFormat=function(_26e){ -return MochiKit.Format.twoDigitFloat(100*_26e)+"%"; -}; -MochiKit.Format.EXPORT=["truncToFixed","roundToFixed","numberFormatter","formatLocale","twoDigitAverage","twoDigitFloat","percentFormat","lstrip","rstrip","strip"]; -MochiKit.Format.LOCALE={en_US:{separator:",",decimal:".",percent:"%"},de_DE:{separator:".",decimal:",",percent:"%"},fr_FR:{separator:" ",decimal:",",percent:"%"},"default":"en_US"}; -MochiKit.Format.EXPORT_OK=[]; -MochiKit.Format.EXPORT_TAGS={":all":MochiKit.Format.EXPORT,":common":MochiKit.Format.EXPORT}; -MochiKit.Format.__new__=function(){ -var base=this.NAME+"."; -var k,v,o; -for(k in this.LOCALE){ -o=this.LOCALE[k]; -if(typeof (o)=="object"){ -o.repr=function(){ -return this.NAME; -}; -o.NAME=base+"LOCALE."+k; -} -} -for(k in this){ -o=this[k]; -if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ -try{ -o.NAME=base+k; -} -catch(e){ -} -} -} -}; -MochiKit.Format.__new__(); -if(typeof (MochiKit.Base)!="undefined"){ -MochiKit.Base._exportSymbols(this,MochiKit.Format); -}else{ -(function(_273,_274){ -if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){ -var all=_274.EXPORT_TAGS[":all"]; -for(var i=0;i1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(fn,fn); -},addCallback:function(fn){ -if(arguments.length>1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(fn,null); -},addErrback:function(fn){ -if(arguments.length>1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(null,fn); -},addCallbacks:function(cb,eb){ -if(this.chained){ -throw new Error("Chained Deferreds can not be re-used"); -} -this.chain.push([cb,eb]); -if(this.fired>=0){ -this._fire(); -} -return this; -},_fire:function(){ -var _283=this.chain; -var _284=this.fired; -var res=this.results[_284]; -var self=this; -var cb=null; -while(_283.length>0&&this.paused===0){ -var pair=_283.shift(); -var f=pair[_284]; -if(f===null){ -continue; -} -try{ -res=f(res); -_284=((res instanceof Error)?1:0); -if(res instanceof MochiKit.Async.Deferred){ -cb=function(res){ -self._resback(res); -self.paused--; -if((self.paused===0)&&(self.fired>=0)){ -self._fire(); -} -}; -this.paused++; -} -} -catch(err){ -_284=1; -if(!(err instanceof Error)){ -err=new MochiKit.Async.GenericError(err); -} -res=err; -} -} -this.fired=_284; -this.results[_284]=res; -if(cb&&this.paused){ -res.addBoth(cb); -res.chained=true; -} -}}; -MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(){ -return eval("("+arguments[0].responseText+")"); -},succeed:function(_28b){ -var d=new MochiKit.Async.Deferred(); -d.callback.apply(d,arguments); -return d; -},fail:function(_28d){ -var d=new MochiKit.Async.Deferred(); -d.errback.apply(d,arguments); -return d; -},getXMLHttpRequest:function(){ -var self=arguments.callee; -if(!self.XMLHttpRequest){ -var _290=[function(){ -return new XMLHttpRequest(); -},function(){ -return new ActiveXObject("Msxml2.XMLHTTP"); -},function(){ -return new ActiveXObject("Microsoft.XMLHTTP"); -},function(){ -return new ActiveXObject("Msxml2.XMLHTTP.4.0"); -},function(){ -throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); -}]; -for(var i=0;i<_290.length;i++){ -var func=_290[i]; -try{ -self.XMLHttpRequest=func; -return func(); -} -catch(e){ -} -} -} -return self.XMLHttpRequest(); -},_xhr_onreadystatechange:function(d){ -var m=MochiKit.Base; -if(this.readyState==4){ -try{ -this.onreadystatechange=null; -} -catch(e){ -try{ -this.onreadystatechange=m.noop; -} -catch(e){ -} -} -var _295=null; -try{ -_295=this.status; -if(!_295&&m.isNotEmpty(this.responseText)){ -_295=304; -} -} -catch(e){ -} -if(_295==200||_295==201||_295==204||_295==304||_295==1223){ -d.callback(this); -}else{ -var err=new MochiKit.Async.XMLHttpRequestError(this,"Request failed"); -if(err.number){ -d.errback(err); -}else{ -d.errback(err); -} -} -} -},_xhr_canceller:function(req){ -try{ -req.onreadystatechange=null; -} -catch(e){ -try{ -req.onreadystatechange=MochiKit.Base.noop; -} -catch(e){ -} -} -req.abort(); -},sendXMLHttpRequest:function(req,_299){ -if(typeof (_299)=="undefined"||_299===null){ -_299=""; -} -var m=MochiKit.Base; -var self=MochiKit.Async; -var d=new self.Deferred(m.partial(self._xhr_canceller,req)); -try{ -req.onreadystatechange=m.bind(self._xhr_onreadystatechange,req,d); -req.send(_299); -} -catch(e){ -try{ -req.onreadystatechange=null; -} -catch(ignore){ -} -d.errback(e); +}; } -return d; -},doXHR:function(url,opts){ -var self=MochiKit.Async; -return self.callLater(0,self._doXHR,url,opts); -},_doXHR:function(url,opts){ -var m=MochiKit.Base; -opts=m.update({method:"GET",sendContent:""},opts); -var self=MochiKit.Async; -var req=self.getXMLHttpRequest(); -if(opts.queryString){ -var qs=m.queryString(opts.queryString); -if(qs){ -url+="?"+qs; +return rval; +}; +MochiKit.Format.formatLocale=function(_172){ +if(typeof (_172)=="undefined"||_172===null){ +_172="default"; } +if(typeof (_172)=="string"){ +var rval=MochiKit.Format.LOCALE[_172]; +if(typeof (rval)=="string"){ +rval=arguments.callee(rval); +MochiKit.Format.LOCALE[_172]=rval; } -if("username" in opts){ -req.open(opts.method,url,true,opts.username,opts.password); +return rval; }else{ -req.open(opts.method,url,true); +return _172; } -if(req.overrideMimeType&&opts.mimeType){ -req.overrideMimeType(opts.mimeType); +}; +MochiKit.Format.twoDigitAverage=function(_174,_175){ +if(_175){ +var res=_174/_175; +if(!isNaN(res)){ +return MochiKit.Format.twoDigitFloat(_174/_175); } -if(opts.headers){ -var _2a6=opts.headers; -if(!m.isArrayLike(_2a6)){ -_2a6=m.items(_2a6); } -for(var i=0;i<_2a6.length;i++){ -var _2a8=_2a6[i]; -var name=_2a8[0]; -var _2aa=_2a8[1]; -req.setRequestHeader(name,_2aa); +return "0"; +}; +MochiKit.Format.twoDigitFloat=function(_177){ +var sign=(_177<0?"-":""); +var s=Math.floor(Math.abs(_177)*100).toString(); +if(s=="0"){ +return s; } +if(s.length<3){ +while(s.charAt(s.length-1)=="0"){ +s=s.substring(0,s.length-1); } -return self.sendXMLHttpRequest(req,opts.sendContent); -},_buildURL:function(url){ -if(arguments.length>1){ -var m=MochiKit.Base; -var qs=m.queryString.apply(null,m.extend(null,arguments,1)); -if(qs){ -return url+"?"+qs; -} -} -return url; -},doSimpleXMLHttpRequest:function(url){ -var self=MochiKit.Async; -url=self._buildURL.apply(self,arguments); -return self.doXHR(url); -},loadJSONDoc:function(url){ -var self=MochiKit.Async; -url=self._buildURL.apply(self,arguments); -var d=self.doXHR(url,{"mimeType":"text/plain","headers":[["Accept","application/json"]]}); -d=d.addCallback(self.evalJSONRequest); -return d; -},wait:function(_2b3,_2b4){ -var d=new MochiKit.Async.Deferred(); -var m=MochiKit.Base; -if(typeof (_2b4)!="undefined"){ -d.addCallback(function(){ -return _2b4; -}); +return sign+"0."+s; } -var _2b7=setTimeout(m.bind("callback",d),Math.floor(_2b3*1000)); -d.canceller=function(){ -try{ -clearTimeout(_2b7); +var head=sign+s.substring(0,s.length-2); +var tail=s.substring(s.length-2,s.length); +if(tail=="00"){ +return head; +}else{ +if(tail.charAt(1)=="0"){ +return head+"."+tail.charAt(0); +}else{ +return head+"."+tail; } -catch(e){ } }; -return d; -},callLater:function(_2b8,func){ -var m=MochiKit.Base; -var _2bb=m.partial.apply(m,m.extend(null,arguments,1)); -return MochiKit.Async.wait(_2b8).addCallback(function(res){ -return _2bb(); -}); -}}); -MochiKit.Async.DeferredLock=function(){ -this.waiting=[]; -this.locked=false; -this.id=this._nextId(); -}; -MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){ -var d=new MochiKit.Async.Deferred(); -if(this.locked){ -this.waiting.push(d); +MochiKit.Format.lstrip=function(str,_17d){ +str=str+""; +if(typeof (str)!="string"){ +return null; +} +if(!_17d){ +return str.replace(/^\s+/,""); }else{ -this.locked=true; -d.callback(this); +return str.replace(new RegExp("^["+_17d+"]+"),""); } -return d; -},release:function(){ -if(!this.locked){ -throw TypeError("Tried to release an unlocked DeferredLock"); -} -this.locked=false; -if(this.waiting.length>0){ -this.locked=true; -this.waiting.shift().callback(this); -} -},_nextId:MochiKit.Base.counter(),repr:function(){ -var _2be; -if(this.locked){ -_2be="locked, "+this.waiting.length+" waiting"; -}else{ -_2be="unlocked"; -} -return "DeferredLock("+this.id+", "+_2be+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Async.DeferredList=function(list,_2c0,_2c1,_2c2,_2c3){ -MochiKit.Async.Deferred.apply(this,[_2c3]); -this.list=list; -var _2c4=[]; -this.resultList=_2c4; -this.finishedCount=0; -this.fireOnOneCallback=_2c0; -this.fireOnOneErrback=_2c1; -this.consumeErrors=_2c2; -var cb=MochiKit.Base.bind(this._cbDeferred,this); -for(var i=0;i=0){ var opt=elem.options[elem.selectedIndex]; @@ -2730,18 +1310,18 @@ if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ v=opt.text; } } -_2e3.push(name); -_2e4.push(v); +_198.push(name); +_199.push(v); return null; } -_2e3.push(name); -_2e4.push(""); +_198.push(name); +_199.push(""); return null; }else{ var opts=elem.options; if(!opts.length){ -_2e3.push(name); -_2e4.push(""); +_198.push(name); +_199.push(""); return null; } for(var i=0;i]+\svalue\s*=/i)){ v=opt.text; } } -_2e3.push(name); -_2e4.push(v); +_198.push(name); +_199.push(v); } return null; } } -if(_2e9==="FORM"||_2e9==="P"||_2e9==="SPAN"||_2e9==="DIV"){ +if(_19e==="FORM"||_19e==="P"||_19e==="SPAN"||_19e==="DIV"){ return elem.childNodes; } -_2e3.push(name); -_2e4.push(elem.value||""); +_198.push(name); +_199.push(elem.value||""); return null; } return elem.childNodes; }); -return [_2e3,_2e4]; +return [_198,_199]; },withDocument:function(doc,func){ var self=MochiKit.DOM; -var _2f2=self._document; +var _1a7=self._document; var rval; try{ self._document=doc; rval=func(); } catch(e){ -self._document=_2f2; +self._document=_1a7; throw e; } -self._document=_2f2; +self._document=_1a7; return rval; -},registerDOMConverter:function(name,_2f5,wrap,_2f7){ -MochiKit.DOM.domConverters.register(name,_2f5,wrap,_2f7); +},registerDOMConverter:function(name,_1aa,wrap,_1ac){ +MochiKit.DOM.domConverters.register(name,_1aa,wrap,_1ac); },coerceToDOM:function(node,ctx){ var m=MochiKit.Base; var im=MochiKit.Iter; var self=MochiKit.DOM; if(im){ var iter=im.iter; -var _2fe=im.repeat; +var _1b3=im.repeat; var map=m.map; } -var _300=self.domConverters; -var _301=arguments.callee; -var _302=m.NotFound; +var _1b5=self.domConverters; +var _1b6=arguments.callee; +var _1b7=m.NotFound; while(true){ if(typeof (node)=="undefined"||node===null){ return null; @@ -2829,49 +1409,49 @@ node=node.apply(ctx,[ctx]); continue; } if(im){ -var _303=null; +var _1b8=null; try{ -_303=iter(node); +_1b8=iter(node); } catch(e){ } -if(_303){ -return map(_301,_303,_2fe(ctx)); +if(_1b8){ +return map(_1b6,_1b8,_1b3(ctx)); } } try{ -node=_300.match(node,ctx); +node=_1b5.match(node,ctx); continue; } catch(e){ -if(e!=_302){ +if(e!=_1b7){ throw e; } } return self._document.createTextNode(node.toString()); } return undefined; -},isChildNode:function(node,_305){ +},isChildNode:function(node,_1ba){ var self=MochiKit.DOM; if(typeof (node)=="string"){ node=self.getElement(node); } -if(typeof (_305)=="string"){ -_305=self.getElement(_305); +if(typeof (_1ba)=="string"){ +_1ba=self.getElement(_1ba); } -if(node===_305){ +if(node===_1ba){ return true; } while(node&&node.tagName.toUpperCase()!="BODY"){ node=node.parentNode; -if(node===_305){ +if(node===_1ba){ return true; } } return false; -},setNodeAttribute:function(node,attr,_309){ +},setNodeAttribute:function(node,attr,_1be){ var o={}; -o[attr]=_309; +o[attr]=_1be; try{ return MochiKit.DOM.updateNodeAttributes(node,o); } @@ -2880,11 +1460,11 @@ catch(e){ return null; },getNodeAttribute:function(node,attr){ var self=MochiKit.DOM; -var _30e=self.attributeArray.renames[attr]; +var _1c3=self.attributeArray.renames[attr]; node=self.getElement(node); try{ -if(_30e){ -return node[_30e]; +if(_1c3){ +return node[_1c3]; } return node.getAttribute(attr); } @@ -2893,33 +1473,33 @@ catch(e){ return null; },removeNodeAttribute:function(node,attr){ var self=MochiKit.DOM; -var _312=self.attributeArray.renames[attr]; +var _1c7=self.attributeArray.renames[attr]; node=self.getElement(node); try{ -if(_312){ -return node[_312]; +if(_1c7){ +return node[_1c7]; } return node.removeAttribute(attr); } catch(e){ } return null; -},updateNodeAttributes:function(node,_314){ +},updateNodeAttributes:function(node,_1c9){ var elem=node; var self=MochiKit.DOM; if(typeof (node)=="string"){ elem=self.getElement(node); } -if(_314){ -var _317=MochiKit.Base.updatetree; +if(_1c9){ +var _1cc=MochiKit.Base.updatetree; if(self.attributeArray.compliant){ -for(var k in _314){ -var v=_314[k]; +for(var k in _1c9){ +var v=_1c9[k]; if(typeof (v)=="object"&&typeof (elem[k])=="object"){ if(k=="style"&&MochiKit.Style){ MochiKit.Style.setStyle(elem,v); }else{ -_317(elem[k],v); +_1cc(elem[k],v); } }else{ if(k.substring(0,2)=="on"){ @@ -2933,21 +1513,21 @@ elem.setAttribute(k,v); } } }else{ -var _31a=self.attributeArray.renames; -for(var k in _314){ -v=_314[k]; -var _31b=_31a[k]; +var _1cf=self.attributeArray.renames; +for(var k in _1c9){ +v=_1c9[k]; +var _1d0=_1cf[k]; if(k=="style"&&typeof (v)=="string"){ elem.style.cssText=v; }else{ -if(typeof (_31b)=="string"){ -elem[_31b]=v; +if(typeof (_1d0)=="string"){ +elem[_1d0]=v; }else{ if(typeof (elem[k])=="object"&&typeof (v)=="object"){ if(k=="style"&&MochiKit.Style){ MochiKit.Style.setStyle(elem,v); }else{ -_317(elem[k],v); +_1cc(elem[k],v); } }else{ if(k.substring(0,2)=="on"){ @@ -2971,16 +1551,16 @@ var self=MochiKit.DOM; if(typeof (node)=="string"){ elem=self.getElement(node); } -var _31f=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _320=MochiKit.Base.concat; -while(_31f.length){ -var n=_31f.shift(); +var _1d4=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +var _1d5=MochiKit.Base.concat; +while(_1d4.length){ +var n=_1d4.shift(); if(typeof (n)=="undefined"||n===null){ }else{ if(typeof (n.nodeType)=="number"){ elem.appendChild(n); }else{ -_31f=_320(n,_31f); +_1d4=_1d5(n,_1d4); } } } @@ -2991,32 +1571,32 @@ var self=MochiKit.DOM; if(typeof (node)=="string"){ elem=self.getElement(node); } -var _325=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _326=elem.parentNode; -var _327=MochiKit.Base.concat; -while(_325.length){ -var n=_325.shift(); +var _1da=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +var _1db=elem.parentNode; +var _1dc=MochiKit.Base.concat; +while(_1da.length){ +var n=_1da.shift(); if(typeof (n)=="undefined"||n===null){ }else{ if(typeof (n.nodeType)=="number"){ -_326.insertBefore(n,elem); +_1db.insertBefore(n,elem); }else{ -_325=_327(n,_325); +_1da=_1dc(n,_1da); } } } -return _326; +return _1db; },insertSiblingNodesAfter:function(node){ var elem=node; var self=MochiKit.DOM; if(typeof (node)=="string"){ elem=self.getElement(node); } -var _32c=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +var _1e1=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; if(elem.nextSibling){ -return self.insertSiblingNodesBefore(elem.nextSibling,_32c); +return self.insertSiblingNodesBefore(elem.nextSibling,_1e1); }else{ -return self.appendChildNodes(elem.parentNode,_32c); +return self.appendChildNodes(elem.parentNode,_1e1); } },replaceChildNodes:function(node){ var elem=node; @@ -3025,40 +1605,40 @@ if(typeof (node)=="string"){ elem=self.getElement(node); arguments[0]=elem; } -var _330; -while((_330=elem.firstChild)){ -elem.removeChild(_330); +var _1e5; +while((_1e5=elem.firstChild)){ +elem.removeChild(_1e5); } if(arguments.length<2){ return elem; }else{ return self.appendChildNodes.apply(this,arguments); } -},createDOM:function(name,_332){ +},createDOM:function(name,_1e7){ var elem; var self=MochiKit.DOM; var m=MochiKit.Base; -if(typeof (_332)=="string"||typeof (_332)=="number"){ +if(typeof (_1e7)=="string"||typeof (_1e7)=="number"){ var args=m.extend([name,null],arguments,1); return arguments.callee.apply(this,args); } if(typeof (name)=="string"){ -var _337=self._xhtml; -if(_332&&!self.attributeArray.compliant){ -var _338=""; -if("name" in _332){ -_338+=" name=\""+self.escapeHTML(_332.name)+"\""; +var _1ec=self._xhtml; +if(_1e7&&!self.attributeArray.compliant){ +var _1ed=""; +if("name" in _1e7){ +_1ed+=" name=\""+self.escapeHTML(_1e7.name)+"\""; } -if(name=="input"&&"type" in _332){ -_338+=" type=\""+self.escapeHTML(_332.type)+"\""; +if(name=="input"&&"type" in _1e7){ +_1ed+=" type=\""+self.escapeHTML(_1e7.type)+"\""; } -if(_338){ -name="<"+name+_338+">"; -_337=false; +if(_1ed){ +name="<"+name+_1ed+">"; +_1ec=false; } } var d=self._document; -if(_337&&d===document){ +if(_1ec&&d===document){ elem=d.createElementNS("http://www.w3.org/1999/xhtml",name); }else{ elem=d.createElement(name); @@ -3066,8 +1646,8 @@ elem=d.createElement(name); }else{ elem=name; } -if(_332){ -self.updateNodeAttributes(elem,_332); +if(_1e7){ +self.updateNodeAttributes(elem,_1e7); } if(arguments.length<=2){ return elem; @@ -3085,12 +1665,12 @@ return e; },swapDOM:function(dest,src){ var self=MochiKit.DOM; dest=self.getElement(dest); -var _340=dest.parentNode; +var _1f5=dest.parentNode; if(src){ src=self.getElement(src); -_340.replaceChild(src,dest); +_1f5.replaceChild(src,dest); }else{ -_340.removeChild(dest); +_1f5.removeChild(dest); } return src; },getElement:function(id){ @@ -3100,40 +1680,40 @@ return ((typeof (id)=="string")?self._document.getElementById(id):id); }else{ return MochiKit.Base.map(self.getElement,arguments); } -},getElementsByTagAndClassName:function(_343,_344,_345){ +},getElementsByTagAndClassName:function(_1f8,_1f9,_1fa){ var self=MochiKit.DOM; -if(typeof (_343)=="undefined"||_343===null){ -_343="*"; +if(typeof (_1f8)=="undefined"||_1f8===null){ +_1f8="*"; } -if(typeof (_345)=="undefined"||_345===null){ -_345=self._document; +if(typeof (_1fa)=="undefined"||_1fa===null){ +_1fa=self._document; } -_345=self.getElement(_345); -var _347=(_345.getElementsByTagName(_343)||self._document.all); -if(typeof (_344)=="undefined"||_344===null){ -return MochiKit.Base.extend(null,_347); +_1fa=self.getElement(_1fa); +var _1fc=(_1fa.getElementsByTagName(_1f8)||self._document.all); +if(typeof (_1f9)=="undefined"||_1f9===null){ +return MochiKit.Base.extend(null,_1fc); } -var _348=[]; -for(var i=0;i<_347.length;i++){ -var _34a=_347[i]; -var cls=_34a.className; +var _1fd=[]; +for(var i=0;i<_1fc.length;i++){ +var _1ff=_1fc[i]; +var cls=_1ff.className; if(!cls){ continue; } -var _34c=cls.split(" "); -for(var j=0;j<_34c.length;j++){ -if(_34c[j]==_344){ -_348.push(_34a); +var _201=cls.split(" "); +for(var j=0;j<_201.length;j++){ +if(_201[j]==_1f9){ +_1fd.push(_1ff); break; } } } -return _348; +return _1fd; },_newCallStack:function(path,once){ var rval=function(){ -var _351=arguments.callee.callStack; -for(var i=0;i<_351.length;i++){ -if(_351[i].apply(this,arguments)===false){ +var _206=arguments.callee.callStack; +for(var i=0;i<_206.length;i++){ +if(_206[i].apply(this,arguments)===false){ break; } } @@ -3147,102 +1727,102 @@ catch(e){ }; rval.callStack=[]; return rval; -},addToCallStack:function(_353,path,func,once){ +},addToCallStack:function(_208,path,func,once){ var self=MochiKit.DOM; -var _358=_353[path]; -var _359=_358; -if(!(typeof (_358)=="function"&&typeof (_358.callStack)=="object"&&_358.callStack!==null)){ -_359=self._newCallStack(path,once); -if(typeof (_358)=="function"){ -_359.callStack.push(_358); +var _20d=_208[path]; +var _20e=_20d; +if(!(typeof (_20d)=="function"&&typeof (_20d.callStack)=="object"&&_20d.callStack!==null)){ +_20e=self._newCallStack(path,once); +if(typeof (_20d)=="function"){ +_20e.callStack.push(_20d); } -_353[path]=_359; +_208[path]=_20e; } -_359.callStack.push(func); +_20e.callStack.push(func); },addLoadEvent:function(func){ var self=MochiKit.DOM; self.addToCallStack(self._window,"onload",func,true); -},focusOnLoad:function(_35c){ +},focusOnLoad:function(_211){ var self=MochiKit.DOM; self.addLoadEvent(function(){ -_35c=self.getElement(_35c); -if(_35c){ -_35c.focus(); +_211=self.getElement(_211); +if(_211){ +_211.focus(); } }); -},setElementClass:function(_35e,_35f){ +},setElementClass:function(_213,_214){ var self=MochiKit.DOM; -var obj=self.getElement(_35e); +var obj=self.getElement(_213); if(self.attributeArray.compliant){ -obj.setAttribute("class",_35f); +obj.setAttribute("class",_214); }else{ -obj.setAttribute("className",_35f); +obj.setAttribute("className",_214); } -},toggleElementClass:function(_362){ +},toggleElementClass:function(_217){ var self=MochiKit.DOM; for(var i=1;i"); -_385.push(""); -var _38f=dom.childNodes; -for(i=_38f.length-1;i>=0;i--){ -_385.push(_38f[i]); +_23a.push(""); +var _244=dom.childNodes; +for(i=_244.length-1;i>=0;i--){ +_23a.push(_244[i]); } }else{ lst.push("/>"); } }else{ if(dom.nodeType==3){ -lst.push(_387(dom.nodeValue)); +lst.push(_23c(dom.nodeValue)); } } } } return lst; -},scrapeText:function(node,_391){ +},scrapeText:function(node,_246){ var rval=[]; (function(node){ var cn=node.childNodes; @@ -3311,103 +1891,103 @@ for(var i=0;i0){ -var _3b8=m.filter; -_3b7=function(node){ -return _3b8(_3b7.ignoreAttrFilter,node.attributes); -}; -_3b7.ignoreAttr={}; -var _3ba=_3b6.attributes; -var _3bb=_3b7.ignoreAttr; -for(var i=0;i<_3ba.length;i++){ -var a=_3ba[i]; -_3bb[a.name]=a.value; -} -_3b7.ignoreAttrFilter=function(a){ -return (_3b7.ignoreAttr[a.name]!=a.value); -}; -_3b7.compliant=false; -_3b7.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"}; -}else{ -_3b7=function(node){ +var _26b=this._document.createElement("span"); +var _26c; +if(_26b&&_26b.attributes&&_26b.attributes.length>0){ +var _26d=m.filter; +_26c=function(node){ +return _26d(_26c.ignoreAttrFilter,node.attributes); +}; +_26c.ignoreAttr={}; +var _26f=_26b.attributes; +var _270=_26c.ignoreAttr; +for(var i=0;i<_26f.length;i++){ +var a=_26f[i]; +_270[a.name]=a.value; +} +_26c.ignoreAttrFilter=function(a){ +return (_26c.ignoreAttr[a.name]!=a.value); +}; +_26c.compliant=false; +_26c.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"}; +}else{ +_26c=function(node){ return node.attributes; }; -_3b7.compliant=true; -_3b7.renames={}; +_26c.compliant=true; +_26c.renames={}; } -this.attributeArray=_3b7; -var _3c0=function(_3c1,arr){ -var _3c3=arr[1].split("."); +this.attributeArray=_26c; +var _275=function(_276,arr){ +var _278=arr[1].split("."); var str=""; var obj={}; -str+="if (!MochiKit."+_3c3[1]+") { throw new Error(\""; +str+="if (!MochiKit."+_278[1]+") { throw new Error(\""; str+="This function has been deprecated and depends on MochiKit."; -str+=_3c3[1]+".\");}"; -str+="return MochiKit."+_3c3[1]+"."+arr[0]; +str+=_278[1]+".\");}"; +str+="return MochiKit."+_278[1]+"."+arr[0]; str+=".apply(this, arguments);"; -obj[_3c3[2]]=new Function(str); -MochiKit.Base.update(MochiKit[_3c1],obj); +obj[_278[2]]=new Function(str); +MochiKit.Base.update(MochiKit[_276],obj); }; for(var i;i0){ -abort(repr(expr)); -} -},buildMatchExpression:function(){ -var repr=MochiKit.Base.repr; -var _3d1=this.params; -var _3d2=[]; -var _3d3,i; -function childElements(_3d5){ -return "MochiKit.Base.filter(function (node) { return node.nodeType == 1; }, "+_3d5+".childNodes)"; -} -if(_3d1.wildcard){ -_3d2.push("true"); -} -if(_3d3=_3d1.id){ -_3d2.push("element.id == "+repr(_3d3)); -} -if(_3d3=_3d1.tagName){ -_3d2.push("element.tagName.toUpperCase() == "+repr(_3d3)); -} -if((_3d3=_3d1.classNames).length>0){ -for(i=0;i<_3d3.length;i++){ -_3d2.push("MochiKit.DOM.hasElementClass(element, "+repr(_3d3[i])+")"); -} -} -if((_3d3=_3d1.pseudoClassNames).length>0){ -for(i=0;i<_3d3.length;i++){ -var _3d6=_3d3[i].match(/^([^(]+)(?:\((.*)\))?$/); -var _3d7=_3d6[1]; -var _3d8=_3d6[2]; -switch(_3d7){ -case "root": -_3d2.push("element.nodeType == 9 || element === element.ownerDocument.documentElement"); -break; -case "nth-child": -case "nth-last-child": -case "nth-of-type": -case "nth-last-of-type": -_3d6=_3d8.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/); -if(!_3d6){ -throw "Invalid argument to pseudo element nth-child: "+_3d8; -} -var a,b; -if(_3d6[0]=="odd"){ -a=2; -b=1; -}else{ -if(_3d6[0]=="even"){ -a=2; -b=0; -}else{ -a=_3d6[2]&&parseInt(_3d6)||null; -b=parseInt(_3d6[3]); -} -} -_3d2.push("this.nthChild(element,"+a+","+b+","+!!_3d7.match("^nth-last")+","+!!_3d7.match("of-type$")+")"); -break; -case "first-child": -_3d2.push("this.nthChild(element, null, 1)"); -break; -case "last-child": -_3d2.push("this.nthChild(element, null, 1, true)"); -break; -case "first-of-type": -_3d2.push("this.nthChild(element, null, 1, false, true)"); -break; -case "last-of-type": -_3d2.push("this.nthChild(element, null, 1, true, true)"); -break; -case "only-child": -_3d2.push(childElements("element.parentNode")+".length == 1"); -break; -case "only-of-type": -_3d2.push("MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, "+childElements("element.parentNode")+").length == 1"); -break; -case "empty": -_3d2.push("element.childNodes.length == 0"); -break; -case "enabled": -_3d2.push("(this.isUIElement(element) && element.disabled === false)"); -break; -case "disabled": -_3d2.push("(this.isUIElement(element) && element.disabled === true)"); -break; -case "checked": -_3d2.push("(this.isUIElement(element) && element.checked === true)"); -break; -case "not": -var _3db=new MochiKit.Selector.Selector(_3d8); -_3d2.push("!( "+_3db.buildMatchExpression()+")"); -break; -} -} -} -if(_3d3=_3d1.attributes){ -MochiKit.Base.map(function(_3dc){ -var _3dd="MochiKit.DOM.getNodeAttribute(element, "+repr(_3dc.name)+")"; -var _3de=function(_3df){ -return _3dd+".split("+repr(_3df)+")"; -}; -switch(_3dc.operator){ -case "=": -_3d2.push(_3dd+" == "+repr(_3dc.value)); -break; -case "~=": -_3d2.push(_3dd+" && MochiKit.Base.findValue("+_3de(" ")+", "+repr(_3dc.value)+") > -1"); -break; -case "^=": -_3d2.push(_3dd+".substring(0, "+_3dc.value.length+") == "+repr(_3dc.value)); -break; -case "$=": -_3d2.push(_3dd+".substring("+_3dd+".length - "+_3dc.value.length+") == "+repr(_3dc.value)); -break; -case "*=": -_3d2.push(_3dd+".match("+repr(_3dc.value)+")"); -break; -case "|=": -_3d2.push(_3dd+" && "+_3de("-")+"[0].toUpperCase() == "+repr(_3dc.value.toUpperCase())); -break; -case "!=": -_3d2.push(_3dd+" != "+repr(_3dc.value)); -break; -case "": -case undefined: -_3d2.push(_3dd+" != null"); -break; -default: -throw "Unknown operator "+_3dc.operator+" in selector"; -} -},_3d3); -} -return _3d2.join(" && "); -},compileMatcher:function(){ -this.match=new Function("element","if (!element.tagName) return false; return "+this.buildMatchExpression()); -},nthChild:function(_3e0,a,b,_3e3,_3e4){ -var _3e5=MochiKit.Base.filter(function(node){ -return node.nodeType==1; -},_3e0.parentNode.childNodes); -if(_3e4){ -_3e5=MochiKit.Base.filter(function(node){ -return node.tagName==_3e0.tagName; -},_3e5); -} -if(_3e3){ -_3e5=MochiKit.Iter.reversed(_3e5); -} -if(a){ -var _3e8=MochiKit.Base.findIdentical(_3e5,_3e0); -return ((_3e8+1-b)/a)%1==0; -}else{ -return b==MochiKit.Base.findIdentical(_3e5,_3e0)+1; -} -},isUIElement:function(_3e9){ -return MochiKit.Base.findValue(["input","button","select","option","textarea","object"],_3e9.tagName.toLowerCase())>-1; -},findElements:function(_3ea,axis){ -var _3ec; -if(axis==undefined){ -axis=""; -} -function inScope(_3ed,_3ee){ -if(axis==""){ -return MochiKit.DOM.isChildNode(_3ed,_3ee); -}else{ -if(axis==">"){ -return _3ed.parentNode==_3ee; -}else{ -if(axis=="+"){ -return _3ed==nextSiblingElement(_3ee); -}else{ -if(axis=="~"){ -var _3ef=_3ee; -while(_3ef=nextSiblingElement(_3ef)){ -if(_3ed==_3ef){ -return true; -} -} -return false; -}else{ -throw "Invalid axis: "+axis; -} -} -} -} -} -if(_3ec=MochiKit.DOM.getElement(this.params.id)){ -if(this.match(_3ec)){ -if(!_3ea||inScope(_3ec,_3ea)){ -return [_3ec]; -} -} -} -function nextSiblingElement(node){ -node=node.nextSibling; -while(node&&node.nodeType!=1){ -node=node.nextSibling; -} -return node; -} -if(axis==""){ -_3ea=(_3ea||MochiKit.DOM.currentDocument()).getElementsByTagName(this.params.tagName||"*"); -}else{ -if(axis==">"){ -if(!_3ea){ -throw "> combinator not allowed without preceeding expression"; -} -_3ea=MochiKit.Base.filter(function(node){ -return node.nodeType==1; -},_3ea.childNodes); -}else{ -if(axis=="+"){ -if(!_3ea){ -throw "+ combinator not allowed without preceeding expression"; -} -_3ea=nextSiblingElement(_3ea)&&[nextSiblingElement(_3ea)]; -}else{ -if(axis=="~"){ -if(!_3ea){ -throw "~ combinator not allowed without preceeding expression"; -} -var _3f2=[]; -while(nextSiblingElement(_3ea)){ -_3ea=nextSiblingElement(_3ea); -_3f2.push(_3ea); -} -_3ea=_3f2; -} -} -} -} -if(!_3ea){ -return []; -} -var _3f3=MochiKit.Base.filter(MochiKit.Base.bind(function(_3f4){ -return this.match(_3f4); -},this),_3ea); -return _3f3; -},repr:function(){ -return "Selector("+this.expression+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Base.update(MochiKit.Selector,{findChildElements:function(_3f5,_3f6){ -return MochiKit.Base.flattenArray(MochiKit.Base.map(function(_3f7){ -var _3f8=""; -return MochiKit.Iter.reduce(function(_3f9,expr){ -if(match=expr.match(/^[>+~]$/)){ -_3f8=match[0]; -return _3f9; -}else{ -var _3fb=new MochiKit.Selector.Selector(expr); -var _3fc=MochiKit.Iter.reduce(function(_3fd,_3fe){ -return MochiKit.Base.extend(_3fd,_3fb.findElements(_3fe||_3f5,_3f8)); -},_3f9,[]); -_3f8=""; -return _3fc; -} -},_3f7.replace(/(^\s+|\s+$)/g,"").split(/\s+/),[null]); -},_3f6)); -},findDocElements:function(){ -return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(),arguments); -},__new__:function(){ -var m=MochiKit.Base; -this.$$=this.findDocElements; -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}}); -MochiKit.Selector.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Selector); -if(typeof (dojo)!="undefined"){ dojo.provide("MochiKit.Style"); dojo.require("MochiKit.Base"); dojo.require("MochiKit.DOM"); @@ -3930,57 +2164,57 @@ return "{x: "+repr(this.x)+", y: "+repr(this.y)+"}"; MochiKit.Style.Coordinates.prototype.toString=function(){ return this.__repr__(); }; -MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_407){ +MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_283){ var dom=MochiKit.DOM; var d=dom._document; elem=dom.getElement(elem); -_407=MochiKit.Base.camelize(_407); +_283=MochiKit.Base.camelize(_283); if(!elem||elem==d){ return undefined; } -if(_407=="opacity"&&elem.filters){ -var _40a=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/); -if(_40a&&_40a[1]){ -return parseFloat(_40a[1])/100; +if(_283=="opacity"&&elem.filters){ +var _286=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/); +if(_286&&_286[1]){ +return parseFloat(_286[1])/100; } return 1; } -var _40b=elem.style?elem.style[_407]:null; -if(!_40b){ +var _287=elem.style?elem.style[_283]:null; +if(!_287){ if(d.defaultView&&d.defaultView.getComputedStyle){ var css=d.defaultView.getComputedStyle(elem,null); -_407=_407.replace(/([A-Z])/g,"-$1").toLowerCase(); -_40b=css?css.getPropertyValue(_407):null; +_283=_283.replace(/([A-Z])/g,"-$1").toLowerCase(); +_287=css?css.getPropertyValue(_283):null; }else{ if(elem.currentStyle){ -_40b=elem.currentStyle[_407]; +_287=elem.currentStyle[_283]; } } } -if(_407=="opacity"){ -_40b=parseFloat(_40b); +if(_283=="opacity"){ +_287=parseFloat(_287); } -if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_407)!=-1)){ +if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_283)!=-1)){ if(MochiKit.Style.getStyle(elem,"position")=="static"){ -_40b="auto"; +_287="auto"; } } -return _40b=="auto"?null:_40b; -},setStyle:function(elem,_40e){ +return _287=="auto"?null:_287; +},setStyle:function(elem,_28a){ elem=MochiKit.DOM.getElement(elem); -for(var name in _40e){ +for(var name in _28a){ if(name=="opacity"){ -MochiKit.Style.setOpacity(elem,_40e[name]); +MochiKit.Style.setOpacity(elem,_28a[name]); }else{ -elem.style[MochiKit.Base.camelize(name)]=_40e[name]; +elem.style[MochiKit.Base.camelize(name)]=_28a[name]; } } },setOpacity:function(elem,o){ elem=MochiKit.DOM.getElement(elem); var self=MochiKit.Style; if(o==1){ -var _413=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)); -elem.style["opacity"]=_413?0.999999:1; +var _28f=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)); +elem.style["opacity"]=_28f?0.999999:1; if(/MSIE/.test(navigator.userAgent)){ elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,""); } @@ -3993,7 +2227,7 @@ if(/MSIE/.test(navigator.userAgent)){ elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")"; } } -},getElementPosition:function(elem,_415){ +},getElementPosition:function(elem,_291){ var self=MochiKit.Style; var dom=MochiKit.DOM; elem=dom.getElement(elem); @@ -4002,7 +2236,7 @@ return undefined; } var c=new self.Coordinates(0,0); var box=null; -var _41a=null; +var _296=null; var d=MochiKit.DOM._document; var de=d.documentElement; var b=d.body; @@ -4018,12 +2252,12 @@ c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0); if(elem.offsetParent){ c.x+=elem.offsetLeft; c.y+=elem.offsetTop; -_41a=elem.offsetParent; -if(_41a!=elem){ -while(_41a){ -c.x+=_41a.offsetLeft; -c.y+=_41a.offsetTop; -_41a=_41a.offsetParent; +_296=elem.offsetParent; +if(_296!=elem){ +while(_296){ +c.x+=_296.offsetLeft; +c.y+=_296.offsetTop; +_296=_296.offsetParent; } } var ua=navigator.userAgent.toLowerCase(); @@ -4034,49 +2268,49 @@ c.y-=b.offsetTop; } } } -if(typeof (_415)!="undefined"){ -_415=arguments.callee(_415); -if(_415){ -c.x-=(_415.x||0); -c.y-=(_415.y||0); +if(typeof (_291)!="undefined"){ +_291=arguments.callee(_291); +if(_291){ +c.x-=(_291.x||0); +c.y-=(_291.y||0); } } if(elem.parentNode){ -_41a=elem.parentNode; +_296=elem.parentNode; }else{ -_41a=null; +_296=null; } -while(_41a){ -var _41f=_41a.tagName.toUpperCase(); -if(_41f==="BODY"||_41f==="HTML"){ +while(_296){ +var _29b=_296.tagName.toUpperCase(); +if(_29b==="BODY"||_29b==="HTML"){ break; } -var disp=self.getStyle(_41a,"display"); +var disp=self.getStyle(_296,"display"); if(disp!="inline"&&disp!="table-row"){ -c.x-=_41a.scrollLeft; -c.y-=_41a.scrollTop; +c.x-=_296.scrollLeft; +c.y-=_296.scrollTop; } -if(_41a.parentNode){ -_41a=_41a.parentNode; +if(_296.parentNode){ +_296=_296.parentNode; }else{ -_41a=null; +_296=null; } } return c; -},setElementPosition:function(elem,_422,_423){ +},setElementPosition:function(elem,_29e,_29f){ elem=MochiKit.DOM.getElement(elem); -if(typeof (_423)=="undefined"){ -_423="px"; +if(typeof (_29f)=="undefined"){ +_29f="px"; } -var _424={}; -var _425=MochiKit.Base.isUndefinedOrNull; -if(!_425(_422.x)){ -_424["left"]=_422.x+_423; +var _2a0={}; +var _2a1=MochiKit.Base.isUndefinedOrNull; +if(!_2a1(_29e.x)){ +_2a0["left"]=_29e.x+_29f; } -if(!_425(_422.y)){ -_424["top"]=_422.y+_423; +if(!_2a1(_29e.y)){ +_2a0["top"]=_29e.y+_29f; } -MochiKit.DOM.updateNodeAttributes(elem,{"style":_424}); +MochiKit.DOM.updateNodeAttributes(elem,{"style":_2a0}); },getElementDimensions:function(elem){ var self=MochiKit.Style; var dom=MochiKit.DOM; @@ -4092,38 +2326,38 @@ if(disp!="none"&&disp!==""&&typeof (disp)!="undefined"){ return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0); } var s=elem.style; -var _42b=s.visibility; -var _42c=s.position; +var _2a7=s.visibility; +var _2a8=s.position; s.visibility="hidden"; s.position="absolute"; s.display=""; -var _42d=elem.offsetWidth; -var _42e=elem.offsetHeight; +var _2a9=elem.offsetWidth; +var _2aa=elem.offsetHeight; s.display="none"; -s.position=_42c; -s.visibility=_42b; -return new self.Dimensions(_42d,_42e); -},setElementDimensions:function(elem,_430,_431){ +s.position=_2a8; +s.visibility=_2a7; +return new self.Dimensions(_2a9,_2aa); +},setElementDimensions:function(elem,_2ac,_2ad){ elem=MochiKit.DOM.getElement(elem); -if(typeof (_431)=="undefined"){ -_431="px"; +if(typeof (_2ad)=="undefined"){ +_2ad="px"; } -var _432={}; -var _433=MochiKit.Base.isUndefinedOrNull; -if(!_433(_430.w)){ -_432["width"]=_430.w+_431; +var _2ae={}; +var _2af=MochiKit.Base.isUndefinedOrNull; +if(!_2af(_2ac.w)){ +_2ae["width"]=_2ac.w+_2ad; } -if(!_433(_430.h)){ -_432["height"]=_430.h+_431; +if(!_2af(_2ac.h)){ +_2ae["height"]=_2ac.h+_2ad; } -MochiKit.DOM.updateNodeAttributes(elem,{"style":_432}); -},setDisplayForElement:function(_434,_435){ -var _436=MochiKit.Base.extend(null,arguments,1); -var _437=MochiKit.DOM.getElement; -for(var i=0;i<_436.length;i++){ -_435=_437(_436[i]); -if(_435){ -_435.style.display=_434; +MochiKit.DOM.updateNodeAttributes(elem,{"style":_2ae}); +},setDisplayForElement:function(_2b0,_2b1){ +var _2b2=MochiKit.Base.extend(null,arguments,1); +var _2b3=MochiKit.DOM.getElement; +for(var i=0;i<_2b2.length;i++){ +_2b1=_2b3(_2b2[i]); +if(_2b1){ +_2b1.style.display=_2b0; } } },getViewportDimensions:function(){ @@ -4161,276 +2395,16 @@ c.y=db.scrollTop; } return c; },__new__:function(){ -var m=MochiKit.Base; -this.elementPosition=this.getElementPosition; -this.elementDimensions=this.getElementDimensions; -this.hideElement=m.partial(this.setDisplayForElement,"none"); -this.showElement=m.partial(this.setDisplayForElement,"block"); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}}); -MochiKit.Style.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Style); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.LoggingPane"); -dojo.require("MochiKit.Logging"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Logging",[]); -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.Logging)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.LoggingPane depends on MochiKit.Base and MochiKit.Logging!"; -} -if(typeof (MochiKit.LoggingPane)=="undefined"){ -MochiKit.LoggingPane={}; -} -MochiKit.LoggingPane.NAME="MochiKit.LoggingPane"; -MochiKit.LoggingPane.VERSION="1.4"; -MochiKit.LoggingPane.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.LoggingPane.toString=function(){ -return this.__repr__(); -}; -MochiKit.LoggingPane.createLoggingPane=function(_441){ -var m=MochiKit.LoggingPane; -_441=!(!_441); -if(m._loggingPane&&m._loggingPane.inline!=_441){ -m._loggingPane.closePane(); -m._loggingPane=null; -} -if(!m._loggingPane||m._loggingPane.closed){ -m._loggingPane=new m.LoggingPane(_441,MochiKit.Logging.logger); -} -return m._loggingPane; -}; -MochiKit.LoggingPane.LoggingPane=function(_443,_444){ -if(typeof (_444)=="undefined"||_444===null){ -_444=MochiKit.Logging.logger; -} -this.logger=_444; -var _445=MochiKit.Base.update; -var _446=MochiKit.Base.updatetree; -var bind=MochiKit.Base.bind; -var _448=MochiKit.Base.clone; -var win=window; -var uid="_MochiKit_LoggingPane"; -if(typeof (MochiKit.DOM)!="undefined"){ -win=MochiKit.DOM.currentWindow(); -} -if(!_443){ -var url=win.location.href.split("?")[0].replace(/[#:\/.><&-]/g,"_"); -var name=uid+"_"+url; -var nwin=win.open("",name,"dependent,resizable,height=200"); -if(!nwin){ -alert("Not able to open debugging window due to pop-up blocking."); -return undefined; -} -nwin.document.write(""+"[MochiKit.LoggingPane]"+""); -nwin.document.close(); -nwin.document.title+=" "+win.document.title; -win=nwin; -} -var doc=win.document; -this.doc=doc; -var _44f=doc.getElementById(uid); -var _450=!!_44f; -if(_44f&&typeof (_44f.loggingPane)!="undefined"){ -_44f.loggingPane.logger=this.logger; -_44f.loggingPane.buildAndApplyFilter(); -return _44f.loggingPane; -} -if(_450){ -var _451; -while((_451=_44f.firstChild)){ -_44f.removeChild(_451); -} -}else{ -_44f=doc.createElement("div"); -_44f.id=uid; -} -_44f.loggingPane=this; -var _452=doc.createElement("input"); -var _453=doc.createElement("input"); -var _454=doc.createElement("button"); -var _455=doc.createElement("button"); -var _456=doc.createElement("button"); -var _457=doc.createElement("button"); -var _458=doc.createElement("div"); -var _459=doc.createElement("div"); -var _45a=uid+"_Listener"; -this.colorTable=_448(this.colorTable); -var _45b=[]; -var _45c=null; -var _45d=function(msg){ -var _45f=msg.level; -if(typeof (_45f)=="number"){ -_45f=MochiKit.Logging.LogLevel[_45f]; -} -return _45f; -}; -var _460=function(msg){ -return msg.info.join(" "); -}; -var _462=bind(function(msg){ -var _464=_45d(msg); -var text=_460(msg); -var c=this.colorTable[_464]; -var p=doc.createElement("span"); -p.className="MochiKit-LogMessage MochiKit-LogLevel-"+_464; -p.style.cssText="margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: "+c; -p.appendChild(doc.createTextNode(_464+": "+text)); -_459.appendChild(p); -_459.appendChild(doc.createElement("br")); -if(_458.offsetHeight>_458.scrollHeight){ -_458.scrollTop=0; -}else{ -_458.scrollTop=_458.scrollHeight; -} -},this); -var _468=function(msg){ -_45b[_45b.length]=msg; -_462(msg); -}; -var _46a=function(){ -var _46b,_46c; -try{ -_46b=new RegExp(_452.value); -_46c=new RegExp(_453.value); -} -catch(e){ -logDebug("Error in filter regex: "+e.message); -return null; -} -return function(msg){ -return (_46b.test(_45d(msg))&&_46c.test(_460(msg))); -}; -}; -var _46e=function(){ -while(_459.firstChild){ -_459.removeChild(_459.firstChild); -} -}; -var _46f=function(){ -_45b=[]; -_46e(); -}; -var _470=bind(function(){ -if(this.closed){ -return; -} -this.closed=true; -if(MochiKit.LoggingPane._loggingPane==this){ -MochiKit.LoggingPane._loggingPane=null; -} -this.logger.removeListener(_45a); -try{ -try{ -_44f.loggingPane=null; -} -catch(e){ -logFatal("Bookmarklet was closed incorrectly."); -} -if(_443){ -_44f.parentNode.removeChild(_44f); -}else{ -this.win.close(); -} -} -catch(e){ -} -},this); -var _471=function(){ -_46e(); -for(var i=0;i<_45b.length;i++){ -var msg=_45b[i]; -if(_45c===null||_45c(msg)){ -_462(msg); -} -} -}; -this.buildAndApplyFilter=function(){ -_45c=_46a(); -_471(); -this.logger.removeListener(_45a); -this.logger.addListener(_45a,_45c,_468); -}; -var _474=bind(function(){ -_45b=this.logger.getMessages(); -_471(); -},this); -var _475=bind(function(_476){ -_476=_476||window.event; -key=_476.which||_476.keyCode; -if(key==13){ -this.buildAndApplyFilter(); -} -},this); -var _477="display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: "+this.logFont; -if(_443){ -_477+="; height: 10em; border-top: 2px solid black"; -}else{ -_477+="; height: 100%;"; -} -_44f.style.cssText=_477; -if(!_450){ -doc.body.appendChild(_44f); -} -_477={"cssText":"width: 33%; display: inline; font: "+this.logFont}; -_446(_452,{"value":"FATAL|ERROR|WARNING|INFO|DEBUG","onkeypress":_475,"style":_477}); -_44f.appendChild(_452); -_446(_453,{"value":".*","onkeypress":_475,"style":_477}); -_44f.appendChild(_453); -_477="width: 8%; display:inline; font: "+this.logFont; -_454.appendChild(doc.createTextNode("Filter")); -_454.onclick=bind("buildAndApplyFilter",this); -_454.style.cssText=_477; -_44f.appendChild(_454); -_455.appendChild(doc.createTextNode("Load")); -_455.onclick=_474; -_455.style.cssText=_477; -_44f.appendChild(_455); -_456.appendChild(doc.createTextNode("Clear")); -_456.onclick=_46f; -_456.style.cssText=_477; -_44f.appendChild(_456); -_457.appendChild(doc.createTextNode("Close")); -_457.onclick=_470; -_457.style.cssText=_477; -_44f.appendChild(_457); -_458.style.cssText="overflow: auto; width: 100%"; -_459.style.cssText="width: 100%; height: "+(_443?"8em":"100%"); -_458.appendChild(_459); -_44f.appendChild(_458); -this.buildAndApplyFilter(); -_474(); -if(_443){ -this.win=undefined; -}else{ -this.win=win; -} -this.inline=_443; -this.closePane=_470; -this.closed=false; -return this; -}; -MochiKit.LoggingPane.LoggingPane.prototype={"logFont":"8pt Verdana,sans-serif","colorTable":{"ERROR":"red","FATAL":"darkred","WARNING":"blue","INFO":"black","DEBUG":"green"}}; -MochiKit.LoggingPane.EXPORT_OK=["LoggingPane"]; -MochiKit.LoggingPane.EXPORT=["createLoggingPane"]; -MochiKit.LoggingPane.__new__=function(){ -this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}; -MochiKit.Base.nameFunctions(this); -MochiKit.LoggingPane._loggingPane=null; -}; -MochiKit.LoggingPane.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.LoggingPane); +var m=MochiKit.Base; +this.elementPosition=this.getElementPosition; +this.elementDimensions=this.getElementDimensions; +this.hideElement=m.partial(this.setDisplayForElement,"none"); +this.showElement=m.partial(this.setDisplayForElement,"block"); +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; +m.nameFunctions(this); +}}); +MochiKit.Style.__new__(); +MochiKit.Base._exportSymbols(this,MochiKit.Style); if(typeof (dojo)!="undefined"){ dojo.provide("MochiKit.Color"); dojo.require("MochiKit.Base"); @@ -4477,53 +2451,53 @@ return "["+this.NAME+" "+this.VERSION+"]"; MochiKit.Color.toString=function(){ return this.__repr__(); }; -MochiKit.Color.Color=function(red,_479,blue,_47b){ -if(typeof (_47b)=="undefined"||_47b===null){ -_47b=1; +MochiKit.Color.Color=function(red,_2be,blue,_2c0){ +if(typeof (_2c0)=="undefined"||_2c0===null){ +_2c0=1; } -this.rgb={r:red,g:_479,b:blue,a:_47b}; +this.rgb={r:red,g:_2be,b:blue,a:_2c0}; }; -MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_47c){ +MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_2c1){ var rgb=this.rgb; var m=MochiKit.Color; -return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_47c); +return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_2c1); },colorWithHue:function(hue){ var hsl=this.asHSL(); hsl.h=hue; var m=MochiKit.Color; return m.Color.fromHSL(hsl); -},colorWithSaturation:function(_482){ +},colorWithSaturation:function(_2c7){ var hsl=this.asHSL(); -hsl.s=_482; +hsl.s=_2c7; var m=MochiKit.Color; return m.Color.fromHSL(hsl); -},colorWithLightness:function(_485){ +},colorWithLightness:function(_2ca){ var hsl=this.asHSL(); -hsl.l=_485; +hsl.l=_2ca; var m=MochiKit.Color; return m.Color.fromHSL(hsl); -},darkerColorWithLevel:function(_488){ +},darkerColorWithLevel:function(_2cd){ var hsl=this.asHSL(); -hsl.l=Math.max(hsl.l-_488,0); +hsl.l=Math.max(hsl.l-_2cd,0); var m=MochiKit.Color; return m.Color.fromHSL(hsl); -},lighterColorWithLevel:function(_48b){ +},lighterColorWithLevel:function(_2d0){ var hsl=this.asHSL(); -hsl.l=Math.min(hsl.l+_48b,1); +hsl.l=Math.min(hsl.l+_2d0,1); var m=MochiKit.Color; return m.Color.fromHSL(hsl); -},blendedColor:function(_48e,_48f){ -if(typeof (_48f)=="undefined"||_48f===null){ -_48f=0.5; +},blendedColor:function(_2d3,_2d4){ +if(typeof (_2d4)=="undefined"||_2d4===null){ +_2d4=0.5; } -var sf=1-_48f; +var sf=1-_2d4; var s=this.rgb; -var d=_48e.rgb; -var df=_48f; +var d=_2d3.rgb; +var df=_2d4; return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df)); -},compareRGB:function(_494){ +},compareRGB:function(_2d9){ var a=this.asRGB(); -var b=_494.asRGB(); +var b=_2d9.asRGB(); return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]); },isLight:function(){ return this.asHSL().b>0.5; @@ -4597,114 +2571,114 @@ var c=this.rgb; var col=[c.r,c.g,c.b,c.a]; return this.__class__.NAME+"("+col.join(", ")+")"; }}; -MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_4ab,blue,_4ad){ -var _4ae=MochiKit.Color.Color; +MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_2f0,blue,_2f2){ +var _2f3=MochiKit.Color.Color; if(arguments.length==1){ var rgb=red; red=rgb.r; -_4ab=rgb.g; +_2f0=rgb.g; blue=rgb.b; if(typeof (rgb.a)=="undefined"){ -_4ad=undefined; +_2f2=undefined; }else{ -_4ad=rgb.a; +_2f2=rgb.a; } } -return new _4ae(red,_4ab,blue,_4ad); -},fromHSL:function(hue,_4b1,_4b2,_4b3){ +return new _2f3(red,_2f0,blue,_2f2); +},fromHSL:function(hue,_2f6,_2f7,_2f8){ var m=MochiKit.Color; return m.Color.fromRGB(m.hslToRGB.apply(m,arguments)); -},fromHSV:function(hue,_4b6,_4b7,_4b8){ +},fromHSV:function(hue,_2fb,_2fc,_2fd){ var m=MochiKit.Color; return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments)); },fromName:function(name){ -var _4bb=MochiKit.Color.Color; +var _300=MochiKit.Color.Color; if(name.charAt(0)=="\""){ name=name.substr(1,name.length-2); } -var _4bc=_4bb._namedColors[name.toLowerCase()]; -if(typeof (_4bc)=="string"){ -return _4bb.fromHexString(_4bc); +var _301=_300._namedColors[name.toLowerCase()]; +if(typeof (_301)=="string"){ +return _300.fromHexString(_301); }else{ if(name=="transparent"){ -return _4bb.transparentColor(); +return _300.transparentColor(); } } return null; -},fromString:function(_4bd){ +},fromString:function(_302){ var self=MochiKit.Color.Color; -var _4bf=_4bd.substr(0,3); -if(_4bf=="rgb"){ -return self.fromRGBString(_4bd); +var _304=_302.substr(0,3); +if(_304=="rgb"){ +return self.fromRGBString(_302); }else{ -if(_4bf=="hsl"){ -return self.fromHSLString(_4bd); +if(_304=="hsl"){ +return self.fromHSLString(_302); }else{ -if(_4bd.charAt(0)=="#"){ -return self.fromHexString(_4bd); +if(_302.charAt(0)=="#"){ +return self.fromHexString(_302); } } } -return self.fromName(_4bd); -},fromHexString:function(_4c0){ -if(_4c0.charAt(0)=="#"){ -_4c0=_4c0.substring(1); +return self.fromName(_302); +},fromHexString:function(_305){ +if(_305.charAt(0)=="#"){ +_305=_305.substring(1); } -var _4c1=[]; +var _306=[]; var i,hex; -if(_4c0.length==3){ +if(_305.length==3){ for(i=0;i<3;i++){ -hex=_4c0.substr(i,1); -_4c1.push(parseInt(hex+hex,16)/255); +hex=_305.substr(i,1); +_306.push(parseInt(hex+hex,16)/255); } }else{ for(i=0;i<6;i+=2){ -hex=_4c0.substr(i,2); -_4c1.push(parseInt(hex,16)/255); +hex=_305.substr(i,2); +_306.push(parseInt(hex,16)/255); } } -var _4c4=MochiKit.Color.Color; -return _4c4.fromRGB.apply(_4c4,_4c1); -},_fromColorString:function(pre,_4c6,_4c7,_4c8){ -if(_4c8.indexOf(pre)===0){ -_4c8=_4c8.substring(_4c8.indexOf("(",3)+1,_4c8.length-1); +var _309=MochiKit.Color.Color; +return _309.fromRGB.apply(_309,_306); +},_fromColorString:function(pre,_30b,_30c,_30d){ +if(_30d.indexOf(pre)===0){ +_30d=_30d.substring(_30d.indexOf("(",3)+1,_30d.length-1); } -var _4c9=_4c8.split(/\s*,\s*/); -var _4ca=[]; -for(var i=0;i<_4c9.length;i++){ -var c=_4c9[i]; +var _30e=_30d.split(/\s*,\s*/); +var _30f=[]; +for(var i=0;i<_30e.length;i++){ +var c=_30e[i]; var val; -var _4ce=c.substring(c.length-3); +var _313=c.substring(c.length-3); if(c.charAt(c.length-1)=="%"){ val=0.01*parseFloat(c.substring(0,c.length-1)); }else{ -if(_4ce=="deg"){ +if(_313=="deg"){ val=parseFloat(c)/360; }else{ -if(_4ce=="rad"){ +if(_313=="rad"){ val=parseFloat(c)/(Math.PI*2); }else{ -val=_4c7[i]*parseFloat(c); +val=_30c[i]*parseFloat(c); } } } -_4ca.push(val); +_30f.push(val); } -return this[_4c6].apply(this,_4ca); -},fromComputedStyle:function(elem,_4d0){ +return this[_30b].apply(this,_30f); +},fromComputedStyle:function(elem,_315){ var d=MochiKit.DOM; var cls=MochiKit.Color.Color; for(elem=d.getElement(elem);elem;elem=elem.parentNode){ -var _4d3=MochiKit.Style.getStyle.apply(d,arguments); -if(!_4d3){ +var _318=MochiKit.Style.getStyle.apply(d,arguments); +if(!_318){ continue; } -var _4d4=cls.fromString(_4d3); -if(!_4d4){ +var _319=cls.fromString(_318); +if(!_319){ break; } -if(_4d4.asRGB().a>0){ -return _4d4; +if(_319.asRGB().a>0){ +return _319; } } return null; @@ -4717,13 +2691,13 @@ return cls.fromComputedStyle(elem,"color","color")||cls.blackColor(); },namedColors:function(){ return MochiKit.Base.clone(MochiKit.Color.Color._namedColors); }}); -MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_4da){ -v*=_4da; +MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_31f){ +v*=_31f; if(v<0){ return 0; }else{ -if(v>_4da){ -return _4da; +if(v>_31f){ +return _31f; }else{ return v; } @@ -4751,118 +2725,118 @@ val=n1; } } return val; -},hsvToRGB:function(hue,_4e0,_4e1,_4e2){ +},hsvToRGB:function(hue,_325,_326,_327){ if(arguments.length==1){ var hsv=hue; hue=hsv.h; -_4e0=hsv.s; -_4e1=hsv.v; -_4e2=hsv.a; +_325=hsv.s; +_326=hsv.v; +_327=hsv.a; } var red; -var _4e5; +var _32a; var blue; -if(_4e0===0){ -red=_4e1; -_4e5=_4e1; -blue=_4e1; +if(_325===0){ +red=_326; +_32a=_326; +blue=_326; }else{ var i=Math.floor(hue*6); var f=(hue*6)-i; -var p=_4e1*(1-_4e0); -var q=_4e1*(1-(_4e0*f)); -var t=_4e1*(1-(_4e0*(1-f))); +var p=_326*(1-_325); +var q=_326*(1-(_325*f)); +var t=_326*(1-(_325*(1-f))); switch(i){ case 1: red=q; -_4e5=_4e1; +_32a=_326; blue=p; break; case 2: red=p; -_4e5=_4e1; +_32a=_326; blue=t; break; case 3: red=p; -_4e5=q; -blue=_4e1; +_32a=q; +blue=_326; break; case 4: red=t; -_4e5=p; -blue=_4e1; +_32a=p; +blue=_326; break; case 5: -red=_4e1; -_4e5=p; +red=_326; +_32a=p; blue=q; break; case 6: case 0: -red=_4e1; -_4e5=t; +red=_326; +_32a=t; blue=p; break; } } -return {r:red,g:_4e5,b:blue,a:_4e2}; -},hslToRGB:function(hue,_4ed,_4ee,_4ef){ +return {r:red,g:_32a,b:blue,a:_327}; +},hslToRGB:function(hue,_332,_333,_334){ if(arguments.length==1){ var hsl=hue; hue=hsl.h; -_4ed=hsl.s; -_4ee=hsl.l; -_4ef=hsl.a; +_332=hsl.s; +_333=hsl.l; +_334=hsl.a; } var red; -var _4f2; +var _337; var blue; -if(_4ed===0){ -red=_4ee; -_4f2=_4ee; -blue=_4ee; +if(_332===0){ +red=_333; +_337=_333; +blue=_333; }else{ var m2; -if(_4ee<=0.5){ -m2=_4ee*(1+_4ed); +if(_333<=0.5){ +m2=_333*(1+_332); }else{ -m2=_4ee+_4ed-(_4ee*_4ed); +m2=_333+_332-(_333*_332); } -var m1=(2*_4ee)-m2; +var m1=(2*_333)-m2; var f=MochiKit.Color._hslValue; var h6=hue*6; red=f(m1,m2,h6+2); -_4f2=f(m1,m2,h6); +_337=f(m1,m2,h6); blue=f(m1,m2,h6-2); } -return {r:red,g:_4f2,b:blue,a:_4ef}; -},rgbToHSV:function(red,_4f9,blue,_4fb){ +return {r:red,g:_337,b:blue,a:_334}; +},rgbToHSV:function(red,_33e,blue,_340){ if(arguments.length==1){ var rgb=red; red=rgb.r; -_4f9=rgb.g; +_33e=rgb.g; blue=rgb.b; -_4fb=rgb.a; +_340=rgb.a; } -var max=Math.max(Math.max(red,_4f9),blue); -var min=Math.min(Math.min(red,_4f9),blue); +var max=Math.max(Math.max(red,_33e),blue); +var min=Math.min(Math.min(red,_33e),blue); var hue; -var _500; -var _501=max; +var _345; +var _346=max; if(min==max){ hue=0; -_500=0; +_345=0; }else{ -var _502=(max-min); -_500=_502/max; +var _347=(max-min); +_345=_347/max; if(red==max){ -hue=(_4f9-blue)/_502; +hue=(_33e-blue)/_347; }else{ -if(_4f9==max){ -hue=2+((blue-red)/_502); +if(_33e==max){ +hue=2+((blue-red)/_347); }else{ -hue=4+((red-_4f9)/_502); +hue=4+((red-_33e)/_347); } } hue/=6; @@ -4873,37 +2847,37 @@ if(hue>1){ hue-=1; } } -return {h:hue,s:_500,v:_501,a:_4fb}; -},rgbToHSL:function(red,_504,blue,_506){ +return {h:hue,s:_345,v:_346,a:_340}; +},rgbToHSL:function(red,_349,blue,_34b){ if(arguments.length==1){ var rgb=red; red=rgb.r; -_504=rgb.g; +_349=rgb.g; blue=rgb.b; -_506=rgb.a; +_34b=rgb.a; } -var max=Math.max(red,Math.max(_504,blue)); -var min=Math.min(red,Math.min(_504,blue)); +var max=Math.max(red,Math.max(_349,blue)); +var min=Math.min(red,Math.min(_349,blue)); var hue; -var _50b; -var _50c=(max+min)/2; -var _50d=max-min; -if(_50d===0){ +var _350; +var _351=(max+min)/2; +var _352=max-min; +if(_352===0){ hue=0; -_50b=0; +_350=0; }else{ -if(_50c<=0.5){ -_50b=_50d/(max+min); +if(_351<=0.5){ +_350=_352/(max+min); }else{ -_50b=_50d/(2-max-min); +_350=_352/(2-max-min); } if(red==max){ -hue=(_504-blue)/_50d; +hue=(_349-blue)/_352; }else{ -if(_504==max){ -hue=2+((blue-red)/_50d); +if(_349==max){ +hue=2+((blue-red)/_352); }else{ -hue=4+((red-_504)/_50d); +hue=4+((red-_349)/_352); } } hue/=6; @@ -4914,33 +2888,33 @@ if(hue>1){ hue-=1; } } -return {h:hue,s:_50b,l:_50c,a:_506}; +return {h:hue,s:_350,l:_351,a:_34b}; },toColorPart:function(num){ num=Math.round(num); -var _50f=num.toString(16); +var _354=num.toString(16); if(num<16){ -return "0"+_50f; +return "0"+_354; } -return _50f; +return _354; },__new__:function(){ var m=MochiKit.Base; this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]); this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]); -var _511=1/3; -var _512={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_511,_511,_511],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_511,2*_511,2*_511],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]}; -var _513=function(name,r,g,b,a){ +var _356=1/3; +var _357={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_356,_356,_356],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_356,2*_356,2*_356],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]}; +var _358=function(name,r,g,b,a){ var rval=this.fromRGB(r,g,b,a); this[name]=function(){ return rval; }; return rval; }; -for(var k in _512){ +for(var k in _357){ var name=k+"Color"; -var _51c=m.concat([_513,this.Color,name],_512[k]); -this.Color[name]=m.bind.apply(null,_51c); +var _361=m.concat([_358,this.Color,name],_357[k]); +this.Color[name]=m.bind.apply(null,_361); } -var _51d=function(){ +var _362=function(){ for(var i=0;i1){ var src=MochiKit.DOM.getElement(arguments[0]); var sig=arguments[1]; var obj=arguments[2]; var func=arguments[3]; -for(var i=_55f.length-1;i>=0;i--){ -var o=_55f[i]; +for(var i=_3a4.length-1;i>=0;i--){ +var o=_3a4[i]; if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){ self._disconnect(o); if(!self._lock){ -_55f.splice(i,1); +_3a4.splice(i,1); }else{ self._dirty=true; } @@ -5365,11 +3339,11 @@ return true; } } }else{ -var idx=m.findIdentical(_55f,_55d); +var idx=m.findIdentical(_3a4,_3a2); if(idx>=0){ -self._disconnect(_55d); +self._disconnect(_3a2); if(!self._lock){ -_55f.splice(idx,1); +_3a4.splice(idx,1); }else{ self._dirty=true; } @@ -5377,100 +3351,100 @@ return true; } } return false; -},disconnectAllTo:function(_568,_569){ +},disconnectAllTo:function(_3ad,_3ae){ var self=MochiKit.Signal; -var _56b=self._observers; -var _56c=self._disconnect; -var _56d=self._lock; -var _56e=self._dirty; -if(typeof (_569)==="undefined"){ -_569=null; +var _3b0=self._observers; +var _3b1=self._disconnect; +var _3b2=self._lock; +var _3b3=self._dirty; +if(typeof (_3ae)==="undefined"){ +_3ae=null; } -for(var i=_56b.length-1;i>=0;i--){ -var _570=_56b[i]; -if(_570.objOrFunc===_568&&(_569===null||_570.funcOrStr===_569)){ -_56c(_570); -if(_56d){ -_56e=true; +for(var i=_3b0.length-1;i>=0;i--){ +var _3b5=_3b0[i]; +if(_3b5.objOrFunc===_3ad&&(_3ae===null||_3b5.funcOrStr===_3ae)){ +_3b1(_3b5); +if(_3b2){ +_3b3=true; }else{ -_56b.splice(i,1); +_3b0.splice(i,1); } } } -self._dirty=_56e; +self._dirty=_3b3; },disconnectAll:function(src,sig){ src=MochiKit.DOM.getElement(src); var m=MochiKit.Base; -var _574=m.flattenArguments(m.extend(null,arguments,1)); +var _3b9=m.flattenArguments(m.extend(null,arguments,1)); var self=MochiKit.Signal; -var _576=self._disconnect; -var _577=self._observers; -var i,_579; -var _57a=self._lock; -var _57b=self._dirty; -if(_574.length===0){ -for(i=_577.length-1;i>=0;i--){ -_579=_577[i]; -if(_579.source===src){ -_576(_579); -if(!_57a){ -_577.splice(i,1); +var _3bb=self._disconnect; +var _3bc=self._observers; +var i,_3be; +var _3bf=self._lock; +var _3c0=self._dirty; +if(_3b9.length===0){ +for(i=_3bc.length-1;i>=0;i--){ +_3be=_3bc[i]; +if(_3be.source===src){ +_3bb(_3be); +if(!_3bf){ +_3bc.splice(i,1); }else{ -_57b=true; +_3c0=true; } } } }else{ var sigs={}; -for(i=0;i<_574.length;i++){ -sigs[_574[i]]=true; +for(i=0;i<_3b9.length;i++){ +sigs[_3b9[i]]=true; } -for(i=_577.length-1;i>=0;i--){ -_579=_577[i]; -if(_579.source===src&&_579.signal in sigs){ -_576(_579); -if(!_57a){ -_577.splice(i,1); +for(i=_3bc.length-1;i>=0;i--){ +_3be=_3bc[i]; +if(_3be.source===src&&_3be.signal in sigs){ +_3bb(_3be); +if(!_3bf){ +_3bc.splice(i,1); }else{ -_57b=true; +_3c0=true; } } } } -self._dirty=_57b; +self._dirty=_3c0; },signal:function(src,sig){ var self=MochiKit.Signal; -var _580=self._observers; +var _3c5=self._observers; src=MochiKit.DOM.getElement(src); var args=MochiKit.Base.extend(null,arguments,2); -var _582=[]; +var _3c7=[]; self._lock=true; -for(var i=0;i<_580.length;i++){ -var _584=_580[i]; -if(_584.source===src&&_584.signal===sig){ +for(var i=0;i<_3c5.length;i++){ +var _3c9=_3c5[i]; +if(_3c9.source===src&&_3c9.signal===sig){ try{ -_584.listener.apply(src,args); +_3c9.listener.apply(src,args); } catch(e){ -_582.push(e); +_3c7.push(e); } } } self._lock=false; if(self._dirty){ self._dirty=false; -for(var i=_580.length-1;i>=0;i--){ -if(!_580[i].connected){ -_580.splice(i,1); +for(var i=_3c5.length-1;i>=0;i--){ +if(!_3c5[i].connected){ +_3c5.splice(i,1); } } } -if(_582.length==1){ -throw _582[0]; +if(_3c7.length==1){ +throw _3c7[0]; }else{ -if(_582.length>1){ +if(_3c7.length>1){ var e=new Error("Multiple errors thrown in handling 'sig', see errors property"); -e.errors=_582; +e.errors=_3c7; throw e; } } @@ -5499,1408 +3473,6 @@ disconnectAll=MochiKit.Signal.disconnectAll; signal=MochiKit.Signal.signal; } MochiKit.Base._exportSymbols(this,MochiKit.Signal); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Position"); -dojo.require("MochiKit.Base"); -dojo.require("MochiKit.DOM"); -dojo.require("MochiKit.Style"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -JSAN.use("MochiKit.DOM",[]); -JSAN.use("MochiKit.Style",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.Style)=="undefined"||typeof (MochiKit.DOM)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Style depends on MochiKit.Base, MochiKit.DOM, and MochiKit.Style!"; -} -if(typeof (MochiKit.Position)=="undefined"){ -MochiKit.Position={}; -} -MochiKit.Position.NAME="MochiKit.Position"; -MochiKit.Position.VERSION="1.4"; -MochiKit.Position.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Position.toString=function(){ -return this.__repr__(); -}; -MochiKit.Position.EXPORT_OK=[]; -MochiKit.Position.EXPORT=[]; -MochiKit.Base.update(MochiKit.Position,{includeScrollOffsets:false,prepare:function(){ -var _588=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0; -var _589=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0; -this.windowOffset=new MochiKit.Style.Coordinates(_588,_589); -},cumulativeOffset:function(_58a){ -var _58b=0; -var _58c=0; -do{ -_58b+=_58a.offsetTop||0; -_58c+=_58a.offsetLeft||0; -_58a=_58a.offsetParent; -}while(_58a); -return new MochiKit.Style.Coordinates(_58c,_58b); -},realOffset:function(_58d){ -var _58e=0; -var _58f=0; -do{ -_58e+=_58d.scrollTop||0; -_58f+=_58d.scrollLeft||0; -_58d=_58d.parentNode; -}while(_58d); -return new MochiKit.Style.Coordinates(_58f,_58e); -},within:function(_590,x,y){ -if(this.includeScrollOffsets){ -return this.withinIncludingScrolloffsets(_590,x,y); -} -this.xcomp=x; -this.ycomp=y; -this.offset=this.cumulativeOffset(_590); -if(_590.style.position=="fixed"){ -this.offset.x+=this.windowOffset.x; -this.offset.y+=this.windowOffset.y; -} -return (y>=this.offset.y&&y=this.offset.x&&x=this.offset.y&&this.ycomp=this.offset.x&&this.xcomp"+el.innerHTML+"
"; -},_roundTopCorners:function(el,_5c2,_5c3){ -var _5c4=this._createCorner(_5c3); -for(var i=0;i=0;i--){ -_5c9.appendChild(this._createCornerSlice(_5c7,_5c8,i,"bottom")); -} -el.style.paddingBottom=0; -el.appendChild(_5c9); -},_createCorner:function(_5cb){ -var dom=MochiKit.DOM; -return dom.DIV({style:{backgroundColor:_5cb.toString()}}); -},_createCornerSlice:function(_5cd,_5ce,n,_5d0){ -var _5d1=MochiKit.DOM.SPAN(); -var _5d2=_5d1.style; -_5d2.backgroundColor=_5cd.toString(); -_5d2.display="block"; -_5d2.height="1px"; -_5d2.overflow="hidden"; -_5d2.fontSize="1px"; -var _5d3=this._borderColor(_5cd,_5ce); -if(this.options.border&&n===0){ -_5d2.borderTopStyle="solid"; -_5d2.borderTopWidth="1px"; -_5d2.borderLeftWidth="0px"; -_5d2.borderRightWidth="0px"; -_5d2.borderBottomWidth="0px"; -_5d2.height="0px"; -_5d2.borderColor=_5d3.toString(); -}else{ -if(_5d3){ -_5d2.borderColor=_5d3.toString(); -_5d2.borderStyle="solid"; -_5d2.borderWidth="0px 1px"; -} -} -if(!this.options.compact&&(n==(this.options.numSlices-1))){ -_5d2.height="2px"; -} -this._setMargin(_5d1,n,_5d0); -this._setBorder(_5d1,n,_5d0); -return _5d1; -},_setOptions:function(_5d4){ -this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false,__unstable__wrapElement:false}; -MochiKit.Base.update(this.options,_5d4); -this.options.numSlices=(this.options.compact?2:4); -},_whichSideTop:function(){ -var _5d5=this.options.corners; -if(this._hasString(_5d5,"all","top")){ -return ""; -} -var _5d6=(_5d5.indexOf("tl")!=-1); -var _5d7=(_5d5.indexOf("tr")!=-1); -if(_5d6&&_5d7){ -return ""; -} -if(_5d6){ -return "left"; -} -if(_5d7){ -return "right"; -} -return ""; -},_whichSideBottom:function(){ -var _5d8=this.options.corners; -if(this._hasString(_5d8,"all","bottom")){ -return ""; -} -var _5d9=(_5d8.indexOf("bl")!=-1); -var _5da=(_5d8.indexOf("br")!=-1); -if(_5d9&&_5da){ -return ""; -} -if(_5d9){ -return "left"; -} -if(_5da){ -return "right"; -} -return ""; -},_borderColor:function(_5db,_5dc){ -if(_5db=="transparent"){ -return _5dc; -}else{ -if(this.options.border){ -return this.options.border; -}else{ -if(this.options.blend){ -return _5dc.blendedColor(_5db); -} -} -} -return ""; -},_setMargin:function(el,n,_5df){ -var _5e0=this._marginSize(n)+"px"; -var _5e1=(_5df=="top"?this._whichSideTop():this._whichSideBottom()); -var _5e2=el.style; -if(_5e1=="left"){ -_5e2.marginLeft=_5e0; -_5e2.marginRight="0px"; -}else{ -if(_5e1=="right"){ -_5e2.marginRight=_5e0; -_5e2.marginLeft="0px"; -}else{ -_5e2.marginLeft=_5e0; -_5e2.marginRight=_5e0; -} -} -},_setBorder:function(el,n,_5e5){ -var _5e6=this._borderSize(n)+"px"; -var _5e7=(_5e5=="top"?this._whichSideTop():this._whichSideBottom()); -var _5e8=el.style; -if(_5e7=="left"){ -_5e8.borderLeftWidth=_5e6; -_5e8.borderRightWidth="0px"; -}else{ -if(_5e7=="right"){ -_5e8.borderRightWidth=_5e6; -_5e8.borderLeftWidth="0px"; -}else{ -_5e8.borderLeftWidth=_5e6; -_5e8.borderRightWidth=_5e6; -} -} -},_marginSize:function(n){ -if(this.isTransparent){ -return 0; -} -var o=this.options; -if(o.compact&&o.blend){ -var _5eb=[1,0]; -return _5eb[n]; -}else{ -if(o.compact){ -var _5ec=[2,1]; -return _5ec[n]; -}else{ -if(o.blend){ -var _5ed=[3,2,1,0]; -return _5ed[n]; -}else{ -var _5ee=[5,3,2,1]; -return _5ee[n]; -} -} -} -},_borderSize:function(n){ -var o=this.options; -var _5f1; -if(o.compact&&(o.blend||this.isTransparent)){ -return 1; -}else{ -if(o.compact){ -_5f1=[1,0]; -}else{ -if(o.blend){ -_5f1=[2,1,1,1]; -}else{ -if(o.border){ -_5f1=[0,2,0,0]; -}else{ -if(this.isTransparent){ -_5f1=[5,3,2,1]; -}else{ -return 0; -} -} -} -} -} -return _5f1[n]; -},_hasString:function(str){ -for(var i=1;i=(_61c||i)){ -_61c=i; -} -},this.effects); -_618=_61c||_618; -break; -case "break": -ma(function(e){ -e.finalize(); -},this.effects); -break; -} -_617.startOn+=_618; -_617.finishOn+=_618; -if(!_617.options.queue.limit||this.effects.length<_617.options.queue.limit){ -this.effects.push(_617); -} -if(!this.interval){ -this.interval=this.startLoop(MochiKit.Base.bind(this.loop,this),40); -} -},startLoop:function(func,_621){ -return setInterval(func,_621); -},remove:function(_622){ -this.effects=MochiKit.Base.filter(function(e){ -return e!=_622; -},this.effects); -if(!this.effects.length){ -this.stopLoop(this.interval); -this.interval=null; -} -},stopLoop:function(_624){ -clearInterval(_624); -},loop:function(){ -var _625=new Date().getTime(); -MochiKit.Base.map(function(_626){ -_626.loop(_625); -},this.effects); -}}); -MochiKit.Visual.Queues={instances:{},get:function(_627){ -if(typeof (_627)!="string"){ -return _627; -} -if(!this.instances[_627]){ -this.instances[_627]=new MochiKit.Visual.ScopedQueue(); -} -return this.instances[_627]; -}}; -MochiKit.Visual.Queue=MochiKit.Visual.Queues.get("global"); -MochiKit.Visual.DefaultOptions={transition:MochiKit.Visual.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"}; -MochiKit.Visual.Base=function(){ -}; -MochiKit.Visual.Base.prototype={__class__:MochiKit.Visual.Base,start:function(_628){ -var v=MochiKit.Visual; -this.options=MochiKit.Base.setdefault(_628||{},v.DefaultOptions); -this.currentFrame=0; -this.state="idle"; -this.startOn=this.options.delay*1000; -this.finishOn=this.startOn+(this.options.duration*1000); -this.event("beforeStart"); -if(!this.options.sync){ -v.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).add(this); -} -},loop:function(_62a){ -if(_62a>=this.startOn){ -if(_62a>=this.finishOn){ -return this.finalize(); -} -var pos=(_62a-this.startOn)/(this.finishOn-this.startOn); -var _62c=Math.round(pos*this.options.fps*this.options.duration); -if(_62c>this.currentFrame){ -this.render(pos); -this.currentFrame=_62c; -} -} -},render:function(pos){ -if(this.state=="idle"){ -this.state="running"; -this.event("beforeSetup"); -this.setup(); -this.event("afterSetup"); -} -if(this.state=="running"){ -if(this.options.transition){ -pos=this.options.transition(pos); -} -pos*=(this.options.to-this.options.from); -pos+=this.options.from; -this.event("beforeUpdate"); -this.update(pos); -this.event("afterUpdate"); -} -},cancel:function(){ -if(!this.options.sync){ -MochiKit.Visual.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).remove(this); -} -this.state="finished"; -},finalize:function(){ -this.render(1); -this.cancel(); -this.event("beforeFinish"); -this.finish(); -this.event("afterFinish"); -},setup:function(){ -},finish:function(){ -},update:function(_62e){ -},event:function(_62f){ -if(this.options[_62f+"Internal"]){ -this.options[_62f+"Internal"](this); -} -if(this.options[_62f]){ -this.options[_62f](this); -} -},repr:function(){ -return "["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"; -}}; -MochiKit.Visual.Parallel=function(_630,_631){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_630,_631); -} -this.__init__(_630,_631); -}; -MochiKit.Visual.Parallel.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Parallel.prototype,{__class__:MochiKit.Visual.Parallel,__init__:function(_633,_634){ -this.effects=_633||[]; -this.start(_634); -},update:function(_635){ -MochiKit.Base.map(function(_636){ -_636.render(_635); -},this.effects); -},finish:function(){ -MochiKit.Base.map(function(_637){ -_637.finalize(); -},this.effects); -}}); -MochiKit.Visual.Opacity=function(_638,_639){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_638,_639); -} -this.__init__(_638,_639); -}; -MochiKit.Visual.Opacity.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Opacity.prototype,{__class__:MochiKit.Visual.Opacity,__init__:function(_63b,_63c){ -var b=MochiKit.Base; -var s=MochiKit.Style; -this.element=MochiKit.DOM.getElement(_63b); -if(this.element.currentStyle&&(!this.element.currentStyle.hasLayout)){ -s.setStyle(this.element,{zoom:1}); -} -_63c=b.update({from:s.getStyle(this.element,"opacity")||0,to:1},_63c||{}); -this.start(_63c); -},update:function(_63f){ -MochiKit.Style.setStyle(this.element,{"opacity":_63f}); -}}); -MochiKit.Visual.Move=function(_640,_641){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_640,_641); -} -this.__init__(_640,_641); -}; -MochiKit.Visual.Move.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Move.prototype,{__class__:MochiKit.Visual.Move,__init__:function(_643,_644){ -this.element=MochiKit.DOM.getElement(_643); -_644=MochiKit.Base.update({x:0,y:0,mode:"relative"},_644||{}); -this.start(_644); -},setup:function(){ -MochiKit.DOM.makePositioned(this.element); -var s=this.element.style; -var _646=s.visibility; -var _647=s.display; -if(_647=="none"){ -s.visibility="hidden"; -s.display=""; -} -this.originalLeft=parseFloat(MochiKit.Style.getStyle(this.element,"left")||"0"); -this.originalTop=parseFloat(MochiKit.Style.getStyle(this.element,"top")||"0"); -if(this.options.mode=="absolute"){ -this.options.x-=this.originalLeft; -this.options.y-=this.originalTop; -} -if(_647=="none"){ -s.visibility=_646; -s.display=_647; -} -},update:function(_648){ -MochiKit.Style.setStyle(this.element,{left:Math.round(this.options.x*_648+this.originalLeft)+"px",top:Math.round(this.options.y*_648+this.originalTop)+"px"}); -}}); -MochiKit.Visual.Scale=function(_649,_64a,_64b){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_649,_64a,_64b); -} -this.__init__(_649,_64a,_64b); -}; -MochiKit.Visual.Scale.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Scale.prototype,{__class__:MochiKit.Visual.Scale,__init__:function(_64d,_64e,_64f){ -this.element=MochiKit.DOM.getElement(_64d); -_64f=MochiKit.Base.update({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_64e},_64f||{}); -this.start(_64f); -},setup:function(){ -this.restoreAfterFinish=this.options.restoreAfterFinish||false; -this.elementPositioning=MochiKit.Style.getStyle(this.element,"position"); -var ma=MochiKit.Base.map; -var b=MochiKit.Base.bind; -this.originalStyle={}; -ma(b(function(k){ -this.originalStyle[k]=this.element.style[k]; -},this),["top","left","width","height","fontSize"]); -this.originalTop=this.element.offsetTop; -this.originalLeft=this.element.offsetLeft; -var _653=MochiKit.Style.getStyle(this.element,"font-size")||"100%"; -ma(b(function(_654){ -if(_653.indexOf(_654)>0){ -this.fontSize=parseFloat(_653); -this.fontSizeType=_654; -} -},this),["em","px","%"]); -this.factor=(this.options.scaleTo-this.options.scaleFrom)/100; -if(/^content/.test(this.options.scaleMode)){ -this.dims=[this.element.scrollHeight,this.element.scrollWidth]; -}else{ -if(this.options.scaleMode=="box"){ -this.dims=[this.element.offsetHeight,this.element.offsetWidth]; -}else{ -this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]; -} -} -},update:function(_655){ -var _656=(this.options.scaleFrom/100)+(this.factor*_655); -if(this.options.scaleContent&&this.fontSize){ -MochiKit.Style.setStyle(this.element,{fontSize:this.fontSize*_656+this.fontSizeType}); -} -this.setDimensions(this.dims[0]*_656,this.dims[1]*_656); -},finish:function(){ -if(this.restoreAfterFinish){ -MochiKit.Style.setStyle(this.element,this.originalStyle); -} -},setDimensions:function(_657,_658){ -var d={}; -var r=Math.round; -if(/MSIE/.test(navigator.userAgent)){ -r=Math.ceil; -} -if(this.options.scaleX){ -d.width=r(_658)+"px"; -} -if(this.options.scaleY){ -d.height=r(_657)+"px"; -} -if(this.options.scaleFromCenter){ -var topd=(_657-this.dims[0])/2; -var _65c=(_658-this.dims[1])/2; -if(this.elementPositioning=="absolute"){ -if(this.options.scaleY){ -d.top=this.originalTop-topd+"px"; -} -if(this.options.scaleX){ -d.left=this.originalLeft-_65c+"px"; -} -}else{ -if(this.options.scaleY){ -d.top=-topd+"px"; -} -if(this.options.scaleX){ -d.left=-_65c+"px"; -} -} -} -MochiKit.Style.setStyle(this.element,d); -}}); -MochiKit.Visual.Highlight=function(_65d,_65e){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_65d,_65e); -} -this.__init__(_65d,_65e); -}; -MochiKit.Visual.Highlight.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Highlight.prototype,{__class__:MochiKit.Visual.Highlight,__init__:function(_660,_661){ -this.element=MochiKit.DOM.getElement(_660); -_661=MochiKit.Base.update({startcolor:"#ffff99"},_661||{}); -this.start(_661); -},setup:function(){ -var b=MochiKit.Base; -var s=MochiKit.Style; -if(s.getStyle(this.element,"display")=="none"){ -this.cancel(); -return; -} -this.oldStyle={backgroundImage:s.getStyle(this.element,"background-image")}; -s.setStyle(this.element,{backgroundImage:"none"}); -if(!this.options.endcolor){ -this.options.endcolor=MochiKit.Color.Color.fromBackground(this.element).toHexString(); -} -if(b.isUndefinedOrNull(this.options.restorecolor)){ -this.options.restorecolor=s.getStyle(this.element,"background-color"); -} -this._base=b.map(b.bind(function(i){ -return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16); -},this),[0,1,2]); -this._delta=b.map(b.bind(function(i){ -return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]; -},this),[0,1,2]); -},update:function(_666){ -var m="#"; -MochiKit.Base.map(MochiKit.Base.bind(function(i){ -m+=MochiKit.Color.toColorPart(Math.round(this._base[i]+this._delta[i]*_666)); -},this),[0,1,2]); -MochiKit.Style.setStyle(this.element,{backgroundColor:m}); -},finish:function(){ -MochiKit.Style.setStyle(this.element,MochiKit.Base.update(this.oldStyle,{backgroundColor:this.options.restorecolor})); -}}); -MochiKit.Visual.ScrollTo=function(_669,_66a){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_669,_66a); -} -this.__init__(_669,_66a); -}; -MochiKit.Visual.ScrollTo.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.ScrollTo.prototype,{__class__:MochiKit.Visual.ScrollTo,__init__:function(_66c,_66d){ -this.element=MochiKit.DOM.getElement(_66c); -this.start(_66d||{}); -},setup:function(){ -var p=MochiKit.Position; -p.prepare(); -var _66f=p.cumulativeOffset(this.element); -if(this.options.offset){ -_66f.y+=this.options.offset; -} -var max; -if(window.innerHeight){ -max=window.innerHeight-window.height; -}else{ -if(document.documentElement&&document.documentElement.clientHeight){ -max=document.documentElement.clientHeight-document.body.scrollHeight; -}else{ -if(document.body){ -max=document.body.clientHeight-document.body.scrollHeight; -} -} -} -this.scrollStart=p.windowOffset.y; -this.delta=(_66f.y>max?max:_66f.y)-this.scrollStart; -},update:function(_671){ -var p=MochiKit.Position; -p.prepare(); -window.scrollTo(p.windowOffset.x,this.scrollStart+(_671*this.delta)); -}}); -MochiKit.Visual.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; -MochiKit.Visual.Morph=function(_673,_674){ -var cls=arguments.callee; -if(!(this instanceof cls)){ -return new cls(_673,_674); -} -this.__init__(_673,_674); -}; -MochiKit.Visual.Morph.prototype=new MochiKit.Visual.Base(); -MochiKit.Base.update(MochiKit.Visual.Morph.prototype,{__class__:MochiKit.Visual.Morph,__init__:function(_676,_677){ -this.element=MochiKit.DOM.getElement(_676); -this.start(_677||{}); -},setup:function(){ -var b=MochiKit.Base; -var _679=this.options.style; -this.styleStart={}; -this.styleEnd={}; -this.units={}; -var _67a,unit; -for(var s in _679){ -_67a=_679[s]; -s=b.camelize(s); -if(MochiKit.Visual.CSS_LENGTH.test(_67a)){ -var _67d=_67a.match(/^([\+\-]?[0-9\.]+)(.*)$/); -_67a=parseFloat(_67d[1]); -unit=(_67d.length==3)?_67d[2]:null; -this.styleEnd[s]=_67a; -this.units[s]=unit; -_67a=MochiKit.Style.getStyle(this.element,s); -_67d=_67a.match(/^([\+\-]?[0-9\.]+)(.*)$/); -_67a=parseFloat(_67d[1]); -this.styleStart[s]=_67a; -}else{ -var c=MochiKit.Color.Color; -_67a=c.fromString(_67a); -if(_67a){ -this.units[s]="color"; -this.styleEnd[s]=_67a.toHexString(); -_67a=MochiKit.Style.getStyle(this.element,s); -this.styleStart[s]=c.fromString(_67a).toHexString(); -this.styleStart[s]=b.map(b.bind(function(i){ -return parseInt(this.styleStart[s].slice(i*2+1,i*2+3),16); -},this),[0,1,2]); -this.styleEnd[s]=b.map(b.bind(function(i){ -return parseInt(this.styleEnd[s].slice(i*2+1,i*2+3),16); -},this),[0,1,2]); -} -} -} -},update:function(_681){ -var _682; -for(var s in this.styleStart){ -if(this.units[s]=="color"){ -var m="#"; -var _685=this.styleStart[s]; -var end=this.styleEnd[s]; -MochiKit.Base.map(MochiKit.Base.bind(function(i){ -m+=MochiKit.Color.toColorPart(Math.round(_685[i]+(end[i]-_685[i])*_681)); -},this),[0,1,2]); -this.element.style[s]=m; -}else{ -_682=this.styleStart[s]+Math.round((this.styleEnd[s]-this.styleStart[s])*_681*1000)/1000+this.units[s]; -this.element.style[s]=_682; -} -} -}}); -MochiKit.Visual.fade=function(_688,_689){ -var s=MochiKit.Style; -var _68b=s.getStyle(_688,"opacity"); -_689=MochiKit.Base.update({from:s.getStyle(_688,"opacity")||1,to:0,afterFinishInternal:function(_68c){ -if(_68c.options.to!==0){ -return; -} -s.hideElement(_68c.element); -s.setStyle(_68c.element,{"opacity":_68b}); -}},_689||{}); -return new MochiKit.Visual.Opacity(_688,_689); -}; -MochiKit.Visual.appear=function(_68d,_68e){ -var s=MochiKit.Style; -var v=MochiKit.Visual; -_68e=MochiKit.Base.update({from:(s.getStyle(_68d,"display")=="none"?0:s.getStyle(_68d,"opacity")||0),to:1,afterFinishInternal:function(_691){ -v.forceRerendering(_691.element); -},beforeSetupInternal:function(_692){ -s.setStyle(_692.element,{"opacity":_692.options.from}); -s.showElement(_692.element); -}},_68e||{}); -return new v.Opacity(_68d,_68e); -}; -MochiKit.Visual.puff=function(_693,_694){ -var s=MochiKit.Style; -var v=MochiKit.Visual; -_693=MochiKit.DOM.getElement(_693); -var _697={position:s.getStyle(_693,"position"),top:_693.style.top,left:_693.style.left,width:_693.style.width,height:_693.style.height,opacity:s.getStyle(_693,"opacity")}; -_694=MochiKit.Base.update({beforeSetupInternal:function(_698){ -MochiKit.Position.absolutize(_698.effects[0].element); -},afterFinishInternal:function(_699){ -s.hideElement(_699.effects[0].element); -s.setStyle(_699.effects[0].element,_697); -},scaleContent:true,scaleFromCenter:true},_694||{}); -return new v.Parallel([new v.Scale(_693,200,{sync:true,scaleFromCenter:_694.scaleFromCenter,scaleContent:_694.scaleContent,restoreAfterFinish:true}),new v.Opacity(_693,{sync:true,to:0})],_694); -}; -MochiKit.Visual.blindUp=function(_69a,_69b){ -var d=MochiKit.DOM; -_69a=d.getElement(_69a); -var _69d=d.makeClipping(_69a); -_69b=MochiKit.Base.update({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_69e){ -MochiKit.Style.hideElement(_69e.element); -d.undoClipping(_69e.element,_69d); -}},_69b||{}); -return new MochiKit.Visual.Scale(_69a,0,_69b); -}; -MochiKit.Visual.blindDown=function(_69f,_6a0){ -var d=MochiKit.DOM; -var s=MochiKit.Style; -_69f=d.getElement(_69f); -var _6a3=s.getElementDimensions(_69f); -var _6a4; -_6a0=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_6a3.h,originalWidth:_6a3.w},restoreAfterFinish:true,afterSetupInternal:function(_6a5){ -_6a4=d.makeClipping(_6a5.element); -s.setStyle(_6a5.element,{height:"0px"}); -s.showElement(_6a5.element); -},afterFinishInternal:function(_6a6){ -d.undoClipping(_6a6.element,_6a4); -}},_6a0||{}); -return new MochiKit.Visual.Scale(_69f,100,_6a0); -}; -MochiKit.Visual.switchOff=function(_6a7,_6a8){ -var d=MochiKit.DOM; -_6a7=d.getElement(_6a7); -var _6aa=MochiKit.Style.getStyle(_6a7,"opacity"); -var _6ab; -_6a8=MochiKit.Base.update({duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetupInternal:function(_6ac){ -d.makePositioned(_6ac.element); -_6ab=d.makeClipping(_6ac.element); -},afterFinishInternal:function(_6ad){ -MochiKit.Style.hideElement(_6ad.element); -d.undoClipping(_6ad.element,_6ab); -d.undoPositioned(_6ad.element); -MochiKit.Style.setStyle(_6ad.element,{"opacity":_6aa}); -}},_6a8||{}); -var v=MochiKit.Visual; -return new v.appear(_6a7,{duration:0.4,from:0,transition:v.Transitions.flicker,afterFinishInternal:function(_6af){ -new v.Scale(_6af.element,1,_6a8); -}}); -}; -MochiKit.Visual.dropOut=function(_6b0,_6b1){ -var d=MochiKit.DOM; -var s=MochiKit.Style; -_6b0=d.getElement(_6b0); -var _6b4={top:s.getStyle(_6b0,"top"),left:s.getStyle(_6b0,"left"),opacity:s.getStyle(_6b0,"opacity")}; -_6b1=MochiKit.Base.update({duration:0.5,distance:100,beforeSetupInternal:function(_6b5){ -d.makePositioned(_6b5.effects[0].element); -},afterFinishInternal:function(_6b6){ -s.hideElement(_6b6.effects[0].element); -d.undoPositioned(_6b6.effects[0].element); -s.setStyle(_6b6.effects[0].element,_6b4); -}},_6b1||{}); -var v=MochiKit.Visual; -return new v.Parallel([new v.Move(_6b0,{x:0,y:_6b1.distance,sync:true}),new v.Opacity(_6b0,{sync:true,to:0})],_6b1); -}; -MochiKit.Visual.shake=function(_6b8,_6b9){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_6b8=d.getElement(_6b8); -_6b9=MochiKit.Base.update({x:-20,y:0,duration:0.05,afterFinishInternal:function(_6bd){ -d.undoPositioned(_6bd.element); -s.setStyle(_6bd.element,_6be); -}},_6b9||{}); -var _6be={top:s.getStyle(_6b8,"top"),left:s.getStyle(_6b8,"left")}; -return new v.Move(_6b8,{x:20,y:0,duration:0.05,afterFinishInternal:function(_6bf){ -new v.Move(_6bf.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_6c0){ -new v.Move(_6c0.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_6c1){ -new v.Move(_6c1.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_6c2){ -new v.Move(_6c2.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_6c3){ -new v.Move(_6c3.element,_6b9); -}}); -}}); -}}); -}}); -}}); -}; -MochiKit.Visual.slideDown=function(_6c4,_6c5){ -var d=MochiKit.DOM; -var b=MochiKit.Base; -var s=MochiKit.Style; -_6c4=d.getElement(_6c4); -if(!_6c4.firstChild){ -throw "MochiKit.Visual.slideDown must be used on a element with a child"; -} -d.removeEmptyTextNodes(_6c4); -var _6c9=s.getStyle(_6c4.firstChild,"bottom")||0; -var _6ca=s.getElementDimensions(_6c4); -var _6cb; -_6c5=b.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_6ca.h,originalWidth:_6ca.w},restoreAfterFinish:true,afterSetupInternal:function(_6cc){ -d.makePositioned(_6cc.element); -d.makePositioned(_6cc.element.firstChild); -if(/Opera/.test(navigator.userAgent)){ -s.setStyle(_6cc.element,{top:""}); -} -_6cb=d.makeClipping(_6cc.element); -s.setStyle(_6cc.element,{height:"0px"}); -s.showElement(_6cc.element); -},afterUpdateInternal:function(_6cd){ -s.setStyle(_6cd.element.firstChild,{bottom:(_6cd.dims[0]-_6cd.element.clientHeight)+"px"}); -},afterFinishInternal:function(_6ce){ -d.undoClipping(_6ce.element,_6cb); -if(/MSIE/.test(navigator.userAgent)){ -d.undoPositioned(_6ce.element); -d.undoPositioned(_6ce.element.firstChild); -}else{ -d.undoPositioned(_6ce.element.firstChild); -d.undoPositioned(_6ce.element); -} -s.setStyle(_6ce.element.firstChild,{bottom:_6c9}); -}},_6c5||{}); -return new MochiKit.Visual.Scale(_6c4,100,_6c5); -}; -MochiKit.Visual.slideUp=function(_6cf,_6d0){ -var d=MochiKit.DOM; -var b=MochiKit.Base; -var s=MochiKit.Style; -_6cf=d.getElement(_6cf); -if(!_6cf.firstChild){ -throw "MochiKit.Visual.slideUp must be used on a element with a child"; -} -d.removeEmptyTextNodes(_6cf); -var _6d4=s.getStyle(_6cf.firstChild,"bottom"); -var _6d5; -_6d0=b.update({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_6d6){ -d.makePositioned(_6d6.element); -d.makePositioned(_6d6.element.firstChild); -if(/Opera/.test(navigator.userAgent)){ -s.setStyle(_6d6.element,{top:""}); -} -_6d5=d.makeClipping(_6d6.element); -s.showElement(_6d6.element); -},afterUpdateInternal:function(_6d7){ -s.setStyle(_6d7.element.firstChild,{bottom:(_6d7.dims[0]-_6d7.element.clientHeight)+"px"}); -},afterFinishInternal:function(_6d8){ -s.hideElement(_6d8.element); -d.undoClipping(_6d8.element,_6d5); -d.undoPositioned(_6d8.element.firstChild); -d.undoPositioned(_6d8.element); -s.setStyle(_6d8.element.firstChild,{bottom:_6d4}); -}},_6d0||{}); -return new MochiKit.Visual.Scale(_6cf,0,_6d0); -}; -MochiKit.Visual.squish=function(_6d9,_6da){ -var d=MochiKit.DOM; -var b=MochiKit.Base; -var _6dd; -_6da=b.update({restoreAfterFinish:true,beforeSetupInternal:function(_6de){ -_6dd=d.makeClipping(_6de.element); -},afterFinishInternal:function(_6df){ -MochiKit.Style.hideElement(_6df.element); -d.undoClipping(_6df.element,_6dd); -}},_6da||{}); -return new MochiKit.Visual.Scale(_6d9,/Opera/.test(navigator.userAgent)?1:0,_6da); -}; -MochiKit.Visual.grow=function(_6e0,_6e1){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_6e0=d.getElement(_6e0); -_6e1=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.full,scaleContent:true,scaleFromCenter:false},_6e1||{}); -var _6e5={top:_6e0.style.top,left:_6e0.style.left,height:_6e0.style.height,width:_6e0.style.width,opacity:s.getStyle(_6e0,"opacity")}; -var dims=s.getElementDimensions(_6e0); -var _6e7,_6e8; -var _6e9,_6ea; -switch(_6e1.direction){ -case "top-left": -_6e7=_6e8=_6e9=_6ea=0; -break; -case "top-right": -_6e7=dims.w; -_6e8=_6ea=0; -_6e9=-dims.w; -break; -case "bottom-left": -_6e7=_6e9=0; -_6e8=dims.h; -_6ea=-dims.h; -break; -case "bottom-right": -_6e7=dims.w; -_6e8=dims.h; -_6e9=-dims.w; -_6ea=-dims.h; -break; -case "center": -_6e7=dims.w/2; -_6e8=dims.h/2; -_6e9=-dims.w/2; -_6ea=-dims.h/2; -break; -} -var _6eb=MochiKit.Base.update({beforeSetupInternal:function(_6ec){ -s.setStyle(_6ec.effects[0].element,{height:"0px"}); -s.showElement(_6ec.effects[0].element); -},afterFinishInternal:function(_6ed){ -d.undoClipping(_6ed.effects[0].element); -d.undoPositioned(_6ed.effects[0].element); -s.setStyle(_6ed.effects[0].element,_6e5); -}},_6e1||{}); -return new v.Move(_6e0,{x:_6e7,y:_6e8,duration:0.01,beforeSetupInternal:function(_6ee){ -s.hideElement(_6ee.element); -d.makeClipping(_6ee.element); -d.makePositioned(_6ee.element); -},afterFinishInternal:function(_6ef){ -new v.Parallel([new v.Opacity(_6ef.element,{sync:true,to:1,from:0,transition:_6e1.opacityTransition}),new v.Move(_6ef.element,{x:_6e9,y:_6ea,sync:true,transition:_6e1.moveTransition}),new v.Scale(_6ef.element,100,{scaleMode:{originalHeight:dims.h,originalWidth:dims.w},sync:true,scaleFrom:/Opera/.test(navigator.userAgent)?1:0,transition:_6e1.scaleTransition,scaleContent:_6e1.scaleContent,scaleFromCenter:_6e1.scaleFromCenter,restoreAfterFinish:true})],_6eb); -}}); -}; -MochiKit.Visual.shrink=function(_6f0,_6f1){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_6f0=d.getElement(_6f0); -_6f1=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.none,scaleContent:true,scaleFromCenter:false},_6f1||{}); -var _6f5={top:_6f0.style.top,left:_6f0.style.left,height:_6f0.style.height,width:_6f0.style.width,opacity:s.getStyle(_6f0,"opacity")}; -var dims=s.getElementDimensions(_6f0); -var _6f7,_6f8; -switch(_6f1.direction){ -case "top-left": -_6f7=_6f8=0; -break; -case "top-right": -_6f7=dims.w; -_6f8=0; -break; -case "bottom-left": -_6f7=0; -_6f8=dims.h; -break; -case "bottom-right": -_6f7=dims.w; -_6f8=dims.h; -break; -case "center": -_6f7=dims.w/2; -_6f8=dims.h/2; -break; -} -var _6f9; -var _6fa=MochiKit.Base.update({beforeStartInternal:function(_6fb){ -_6f9=d.makePositioned(_6fb.effects[0].element); -d.makeClipping(_6fb.effects[0].element); -},afterFinishInternal:function(_6fc){ -s.hideElement(_6fc.effects[0].element); -d.undoClipping(_6fc.effects[0].element,_6f9); -d.undoPositioned(_6fc.effects[0].element); -s.setStyle(_6fc.effects[0].element,_6f5); -}},_6f1||{}); -return new v.Parallel([new v.Opacity(_6f0,{sync:true,to:0,from:1,transition:_6f1.opacityTransition}),new v.Scale(_6f0,/Opera/.test(navigator.userAgent)?1:0,{sync:true,transition:_6f1.scaleTransition,scaleContent:_6f1.scaleContent,scaleFromCenter:_6f1.scaleFromCenter,restoreAfterFinish:true}),new v.Move(_6f0,{x:_6f7,y:_6f8,sync:true,transition:_6f1.moveTransition})],_6fa); -}; -MochiKit.Visual.pulsate=function(_6fd,_6fe){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var b=MochiKit.Base; -var _702=MochiKit.Style.getStyle(_6fd,"opacity"); -_6fe=b.update({duration:3,from:0,afterFinishInternal:function(_703){ -MochiKit.Style.setStyle(_703.element,{"opacity":_702}); -}},_6fe||{}); -var _704=_6fe.transition||v.Transitions.sinoidal; -var _705=b.bind(function(pos){ -return _704(1-v.Transitions.pulse(pos,_6fe.pulses)); -},_704); -b.bind(_705,_704); -return new v.Opacity(_6fd,b.update({transition:_705},_6fe)); -}; -MochiKit.Visual.fold=function(_707,_708){ -var d=MochiKit.DOM; -var v=MochiKit.Visual; -var s=MochiKit.Style; -_707=d.getElement(_707); -var _70c={top:_707.style.top,left:_707.style.left,width:_707.style.width,height:_707.style.height}; -var _70d=d.makeClipping(_707); -_708=MochiKit.Base.update({scaleContent:false,scaleX:false,afterFinishInternal:function(_70e){ -new v.Scale(_707,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_70f){ -s.hideElement(_70f.element); -d.undoClipping(_70f.element,_70d); -s.setStyle(_70f.element,_70c); -}}); -}},_708||{}); -return new v.Scale(_707,5,_708); -}; -MochiKit.Visual.Color=MochiKit.Color.Color; -MochiKit.Visual.getElementsComputedStyle=MochiKit.DOM.computedStyle; -MochiKit.Visual.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -MochiKit.Visual.EXPORT=["roundElement","roundClass","tagifyText","multiple","toggle","Parallel","Opacity","Move","Scale","Highlight","ScrollTo","Morph","fade","appear","puff","blindUp","blindDown","switchOff","dropOut","shake","slideDown","slideUp","squish","grow","shrink","pulsate","fold"]; -MochiKit.Visual.EXPORT_OK=["Base","PAIRS"]; -MochiKit.Visual.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Visual); -if(typeof (MochiKit)=="undefined"){ -MochiKit={}; -} -if(typeof (MochiKit.MochiKit)=="undefined"){ -MochiKit.MochiKit={}; -} -MochiKit.MochiKit.NAME="MochiKit.MochiKit"; -MochiKit.MochiKit.VERSION="1.4"; -MochiKit.MochiKit.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.MochiKit.toString=function(){ -return this.__repr__(); -}; -MochiKit.MochiKit.SUBMODULES=["Base","Iter","Logging","DateTime","Format","Async","DOM","Selector","Style","LoggingPane","Color","Signal","Position","Visual"]; -if(typeof (JSAN)!="undefined"||typeof (dojo)!="undefined"){ -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.MochiKit"); -dojo.require("MochiKit.*"); -} -if(typeof (JSAN)!="undefined"){ -(function(lst){ -for(var i=0;i"); -} -} -})(); -} /*** diff --git a/generate-combined.sh b/generate-combined.sh index 3dde7ed..21cd7d4 100755 --- a/generate-combined.sh +++ b/generate-combined.sh @@ -8,8 +8,15 @@ cd plotkit_v091 ./scripts/pack.py Base Layout Canvas > /tmp/plotkit-packed.js cd .. +# Do the same for MochiKit. This save ~90k. +cd mochikit_v14 +./scripts/pack.py \ +Base Iter Format DOM Style Color Signal \ +> /tmp/mochikit-packed.js +cd .. + cat \ -mochikit_v14/packed/MochiKit/MochiKit.js \ +/tmp/mochikit-packed.js \ /tmp/plotkit-packed.js \ dygraph-canvas.js \ dygraph.js \