From: Ingo Renner Date: Tue, 22 Jan 2008 17:21:13 +0000 (+0000) Subject: fixed bug; #7238: t3editor should not depend on MochiKit-Javascript-Framework X-Git-Tag: TYPO3_4-2-0beta1~141 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/d9ff7fa32a817587ce444268cdcd0428990b6175 fixed bug; #7238: t3editor should not depend on MochiKit-Javascript-Framework git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2947 709f56b5-9817-0410-a4d7-c38de5d9e867 --- diff --git a/ChangeLog b/ChangeLog index 588f5b393927..bba30d8a30a6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * added feature: #7223: update prototype and scriptaculous to their most recent versions * fixed bug: #7237: There is no way to get loaded interface + * fixed bug; #7238: t3editor should not depend on MochiKit-Javascript-Framework 2008-01-21 Benjamin Mack diff --git a/typo3/sysext/t3editor/class.tx_t3editor.php b/typo3/sysext/t3editor/class.tx_t3editor.php index d67cbf71da71..8399f1e845f9 100755 --- a/typo3/sysext/t3editor/class.tx_t3editor.php +++ b/typo3/sysext/t3editor/class.tx_t3editor.php @@ -127,8 +127,7 @@ class tx_t3editor { 'var PATH_t3e = "'.$GLOBALS['BACK_PATH']. t3lib_extmgm::extRelPath('t3editor').'"; '. ''; - $code.= ''. - ''. + $code.= ''. ''. ''. ''. diff --git a/typo3/sysext/t3editor/ext_emconf.php b/typo3/sysext/t3editor/ext_emconf.php index c9ca18540b57..1b618c1d2f39 100755 --- a/typo3/sysext/t3editor/ext_emconf.php +++ b/typo3/sysext/t3editor/ext_emconf.php @@ -12,7 +12,7 @@ $EM_CONF[$_EXTKEY] = array( 'title' => 'Editor with syntax highlighting', - 'description' => 'JavaScript-driven editor with syntax highlighting for TS, HTML, CSS and more. Based on CodeEditor.', + 'description' => 'JavaScript-driven editor with syntax highlighting for TS and more. Based on CodeMirror.', 'category' => 'be', 'shy' => 0, 'dependencies' => '', @@ -32,7 +32,7 @@ $EM_CONF[$_EXTKEY] = array( 'author_company' => '', 'CGLcompliance' => '', 'CGLcompliance_note' => '', - 'version' => '0.0.5', + 'version' => '0.0.6', '_md5_values_when_last_written' => 'a:14:{s:21:"class.tx_t3editor.php";s:4:"bb07";s:12:"ext_icon.gif";s:4:"4cef";s:16:"css/t3editor.css";s:4:"d4f1";s:23:"icons/loader_eeeeee.gif";s:4:"83a4";s:13:"jslib/LICENSE";s:4:"d835";s:14:"jslib/Mochi.js";s:4:"872d";s:24:"jslib/parsejavascript.js";s:4:"5377";s:24:"jslib/parsetyposcript.js";s:4:"7815";s:15:"jslib/select.js";s:4:"6725";s:21:"jslib/stringstream.js";s:4:"e6a5";s:17:"jslib/t3editor.js";s:4:"656c";s:27:"jslib/tokenizejavascript.js";s:4:"1c7a";s:27:"jslib/tokenizetyposcript.js";s:4:"c232";s:13:"jslib/util.js";s:4:"7620";}', 'constraints' => array( 'depends' => array( diff --git a/typo3/sysext/t3editor/jslib/Mochi.js b/typo3/sysext/t3editor/jslib/Mochi.js deleted file mode 100644 index 33e7c2a37204..000000000000 --- a/typo3/sysext/t3editor/jslib/Mochi.js +++ /dev/null @@ -1,3808 +0,0 @@ -/*** - - MochiKit.MochiKit 1.4 : PACKED VERSION - - THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please - diff against the source tree, not this file. - - See for documentation, downloads, license, etc. - - (c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Base"); -} -if(typeof (MochiKit)=="undefined"){ -MochiKit={}; -} -if(typeof (MochiKit.Base)=="undefined"){ -MochiKit.Base={}; -} -if(typeof (MochiKit.__export__)=="undefined"){ -MochiKit.__export__=(MochiKit.__compat__||(typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")); -} -MochiKit.Base.VERSION="1.4"; -MochiKit.Base.NAME="MochiKit.Base"; -MochiKit.Base.update=function(_1,_2){ -if(_1===null){ -_1={}; -} -for(var i=1;i=0;i--){ -_15.unshift(o[i]); -} -}else{ -res.push(o); -} -} -return res; -},extend:function(_18,obj,_1a){ -if(!_1a){ -_1a=0; -} -if(obj){ -var l=obj.length; -if(typeof (l)!="number"){ -if(typeof (MochiKit.Iter)!="undefined"){ -obj=MochiKit.Iter.list(obj); -l=obj.length; -}else{ -throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); -} -} -if(!_18){ -_18=[]; -} -for(var i=_1a;i>b; -},zrshift:function(a,b){ -return a>>>b; -},eq:function(a,b){ -return a==b; -},ne:function(a,b){ -return a!=b; -},gt:function(a,b){ -return a>b; -},ge:function(a,b){ -return a>=b; -},lt:function(a,b){ -return al){ -_90=l; -} -} -_8e=[]; -for(i=0;i<_90;i++){ -var _92=[]; -for(var j=1;j=0;i--){ -_af=[_ab[i].apply(this,_af)]; -} -return _af[0]; -}; -},bind:function(_b1,_b2){ -if(typeof (_b1)=="string"){ -_b1=_b2[_b1]; -} -var _b3=_b1.im_func; -var _b4=_b1.im_preargs; -var _b5=_b1.im_self; -var m=MochiKit.Base; -if(typeof (_b1)=="function"&&typeof (_b1.apply)=="undefined"){ -_b1=m._wrapDumbFunction(_b1); -} -if(typeof (_b3)!="function"){ -_b3=_b1; -} -if(typeof (_b2)!="undefined"){ -_b5=_b2; -} -if(typeof (_b4)=="undefined"){ -_b4=[]; -}else{ -_b4=_b4.slice(); -} -m.extend(_b4,arguments,2); -var _b7=function(){ -var _b8=arguments; -var me=arguments.callee; -if(me.im_preargs.length>0){ -_b8=m.concat(me.im_preargs,_b8); -} -var _ba=me.im_self; -if(!_ba){ -_ba=this; -} -return me.im_func.apply(_ba,_b8); -}; -_b7.im_self=_b5; -_b7.im_func=_b3; -_b7.im_preargs=_b4; -return _b7; -},bindMethods:function(_bb){ -var _bc=MochiKit.Base.bind; -for(var k in _bb){ -var _be=_bb[k]; -if(typeof (_be)=="function"){ -_bb[k]=_bc(_be,_bb); -} -} -},registerComparator:function(_bf,_c0,_c1,_c2){ -MochiKit.Base.comparatorRegistry.register(_bf,_c0,_c1,_c2); -},_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){ -if(a==b){ -return 0; -} -var _c5=(typeof (a)=="undefined"||a===null); -var _c6=(typeof (b)=="undefined"||b===null); -if(_c5&&_c6){ -return 0; -}else{ -if(_c5){ -return -1; -}else{ -if(_c6){ -return 1; -} -} -} -var m=MochiKit.Base; -var _c8=m._primitives; -if(!(typeof (a) in _c8&&typeof (b) in _c8)){ -try{ -return m.comparatorRegistry.match(a,b); -} -catch(e){ -if(e!=m.NotFound){ -throw e; -} -} -} -if(ab){ -return 1; -} -} -var _c9=m.repr; -throw new TypeError(_c9(a)+" and "+_c9(b)+" can not be compared"); -},compareDateLike:function(a,b){ -return MochiKit.Base.compare(a.getTime(),b.getTime()); -},compareArrayLike:function(a,b){ -var _ce=MochiKit.Base.compare; -var _cf=a.length; -var _d0=0; -if(_cf>b.length){ -_d0=1; -_cf=b.length; -}else{ -if(_cf=0;i--){ -sum+=o[i]; -} -}else{ -sum+=o; -} -} -if(_115<=0){ -throw new TypeError("mean() requires at least one argument"); -} -return sum/_115; -},median:function(){ -var data=MochiKit.Base.flattenArguments(arguments); -if(data.length===0){ -throw new TypeError("median() requires at least one argument"); -} -data.sort(compare); -if(data.length%2==0){ -var _119=data.length/2; -return (data[_119]+data[_119-1])/2; -}else{ -return data[(data.length-1)/2]; -} -},findValue:function(lst,_11b,_11c,end){ -if(typeof (end)=="undefined"||end===null){ -end=lst.length; -} -if(typeof (_11c)=="undefined"||_11c===null){ -_11c=0; -} -var cmp=MochiKit.Base.compare; -for(var i=_11c;i0))){ -var kv=MochiKit.DOM.formContents(_129); -_129=kv[0]; -_12a=kv[1]; -}else{ -if(arguments.length==1){ -if(typeof (_129.length)=="number"&&_129.length==2){ -return arguments.callee(_129[0],_129[1]); -} -var o=_129; -_129=[]; -_12a=[]; -for(var k in o){ -var v=o[k]; -if(typeof (v)=="function"){ -continue; -}else{ -if(typeof (v)!="string"&&typeof (v.length)=="number"){ -for(var i=0;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; -} -} -_156.push(name); -_157.push(v); -return null; -} -_156.push(name); -_157.push(""); -return null; -}else{ -var opts=elem.options; -if(!opts.length){ -_156.push(name); -_157.push(""); -return null; -} -for(var i=0;i]+\svalue\s*=/i)){ -v=opt.text; -} -} -_156.push(name); -_157.push(v); -} -return null; -} -} -if(_15c==="FORM"||_15c==="P"||_15c==="SPAN"||_15c==="DIV"){ -return elem.childNodes; -} -_156.push(name); -_157.push(elem.value||""); -return null; -} -return elem.childNodes; -}); -return [_156,_157]; -},withDocument:function(doc,func){ -var self=MochiKit.DOM; -var _165=self._document; -var rval; -try{ -self._document=doc; -rval=func(); -} -catch(e){ -self._document=_165; -throw e; -} -self._document=_165; -return rval; -},registerDOMConverter:function(name,_168,wrap,_16a){ -MochiKit.DOM.domConverters.register(name,_168,wrap,_16a); -},coerceToDOM:function(node,ctx){ -var m=MochiKit.Base; -var im=MochiKit.Iter; -var self=MochiKit.DOM; -if(im){ -var iter=im.iter; -var _171=im.repeat; -var map=m.map; -} -var _173=self.domConverters; -var _174=arguments.callee; -var _175=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); -} -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 (node.dom)=="function"){ -node=node.dom(ctx); -continue; -} -if(typeof (node)=="function"){ -node=node.apply(ctx,[ctx]); -continue; -} -if(im){ -var _176=null; -try{ -_176=iter(node); -} -catch(e){ -} -if(_176){ -return map(_174,_176,_171(ctx)); -} -} -try{ -node=_173.match(node,ctx); -continue; -} -catch(e){ -if(e!=_175){ -throw e; -} -} -return self._document.createTextNode(node.toString()); -} -return undefined; -},isChildNode:function(node,_178){ -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -node=self.getElement(node); -} -if(typeof (_178)=="string"){ -_178=self.getElement(_178); -} -if(node===_178){ -return true; -} -while(node&&node.tagName.toUpperCase()!="BODY"){ -node=node.parentNode; -if(node===_178){ -return true; -} -} -return false; -},setNodeAttribute:function(node,attr,_17c){ -var o={}; -o[attr]=_17c; -try{ -return MochiKit.DOM.updateNodeAttributes(node,o); -} -catch(e){ -} -return null; -},getNodeAttribute:function(node,attr){ -var self=MochiKit.DOM; -var _181=self.attributeArray.renames[attr]; -node=self.getElement(node); -try{ -if(_181){ -return node[_181]; -} -return node.getAttribute(attr); -} -catch(e){ -} -return null; -},removeNodeAttribute:function(node,attr){ -var self=MochiKit.DOM; -var _185=self.attributeArray.renames[attr]; -node=self.getElement(node); -try{ -if(_185){ -return node[_185]; -} -return node.removeAttribute(attr); -} -catch(e){ -} -return null; -},updateNodeAttributes:function(node,_187){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -} -if(_187){ -var _18a=MochiKit.Base.updatetree; -if(self.attributeArray.compliant){ -for(var k in _187){ -var v=_187[k]; -if(typeof (v)=="object"&&typeof (elem[k])=="object"){ -if(k=="style"&&MochiKit.Style){ -MochiKit.Style.setStyle(elem,v); -}else{ -_18a(elem[k],v); -} -}else{ -if(k.substring(0,2)=="on"){ -if(typeof (v)=="string"){ -v=new Function(v); -} -elem[k]=v; -}else{ -elem.setAttribute(k,v); -} -} -} -}else{ -var _18d=self.attributeArray.renames; -for(var k in _187){ -v=_187[k]; -var _18e=_18d[k]; -if(k=="style"&&typeof (v)=="string"){ -elem.style.cssText=v; -}else{ -if(typeof (_18e)=="string"){ -elem[_18e]=v; -}else{ -if(typeof (elem[k])=="object"&&typeof (v)=="object"){ -if(k=="style"&&MochiKit.Style){ -MochiKit.Style.setStyle(elem,v); -}else{ -_18a(elem[k],v); -} -}else{ -if(k.substring(0,2)=="on"){ -if(typeof (v)=="string"){ -v=new Function(v); -} -elem[k]=v; -}else{ -elem.setAttribute(k,v); -} -} -} -} -} -} -} -return elem; -},appendChildNodes:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -} -var _192=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _193=MochiKit.Base.concat; -while(_192.length){ -var n=_192.shift(); -if(typeof (n)=="undefined"||n===null){ -}else{ -if(typeof (n.nodeType)=="number"){ -elem.appendChild(n); -}else{ -_192=_193(n,_192); -} -} -} -return elem; -},insertSiblingNodesBefore:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -} -var _198=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _199=elem.parentNode; -var _19a=MochiKit.Base.concat; -while(_198.length){ -var n=_198.shift(); -if(typeof (n)=="undefined"||n===null){ -}else{ -if(typeof (n.nodeType)=="number"){ -_199.insertBefore(n,elem); -}else{ -_198=_19a(n,_198); -} -} -} -return _199; -},insertSiblingNodesAfter:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -} -var _19f=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -if(elem.nextSibling){ -return self.insertSiblingNodesBefore(elem.nextSibling,_19f); -}else{ -return self.appendChildNodes(elem.parentNode,_19f); -} -},replaceChildNodes:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -arguments[0]=elem; -} -var _1a3; -while((_1a3=elem.firstChild)){ -elem.removeChild(_1a3); -} -if(arguments.length<2){ -return elem; -}else{ -return self.appendChildNodes.apply(this,arguments); -} -},createDOM:function(name,_1a5){ -var elem; -var self=MochiKit.DOM; -var m=MochiKit.Base; -if(typeof (_1a5)=="string"||typeof (_1a5)=="number"){ -var args=m.extend([name,null],arguments,1); -return arguments.callee.apply(this,args); -} -if(typeof (name)=="string"){ -var _1aa=self._xhtml; -if(_1a5&&!self.attributeArray.compliant){ -var _1ab=""; -if("name" in _1a5){ -_1ab+=" name=\""+self.escapeHTML(_1a5.name)+"\""; -} -if(name=="input"&&"type" in _1a5){ -_1ab+=" type=\""+self.escapeHTML(_1a5.type)+"\""; -} -if(_1ab){ -name="<"+name+_1ab+">"; -_1aa=false; -} -} -var d=self._document; -if(_1aa&&d===document){ -elem=d.createElementNS("http://www.w3.org/1999/xhtml",name); -}else{ -elem=d.createElement(name); -} -}else{ -elem=name; -} -if(_1a5){ -self.updateNodeAttributes(elem,_1a5); -} -if(arguments.length<=2){ -return elem; -}else{ -var args=m.extend([elem],arguments,2); -return self.appendChildNodes.apply(this,args); -} -},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 _1b3=dest.parentNode; -if(src){ -src=self.getElement(src); -_1b3.replaceChild(src,dest); -}else{ -_1b3.removeChild(dest); -} -return src; -},getElement:function(id){ -var self=MochiKit.DOM; -if(arguments.length==1){ -return ((typeof (id)=="string")?self._document.getElementById(id):id); -}else{ -return MochiKit.Base.map(self.getElement,arguments); -} -},getElementsByTagAndClassName:function(_1b6,_1b7,_1b8){ -var self=MochiKit.DOM; -if(typeof (_1b6)=="undefined"||_1b6===null){ -_1b6="*"; -} -if(typeof (_1b8)=="undefined"||_1b8===null){ -_1b8=self._document; -} -_1b8=self.getElement(_1b8); -var _1ba=(_1b8.getElementsByTagName(_1b6)||self._document.all); -if(typeof (_1b7)=="undefined"||_1b7===null){ -return MochiKit.Base.extend(null,_1ba); -} -var _1bb=[]; -for(var i=0;i<_1ba.length;i++){ -var _1bd=_1ba[i]; -var cls=_1bd.className; -if(!cls){ -continue; -} -var _1bf=cls.split(" "); -for(var j=0;j<_1bf.length;j++){ -if(_1bf[j]==_1b7){ -_1bb.push(_1bd); -break; -} -} -} -return _1bb; -},_newCallStack:function(path,once){ -var rval=function(){ -var _1c4=arguments.callee.callStack; -for(var i=0;i<_1c4.length;i++){ -if(_1c4[i].apply(this,arguments)===false){ -break; -} -} -if(once){ -try{ -this[path]=null; -} -catch(e){ -} -} -}; -rval.callStack=[]; -return rval; -},addToCallStack:function(_1c6,path,func,once){ -var self=MochiKit.DOM; -var _1cb=_1c6[path]; -var _1cc=_1cb; -if(!(typeof (_1cb)=="function"&&typeof (_1cb.callStack)=="object"&&_1cb.callStack!==null)){ -_1cc=self._newCallStack(path,once); -if(typeof (_1cb)=="function"){ -_1cc.callStack.push(_1cb); -} -_1c6[path]=_1cc; -} -_1cc.callStack.push(func); -},addLoadEvent:function(func){ -var self=MochiKit.DOM; -self.addToCallStack(self._window,"onload",func,true); -},focusOnLoad:function(_1cf){ -var self=MochiKit.DOM; -self.addLoadEvent(function(){ -_1cf=self.getElement(_1cf); -if(_1cf){ -_1cf.focus(); -} -}); -},setElementClass:function(_1d1,_1d2){ -var self=MochiKit.DOM; -var obj=self.getElement(_1d1); -if(self.attributeArray.compliant){ -obj.setAttribute("class",_1d2); -}else{ -obj.setAttribute("className",_1d2); -} -},toggleElementClass:function(_1d5){ -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 _1f8=[dom]; -var self=MochiKit.DOM; -var _1fa=self.escapeHTML; -var _1fb=self.attributeArray; -while(_1f8.length){ -dom=_1f8.pop(); -if(typeof (dom)=="string"){ -lst.push(dom); -}else{ -if(dom.nodeType==1){ -lst.push("<"+dom.tagName.toLowerCase()); -var _1fc=[]; -var _1fd=_1fb(dom); -for(var i=0;i<_1fd.length;i++){ -var a=_1fd[i]; -_1fc.push([" ",a.name,"=\"",_1fa(a.value),"\""]); -} -_1fc.sort(); -for(i=0;i<_1fc.length;i++){ -var _200=_1fc[i]; -for(var j=0;j<_200.length;j++){ -lst.push(_200[j]); -} -} -if(dom.hasChildNodes()){ -lst.push(">"); -_1f8.push(""); -var _202=dom.childNodes; -for(i=_202.length-1;i>=0;i--){ -_1f8.push(_202[i]); -} -}else{ -lst.push("/>"); -} -}else{ -if(dom.nodeType==3){ -lst.push(_1fa(dom.nodeValue)); -} -} -} -} -return lst; -},scrapeText:function(node,_204){ -var rval=[]; -(function(node){ -var cn=node.childNodes; -if(cn){ -for(var i=0;i0){ -var _22b=m.filter; -_22a=function(node){ -return _22b(_22a.ignoreAttrFilter,node.attributes); -}; -_22a.ignoreAttr={}; -var _22d=_229.attributes; -var _22e=_22a.ignoreAttr; -for(var i=0;i<_22d.length;i++){ -var a=_22d[i]; -_22e[a.name]=a.value; -} -_22a.ignoreAttrFilter=function(a){ -return (_22a.ignoreAttr[a.name]!=a.value); -}; -_22a.compliant=false; -_22a.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"}; -}else{ -_22a=function(node){ -return node.attributes; -}; -_22a.compliant=true; -_22a.renames={}; -} -this.attributeArray=_22a; -var _233=function(_234,arr){ -var _236=arr[1].split("."); -var str=""; -var obj={}; -str+="if (!MochiKit."+_236[1]+") { throw new Error(\""; -str+="This function has been deprecated and depends on MochiKit."; -str+=_236[1]+".\");}"; -str+="return MochiKit."+_236[1]+"."+arr[0]; -str+=".apply(this, arguments);"; -obj[_236[2]]=new Function(str); -MochiKit.Base.update(MochiKit[_234],obj); -}; -for(var i;i1){ -var src=MochiKit.DOM.getElement(arguments[0]); -var sig=arguments[1]; -var obj=arguments[2]; -var func=arguments[3]; -for(var i=_2b8.length-1;i>=0;i--){ -var o=_2b8[i]; -if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){ -self._disconnect(o); -if(!self._lock){ -_2b8.splice(i,1); -}else{ -self._dirty=true; -} -return true; -} -} -}else{ -var idx=m.findIdentical(_2b8,_2b6); -if(idx>=0){ -self._disconnect(_2b6); -if(!self._lock){ -_2b8.splice(idx,1); -}else{ -self._dirty=true; -} -return true; -} -} -return false; -},disconnectAllTo:function(_2c1,_2c2){ -var self=MochiKit.Signal; -var _2c4=self._observers; -var _2c5=self._disconnect; -var _2c6=self._lock; -var _2c7=self._dirty; -if(typeof (_2c2)==="undefined"){ -_2c2=null; -} -for(var i=_2c4.length-1;i>=0;i--){ -var _2c9=_2c4[i]; -if(_2c9.objOrFunc===_2c1&&(_2c2===null||_2c9.funcOrStr===_2c2)){ -_2c5(_2c9); -if(_2c6){ -_2c7=true; -}else{ -_2c4.splice(i,1); -} -} -} -self._dirty=_2c7; -},disconnectAll:function(src,sig){ -src=MochiKit.DOM.getElement(src); -var m=MochiKit.Base; -var _2cd=m.flattenArguments(m.extend(null,arguments,1)); -var self=MochiKit.Signal; -var _2cf=self._disconnect; -var _2d0=self._observers; -var i,_2d2; -var _2d3=self._lock; -var _2d4=self._dirty; -if(_2cd.length===0){ -for(i=_2d0.length-1;i>=0;i--){ -_2d2=_2d0[i]; -if(_2d2.source===src){ -_2cf(_2d2); -if(!_2d3){ -_2d0.splice(i,1); -}else{ -_2d4=true; -} -} -} -}else{ -var sigs={}; -for(i=0;i<_2cd.length;i++){ -sigs[_2cd[i]]=true; -} -for(i=_2d0.length-1;i>=0;i--){ -_2d2=_2d0[i]; -if(_2d2.source===src&&_2d2.signal in sigs){ -_2cf(_2d2); -if(!_2d3){ -_2d0.splice(i,1); -}else{ -_2d4=true; -} -} -} -} -self._dirty=_2d4; -},signal:function(src,sig){ -var self=MochiKit.Signal; -var _2d9=self._observers; -src=MochiKit.DOM.getElement(src); -var args=MochiKit.Base.extend(null,arguments,2); -var _2db=[]; -self._lock=true; -for(var i=0;i<_2d9.length;i++){ -var _2dd=_2d9[i]; -if(_2dd.source===src&&_2dd.signal===sig&&_2dd.connected){ -try{ -_2dd.listener.apply(src,args); -} -catch(e){ -_2db.push(e); -} -} -} -self._lock=false; -if(self._dirty){ -self._dirty=false; -for(var i=_2d9.length-1;i>=0;i--){ -if(!_2d9[i].connected){ -_2d9.splice(i,1); -} -} -} -if(_2db.length==1){ -throw _2db[0]; -}else{ -if(_2db.length>1){ -var e=new Error("Multiple errors thrown in handling 'sig', see errors property"); -e.errors=_2db; -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.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,_2e2,_2e3,_2e4){ -MochiKit.Iter.iteratorRegistry.register(name,_2e2,_2e3,_2e4); -},iter:function(_2e5,_2e6){ -var self=MochiKit.Iter; -if(arguments.length==2){ -return self.takewhile(function(a){ -return a!=_2e6; -},_2e5); -} -if(typeof (_2e5.next)=="function"){ -return _2e5; -}else{ -if(typeof (_2e5.iter)=="function"){ -return _2e5.iter(); -} -} -try{ -return self.iteratorRegistry.match(_2e5); -} -catch(e){ -var m=MochiKit.Base; -if(e==m.NotFound){ -e=new TypeError(typeof (_2e5)+": "+m.repr(_2e5)+" 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 _2f0=self.iter(p); -return {repr:function(){ -return "cycle(...)"; -},toString:m.forwardCall("repr"),next:function(){ -try{ -var rval=_2f0.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(_2f6){ -return _2f6.next(); -},izip:function(p,q){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -var next=self.next; -var _2fc=m.map(self.iter,arguments); -return {repr:function(){ -return "izip(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return m.map(next,_2fc); -}}; -},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 _308=0; -var stop=0; -var step=1; -var i=-1; -if(arguments.length==2){ -stop=arguments[1]; -}else{ -if(arguments.length==3){ -_308=arguments[1]; -stop=arguments[2]; -}else{ -_308=arguments[1]; -stop=arguments[2]; -step=arguments[3]; -} -} -return {repr:function(){ -return "islice("+["...",_308,stop,step].join(", ")+")"; -},toString:m.forwardCall("repr"),next:function(){ -var rval; -while(i<_308){ -rval=seq.next(); -i++; -} -if(_308>=stop){ -throw self.StopIteration; -} -_308+=step; -return rval; -}}; -},imap:function(fun,p,q){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -var _312=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,_312)); -}}; -},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 _31d=m.map(self.iter,arguments); -return {repr:function(){ -return "chain(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(_31d.length>1){ -try{ -return _31d[0].next(); -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -_31d.shift(); -} -} -if(_31d.length==1){ -var arg=_31d.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(_328,sync,_32a){ -sync.pos[_328]=-1; -var m=MochiKit.Base; -var _32c=m.listMin; -return {repr:function(){ -return "tee("+_328+", ...)"; -},toString:m.forwardCall("repr"),next:function(){ -var rval; -var i=sync.pos[_328]; -if(i==sync.max){ -rval=_32a.next(); -sync.deque.push(rval); -sync.max+=1; -sync.pos[_328]+=1; -}else{ -rval=sync.deque[i-sync.min]; -sync.pos[_328]+=1; -if(i==sync.min&&_32c(sync.pos)!=sync.min){ -sync.min+=1; -sync.deque.shift(); -} -} -return rval; -}}; -},tee:function(_32f,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; -_32f=self.iter(_32f); -var _tee=self._tee; -for(var i=0;i0&&_340>=stop)||(step<0&&_340<=stop)){ -throw MochiKit.Iter.StopIteration; -} -var rval=_340; -_340+=step; -return rval; -},repr:function(){ -return "range("+[_340,stop,step].join(", ")+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -},sum:function(_344,_345){ -if(typeof (_345)=="undefined"||_345===null){ -_345=0; -} -var x=_345; -var self=MochiKit.Iter; -_344=self.iter(_344); -try{ -while(true){ -x+=_344.next(); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -return x; -},exhaust:function(_348){ -var self=MochiKit.Iter; -_348=self.iter(_348); -try{ -while(true){ -_348.next(); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -},forEach:function(_34a,func,self){ -var m=MochiKit.Base; -if(arguments.length>2){ -func=m.bind(func,self); -} -if(m.isArrayLike(_34a)){ -try{ -for(var i=0;i<_34a.length;i++){ -func(_34a[i]); -} -} -catch(e){ -if(e!=MochiKit.Iter.StopIteration){ -throw e; -} -} -}else{ -self=MochiKit.Iter; -self.exhaust(self.imap(func,_34a)); -} -},every:function(_34f,func){ -var self=MochiKit.Iter; -try{ -self.ifilterfalse(func,_34f).next(); -return false; -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -return true; -} -},sorted:function(_352,cmp){ -var rval=MochiKit.Iter.list(_352); -if(arguments.length==1){ -cmp=MochiKit.Base.compare; -} -rval.sort(cmp); -return rval; -},reversed:function(_355){ -var rval=MochiKit.Iter.list(_355); -rval.reverse(); -return rval; -},some:function(_357,func){ -var self=MochiKit.Iter; -try{ -self.ifilter(func,_357).next(); -return true; -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -return false; -} -},iextend:function(lst,_35b){ -if(MochiKit.Base.isArrayLike(_35b)){ -for(var i=0;i<_35b.length;i++){ -lst.push(_35b[i]); -} -}else{ -var self=MochiKit.Iter; -_35b=self.iter(_35b); -try{ -while(true){ -lst.push(_35b.next()); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -} -return lst; -},groupby:function(_35e,_35f){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_35f=m.operator.identity; -} -_35e=self.iter(_35e); -var pk=undefined; -var k=undefined; -var v; -function fetch(){ -v=_35e.next(); -k=_35f(v); -} -function eat(){ -var ret=v; -v=undefined; -return ret; -} -var _366=true; -var _367=m.compare; -return {repr:function(){ -return "groupby(...)"; -},next:function(){ -while(_367(k,pk)===0){ -fetch(); -if(_366){ -_366=false; -break; -} -} -pk=k; -return [k,{next:function(){ -if(v==undefined){ -fetch(); -} -if(_367(k,pk)!==0){ -throw self.StopIteration; -} -return eat(); -}}]; -}}; -},groupby_as_array:function(_368,_369){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_369=m.operator.identity; -} -_368=self.iter(_368); -var _36c=[]; -var _36d=true; -var _36e; -var _36f=m.compare; -while(true){ -try{ -var _370=_368.next(); -var key=_369(_370); -} -catch(e){ -if(e==self.StopIteration){ -break; -} -throw e; -} -if(_36d||_36f(key,_36e)!==0){ -var _372=[]; -_36c.push([key,_372]); -} -_372.push(_370); -_36d=false; -_36e=key; -} -return _36c; -},arrayLikeIter:function(_373){ -var i=0; -return {repr:function(){ -return "arrayLikeIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -if(i>=_373.length){ -throw MochiKit.Iter.StopIteration; -} -return _373[i++]; -}}; -},hasIterateNext:function(_375){ -return (_375&&typeof (_375.iterateNext)=="function"); -},iterateNextIter:function(_376){ -return {repr:function(){ -return "iterateNextIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -var rval=_376.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.Async"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Async depends on MochiKit.Base!"; -} -if(typeof (MochiKit.Async)=="undefined"){ -MochiKit.Async={}; -} -MochiKit.Async.NAME="MochiKit.Async"; -MochiKit.Async.VERSION="1.4"; -MochiKit.Async.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Async.toString=function(){ -return this.__repr__(); -}; -MochiKit.Async.Deferred=function(_379){ -this.chain=[]; -this.id=this._nextId(); -this.fired=-1; -this.paused=0; -this.results=[null,null]; -this.canceller=_379; -this.silentlyCancelled=false; -this.chained=false; -}; -MochiKit.Async.Deferred.prototype={repr:function(){ -var _37a; -if(this.fired==-1){ -_37a="unfired"; -}else{ -if(this.fired===0){ -_37a="success"; -}else{ -_37a="error"; -} -} -return "Deferred("+this.id+", "+_37a+")"; -},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)); -} -}else{ -if((this.fired===0)&&(this.results[0] instanceof self.Deferred)){ -this.results[0].cancel(); -} -} -},_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"); -} -if(!(res instanceof Error)){ -res=new self.GenericError(res); -} -this._resback(res); -},addBoth:function(fn){ -if(arguments.length>1){ -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 _385=this.chain; -var _386=this.fired; -var res=this.results[_386]; -var self=this; -var cb=null; -while(_385.length>0&&this.paused===0){ -var pair=_385.shift(); -var f=pair[_386]; -if(f===null){ -continue; -} -try{ -res=f(res); -_386=((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){ -_386=1; -if(!(err instanceof Error)){ -err=new MochiKit.Async.GenericError(err); -} -res=err; -} -} -this.fired=_386; -this.results[_386]=res; -if(cb&&this.paused){ -res.addBoth(cb); -res.chained=true; -} -}}; -MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(req){ -return MochiKit.Base.evalJSON(req.responseText); -},succeed:function(_38e){ -var d=new MochiKit.Async.Deferred(); -d.callback.apply(d,arguments); -return d; -},fail:function(_390){ -var d=new MochiKit.Async.Deferred(); -d.errback.apply(d,arguments); -return d; -},getXMLHttpRequest:function(){ -var self=arguments.callee; -if(!self.XMLHttpRequest){ -var _393=[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<_393.length;i++){ -var func=_393[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 _398=null; -try{ -_398=this.status; -if(!_398&&m.isNotEmpty(this.responseText)){ -_398=304; -} -} -catch(e){ -} -if(_398==200||_398==201||_398==204||_398==304||_398==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,_39c){ -if(typeof (_39c)=="undefined"||_39c===null){ -_39c=""; -} -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(_39c); -} -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; -} -} -if("username" in opts){ -req.open(opts.method,url,true,opts.username,opts.password); -}else{ -req.open(opts.method,url,true); -} -if(req.overrideMimeType&&opts.mimeType){ -req.overrideMimeType(opts.mimeType); -} -if(opts.headers){ -var _3a9=opts.headers; -if(!m.isArrayLike(_3a9)){ -_3a9=m.items(_3a9); -} -for(var i=0;i<_3a9.length;i++){ -var _3ab=_3a9[i]; -var name=_3ab[0]; -var _3ad=_3ab[1]; -req.setRequestHeader(name,_3ad); -} -} -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(_3b6,_3b7){ -var d=new MochiKit.Async.Deferred(); -var m=MochiKit.Base; -if(typeof (_3b7)!="undefined"){ -d.addCallback(function(){ -return _3b7; -}); -} -var _3ba=setTimeout(m.bind("callback",d),Math.floor(_3b6*1000)); -d.canceller=function(){ -try{ -clearTimeout(_3ba); -} -catch(e){ -} -}; -return d; -},callLater:function(_3bb,func){ -var m=MochiKit.Base; -var _3be=m.partial.apply(m,m.extend(null,arguments,1)); -return MochiKit.Async.wait(_3bb).addCallback(function(res){ -return _3be(); -}); -}}); -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 _3c1; -if(this.locked){ -_3c1="locked, "+this.waiting.length+" waiting"; -}else{ -_3c1="unlocked"; -} -return "DeferredLock("+this.id+", "+_3c1+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Async.DeferredList=function(list,_3c3,_3c4,_3c5,_3c6){ -MochiKit.Async.Deferred.apply(this,[_3c6]); -this.list=list; -var _3c7=[]; -this.resultList=_3c7; -this.finishedCount=0; -this.fireOnOneCallback=_3c3; -this.fireOnOneErrback=_3c4; -this.consumeErrors=_3c5; -var cb=MochiKit.Base.bind(this._cbDeferred,this); -for(var i=0;i 0) { var range = selection.getRangeAt(0); - var br = withDocument(window.document, BR); + var br = window.document.createElement('br'); range.insertNode(br); range.setEndAfter(br); range.collapse(false); diff --git a/typo3/sysext/t3editor/jslib/stringstream.js b/typo3/sysext/t3editor/jslib/stringstream.js index 35c3956a7235..3052e5781092 100644 --- a/typo3/sysext/t3editor/jslib/stringstream.js +++ b/typo3/sysext/t3editor/jslib/stringstream.js @@ -36,7 +36,7 @@ function singleStringStream(string) { // is applied to the result of traverseDOM (see codemirror.js), and // the resulting stream is fed to the parser. function multiStringStream(source){ - source = iter(source); + // source = iter(source); var current = "", pos = 0; var peeked = null, accum = ""; var result = {peek: peek, next: next, get: get}; diff --git a/typo3/sysext/t3editor/jslib/t3editor.js b/typo3/sysext/t3editor/jslib/t3editor.js index a7fee021ed49..a35879010228 100755 --- a/typo3/sysext/t3editor/jslib/t3editor.js +++ b/typo3/sysext/t3editor/jslib/t3editor.js @@ -84,24 +84,36 @@ var t3eOptions = window.t3eOptions || {}; // tries to colour in one shot. Setting this too high will cause the // code to 'freeze' the browser for noticeable intervals. // passDelay gives the amount of milliseconds between colouring passes -setdefault(t3eOptions, - {safeKeys: setObject("KEY_ARROW_UP", "KEY_ARROW_DOWN", "KEY_ARROW_LEFT", "KEY_ARROW_RIGHT", "KEY_END", "KEY_HOME", - "KEY_PAGE_UP", "KEY_PAGE_DOWN", "KEY_SHIFT", "KEY_CTRL", "KEY_ALT", "KEY_SELECT"), - reindentKeys: setObject("KEY_TAB"), - reindentAfterKeys: setObject("KEY_RIGHT_SQUARE_BRACKET"), - stylesheet: PATH_t3e+"css/t3editor.css", - parser: parseTypoScript, - linesPerPass: 10, - passDelay: 500, - autoComplete: true, - acWords:5}); +var t3eOptions = { + safeKeys: { "KEY_ARROW_UP":true, + "KEY_ARROW_DOWN":true, + "KEY_ARROW_LEFT":true, + "KEY_ARROW_RIGHT":true, + "KEY_END":true, + "KEY_HOME":true, + "KEY_PAGE_UP":true, + "KEY_PAGE_DOWN":true, + "KEY_SHIFT":true, + "KEY_CTRL":true, + "KEY_ALT":true, + "KEY_SELECT":true + }, + reindentKeys: {"KEY_TAB":true}, + reindentAfterKeys: {"KEY_RIGHT_SQUARE_BRACKET":true}, + stylesheet: PATH_t3e+"css/t3editor.css", + parser: parseTypoScript, + linesPerPass: 10, + passDelay: 200, + autoComplete: true, + acWords:5 + }; // These default options can be overridden by passing a set of options // to a specific CodeMirror constructor. var t3editor = function(){ // The HTML elements whose content should be suffixed by a newline // when converting them to flat text. - var newlineElements = setObject("P", "DIV", "LI"); + var newlineElements = {"P":true, "DIV":true, "LI":true}; // Helper function for traverseDOM. Flattens an arbitrary DOM node // into an array of textnodes and
tags. @@ -121,11 +133,12 @@ var t3editor = function(){ result.push(node); } else { - forEach(node.childNodes, simplifyNode); + // forEach(node.childNodes, simplifyNode); + $A(node.childNodes).each(simplifyNode); if (!leaving && newlineElements.hasOwnProperty(node.nodeName)) { leaving = true; - el = withDocument(doc, SPAN); - result.push(withDocument(doc, BR)); + el = new Element('SPAN'); + result.push(new Element('BR')); } } } @@ -170,7 +183,10 @@ var t3editor = function(){ var text = "\n"; if (part.nodeType == 3) { text = part.nodeValue; - part = withDocument(owner, partial(SPAN, {"class": "part"}, part)); + + newpart = new Element('SPAN',{"class": "part"}); + newpart.appendChild(part); + part = newpart; part.currentText = text; } part.dirty = true; @@ -183,9 +199,13 @@ var t3editor = function(){ // non-normalized nodes. function writeNode(node, c){ var toYield = []; - forEach(simplifyDOM(node), function(part) { - toYield.push(insertPart(part)); - }); + var simdom = simplifyDOM(node); + simdom.each( + function(part) { + toYield.push(insertPart(part)); + } + ); + return yield(toYield.join(""), c); } @@ -214,7 +234,7 @@ var t3editor = function(){ } else { point = pointAt(node); - removeElement(node); + Element.remove(node); return writeNode(node, c); } } @@ -232,8 +252,10 @@ var t3editor = function(){ function t3editor(theTextarea, index, options) { // Use passed options, if any, to override defaults. - this.options = options || {} - setdefault(this.options, t3eOptions); + this.options = options || t3eOptions; // {} + for (var lo in options) { + this.options[lo] = options[lo]; + } //History Array this.history = []; @@ -251,28 +273,32 @@ var t3editor = function(){ this.index = index; // create the wrapping div - this.outerdiv = $(createDOM("DIV", { - "class": "t3e_outerdiv", - "id": "t3e_"+this.textarea.getAttribute('id') - })); + this.outerdiv = new Element("div", { + "class": "t3e_outerdiv", + "id": "t3e_"+this.textarea.getAttribute('id') + } + ); // place the div before the textarea this.textarea.parentNode.insertBefore(this.outerdiv,$(this.textarea)); // an overlay that covers the whole editor - this.modalOverlay = $(createDOM("DIV", { - "class": "t3e_modalOverlay", - "id": "t3e_modalOverlay_wait" - })); + this.modalOverlay = new Element("DIV", { + "class": "t3e_modalOverlay", + "id": "t3e_modalOverlay_wait" + } + ); this.modalOverlay.hide(); this.modalOverlay.setStyle(this.outerdiv.getDimensions()); this.modalOverlay.setStyle({opacity: 0.5}); this.outerdiv.appendChild(this.modalOverlay); - this.helpOverlay = $(createDOM("DIV", { - "class": "t3e_modalOverlay", - "id": "t3e_modalOverlay_help" - })); + this.helpOverlay = new Element("DIV", { + "class": "t3e_modalOverlay", + "id": "t3e_modalOverlay_help" + } + ); + // TODO: fill with senseful content, make it dynamic this.helpOverlay.innerHTML = "

t3editor

"+ "

put some helpful text here



"+ "

Hotkeys:

"+ @@ -288,118 +314,122 @@ var t3editor = function(){ this.helpOverlay.hide(); this.outerdiv.appendChild(this.helpOverlay); - // wrapping the ilnenumbers - this.linenum_wrap = $(createDOM("DIV", { - "class": "t3e_linenum_wrap" - })); - // the "linenumber" list itself - this.linenum = $(createDOM("DL", { - "class": "t3e_linenum" - })); + // wrapping the linenumbers + this.linenum_wrap = new Element("DIV", { + "class": "t3e_linenum_wrap" + } + ); + // the "linenumber" list itself + this.linenum = new Element("DL", { + "class": "t3e_linenum" + } + ); this.linenum_wrap.appendChild(this.linenum); this.outerdiv.appendChild(this.linenum_wrap); //autocomplete box - this.autoCompleteBox = $(createDOM("DIV",{"class":"t3e_autoCompleteBox"})); - this.autoCompleteBox.hide(); - this.outerdiv.appendChild(this.autoCompleteBox); - - // wrapping the iframe - this.iframe_wrap = $(createDOM("DIV", { - "class": "t3e_iframe_wrap" - })); - - // the iframe (the actual "editor") - // display: block occasionally suppresses some Firefox bugs, so we - // always add it, redundant as it sounds. - this.iframe = $(createDOM("IFRAME", { - "style": "border: 0; display: block;", - "class": "t3e_iframe" - })); + this.autoCompleteBox = new Element("DIV",{ + "class": "t3e_autoCompleteBox" + } + ); + this.autoCompleteBox.hide(); + this.outerdiv.appendChild(this.autoCompleteBox); + + // wrapping the iframe + this.iframe_wrap = new Element("DIV", { + "class": "t3e_iframe_wrap" + } + ); + + // the iframe (the actual "editor") + // display: block occasionally suppresses some Firefox bugs, so we + // always add it, redundant as it sounds. + this.iframe = new Element("IFRAME", { + "style": "border: 0; display: block;", + "class": "t3e_iframe" + } + ); this.iframe_wrap.appendChild(this.iframe); this.outerdiv.appendChild(this.iframe_wrap); // wrapping the footer/statusline - this.footer_wrap = $(createDOM("DIV", { - "class": "t3e_footer_wrap" - })); - this.outerdiv.appendChild(this.footer_wrap); - - // this.fitem_resize = this.createFooterItem('#', false); - // this.footer_wrap.appendChild(this.fitem_resize); - - // footer item: show help Window - // TODO make this more flexible! And get rid of inline css and unsed options! - this.fitem_help = this.createFooterItem('Help', true, 'toggleHelp'); - this.footer_wrap.appendChild(this.fitem_help); - - - // footer item: options menu - this.fitem_options_overlay = $(createDOM("DIV", { - "class": "t3e_footer_overlay", - "id": "t3e_footer_overlay_options" - })); - - // TODO make this more flexible! And get rid of inline css and unsed options! - this.fitem_options_overlay.innerHTML = '
    '+ - // '
  • Syntax highlighting
  • '+ - '
  • '+ - '
  • Test snippets
  • '+ - '
  • '+ - // '
  • other fancy stuff
  • '+ - '
'; - this.fitem_options_overlay.hide(); - this.fitem_options = this.createFooterItem('Options', true, this.fitem_options_overlay); - this.footer_wrap.appendChild(this.fitem_options); - this.footer_wrap.appendChild(this.fitem_options_overlay); - - - // footer item: status field (total line numbers) - this.fitem_status = this.createFooterItem('', false); - this.footer_wrap.appendChild(this.fitem_status); - - // footer item: "name" of the document (taken from textarea alt-attribut), and save indicator - this.fitem_name = this.createFooterItem(this.documentname, false); - this.footer_wrap.appendChild(this.fitem_name); - - - - // window and document objects from the iframe - this.win = this.iframe.contentWindow; - this.doc = this.win.document; - - // make the iframe "editable" - this.doc.designMode = "on"; - - this.doc.open(); - this.doc.write("" + - ""); - this.doc.close(); - - - // new Resizable(this.outerdiv,{handle:$(this.fitem_resize)}); - - // An array of known dirty nodes, nodes that have been modified - // since they were last parsed. - this.dirty = []; - - // dimensions - this.width = $(this.textarea).getDimensions().width; - this.height = $(this.textarea).getDimensions().height; - - var content = this.textarea.value; - - // hide the textarea - this.textarea.hide(); - - // Some browsers immediately produce a in a new