diff options
author | wei <> | 2006-02-01 07:08:55 +0000 |
---|---|---|
committer | wei <> | 2006-02-01 07:08:55 +0000 |
commit | 6f692501612bd24212f625c94427dfc5dcf17af8 (patch) | |
tree | 81c8cc22c63028a4d342ee37be19362c438d7522 /framework/Web/Javascripts/js | |
parent | 5682cc56a4c703408dd927bda629ab36824dae09 (diff) |
Update js library.
Diffstat (limited to 'framework/Web/Javascripts/js')
-rw-r--r-- | framework/Web/Javascripts/js/ajax.js | 227 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/effects.js | 597 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/prado.js | 685 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/validator.js | 3 |
4 files changed, 516 insertions, 996 deletions
diff --git a/framework/Web/Javascripts/js/ajax.js b/framework/Web/Javascripts/js/ajax.js index 7eb523c0..de445885 100644 --- a/framework/Web/Javascripts/js/ajax.js +++ b/framework/Web/Javascripts/js/ajax.js @@ -871,15 +871,23 @@ if(this.options.updateElement){ this.options.updateElement(_14); return; } -var _15=Element.collectTextNodesIgnoreClass(_14,"informal"); -var _16=this.findLastToken(); -if(_16!=-1){ -var _17=this.element.value.substr(0,_16+1); -var _18=this.element.value.substr(_16+1).match(/^\s+/); -if(_18){ -_17+=_18[0]; -} -this.element.value=_17+_15; +var _15=""; +if(this.options.select){ +var _16=document.getElementsByClassName(this.options.select,_14)||[]; +if(_16.length>0){ +_15=Element.collectTextNodes(_16[0],this.options.select); +} +}else{ +_15=Element.collectTextNodesIgnoreClass(_14,"informal"); +} +var _17=this.findLastToken(); +if(_17!=-1){ +var _18=this.element.value.substr(0,_17+1); +var _19=this.element.value.substr(_17+1).match(/^\s+/); +if(_19){ +_18+=_19[0]; +} +this.element.value=_18+_15; }else{ this.element.value=_15; } @@ -887,17 +895,17 @@ this.element.focus(); if(this.options.afterUpdateElement){ this.options.afterUpdateElement(this.element,_14); } -},updateChoices:function(_19){ +},updateChoices:function(_20){ if(!this.changed&&this.hasFocus){ -this.update.innerHTML=_19; +this.update.innerHTML=_20; Element.cleanWhitespace(this.update); Element.cleanWhitespace(this.update.firstChild); if(this.update.firstChild&&this.update.firstChild.childNodes){ this.entryCount=this.update.firstChild.childNodes.length; for(var i=0;i<this.entryCount;i++){ -var _20=this.getEntry(i); -_20.autocompleteIndex=i; -this.addObservers(_20); +var _21=this.getEntry(i); +_21.autocompleteIndex=i; +this.addObservers(_21); } }else{ this.entryCount=0; @@ -906,9 +914,9 @@ this.stopIndicator(); this.index=0; this.render(); } -},addObservers:function(_21){ -Event.observe(_21,"mouseover",this.onHover.bindAsEventListener(this)); -Event.observe(_21,"click",this.onClick.bindAsEventListener(this)); +},addObservers:function(_22){ +Event.observe(_22,"mouseover",this.onHover.bindAsEventListener(this)); +Event.observe(_22,"click",this.onClick.bindAsEventListener(this)); },onObserverEvent:function(){ this.changed=false; if(this.getToken().length>=this.options.minChars){ @@ -919,26 +927,26 @@ this.active=false; this.hide(); } },getToken:function(){ -var _22=this.findLastToken(); -if(_22!=-1){ -var ret=this.element.value.substr(_22+1).replace(/^\s+/,"").replace(/\s+$/,""); +var _23=this.findLastToken(); +if(_23!=-1){ +var ret=this.element.value.substr(_23+1).replace(/^\s+/,"").replace(/\s+$/,""); }else{ var ret=this.element.value; } return /\n/.test(ret)?"":ret; },findLastToken:function(){ -var _24=-1; +var _25=-1; for(var i=0;i<this.options.tokens.length;i++){ -var _25=this.element.value.lastIndexOf(this.options.tokens[i]); -if(_25>_24){ -_24=_25; +var _26=this.element.value.lastIndexOf(this.options.tokens[i]); +if(_26>_25){ +_25=_26; } } -return _24; +return _25; }}; Ajax.Autocompleter=Class.create(); -Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(_26,_27,url,_29){ -this.baseInitialize(_26,_27,_29); +Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(_27,_28,url,_30){ +this.baseInitialize(_27,_28,_30); this.options.asynchronous=true; this.options.onComplete=this.onComplete.bind(this); this.options.defaultParams=this.options.parameters||null; @@ -950,62 +958,62 @@ if(this.options.defaultParams){ this.options.parameters+="&"+this.options.defaultParams; } new Ajax.Request(this.url,this.options); -},onComplete:function(_30){ -this.updateChoices(_30.responseText); +},onComplete:function(_31){ +this.updateChoices(_31.responseText); }}); Autocompleter.Local=Class.create(); -Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(_31,_32,_33,_34){ -this.baseInitialize(_31,_32,_34); -this.options.array=_33; +Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(_32,_33,_34,_35){ +this.baseInitialize(_32,_33,_35); +this.options.array=_34; },getUpdatedChoices:function(){ this.updateChoices(this.options.selector(this)); -},setOptions:function(_35){ -this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(_36){ +},setOptions:function(_36){ +this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(_37){ var ret=[]; -var _37=[]; -var _38=_36.getToken(); -var _39=0; -for(var i=0;i<_36.options.array.length&&ret.length<_36.options.choices;i++){ -var _40=_36.options.array[i]; -var _41=_36.options.ignoreCase?_40.toLowerCase().indexOf(_38.toLowerCase()):_40.indexOf(_38); -while(_41!=-1){ -if(_41==0&&_40.length!=_38.length){ -ret.push("<li><strong>"+_40.substr(0,_38.length)+"</strong>"+_40.substr(_38.length)+"</li>"); +var _38=[]; +var _39=_37.getToken(); +var _40=0; +for(var i=0;i<_37.options.array.length&&ret.length<_37.options.choices;i++){ +var _41=_37.options.array[i]; +var _42=_37.options.ignoreCase?_41.toLowerCase().indexOf(_39.toLowerCase()):_41.indexOf(_39); +while(_42!=-1){ +if(_42==0&&_41.length!=_39.length){ +ret.push("<li><strong>"+_41.substr(0,_39.length)+"</strong>"+_41.substr(_39.length)+"</li>"); break; }else{ -if(_38.length>=_36.options.partialChars&&_36.options.partialSearch&&_41!=-1){ -if(_36.options.fullSearch||/\s/.test(_40.substr(_41-1,1))){ -_37.push("<li>"+_40.substr(0,_41)+"<strong>"+_40.substr(_41,_38.length)+"</strong>"+_40.substr(_41+_38.length)+"</li>"); +if(_39.length>=_37.options.partialChars&&_37.options.partialSearch&&_42!=-1){ +if(_37.options.fullSearch||/\s/.test(_41.substr(_42-1,1))){ +_38.push("<li>"+_41.substr(0,_42)+"<strong>"+_41.substr(_42,_39.length)+"</strong>"+_41.substr(_42+_39.length)+"</li>"); break; } } } -_41=_36.options.ignoreCase?_40.toLowerCase().indexOf(_38.toLowerCase(),_41+1):_40.indexOf(_38,_41+1); +_42=_37.options.ignoreCase?_41.toLowerCase().indexOf(_39.toLowerCase(),_42+1):_41.indexOf(_39,_42+1); } } -if(_37.length){ -ret=ret.concat(_37.slice(0,_36.options.choices-ret.length)); +if(_38.length){ +ret=ret.concat(_38.slice(0,_37.options.choices-ret.length)); } return "<ul>"+ret.join("")+"</ul>"; -}},_35||{}); +}},_36||{}); }}); -Field.scrollFreeActivate=function(_42){ +Field.scrollFreeActivate=function(_43){ setTimeout(function(){ -Field.activate(_42); +Field.activate(_43); },1); }; Ajax.InPlaceEditor=Class.create(); Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99"; -Ajax.InPlaceEditor.prototype={initialize:function(_43,url,_44){ +Ajax.InPlaceEditor.prototype={initialize:function(_44,url,_45){ this.url=url; -this.element=$(_43); -this.options=Object.extend({okText:"ok",cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(_45,_43){ -new Effect.Highlight(_43,{startcolor:this.options.highlightcolor}); -},onFailure:function(_46){ -alert("Error communicating with the server: "+_46.responseText.stripTags()); -},callback:function(_47){ -return Form.serialize(_47); -},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,ajaxOptions:{}},_44||{}); +this.element=$(_44); +this.options=Object.extend({okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(_46,_44){ +new Effect.Highlight(_44,{startcolor:this.options.highlightcolor}); +},onFailure:function(_47){ +alert("Error communicating with the server: "+_47.responseText.stripTags()); +},callback:function(_48){ +return Form.serialize(_48); +},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{}},_45||{}); if(!this.options.formId&&this.element.id){ this.options.formId=this.element.id+"-inplaceeditor"; if($(this.options.formId)){ @@ -1061,49 +1069,62 @@ if(this.options.textarea){ var br=document.createElement("br"); this.form.appendChild(br); } +if(this.options.okButton){ okButton=document.createElement("input"); okButton.type="submit"; okButton.value=this.options.okText; this.form.appendChild(okButton); +} +if(this.options.cancelLink){ cancelLink=document.createElement("a"); cancelLink.href="#"; cancelLink.appendChild(document.createTextNode(this.options.cancelText)); cancelLink.onclick=this.onclickCancel.bind(this); this.form.appendChild(cancelLink); -},hasHTMLLineBreaks:function(_50){ +} +},hasHTMLLineBreaks:function(_51){ if(!this.options.handleLineBreaks){ return false; } -return _50.match(/<br/i)||_50.match(/<p>/i); -},convertHTMLLineBreaks:function(_51){ -return _51.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,""); +return _51.match(/<br/i)||_51.match(/<p>/i); +},convertHTMLLineBreaks:function(_52){ +return _52.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,""); },createEditField:function(){ -var _52; +var _53; if(this.options.loadTextURL){ -_52=this.options.loadingText; +_53=this.options.loadingText; }else{ -_52=this.getText(); +_53=this.getText(); } -if(this.options.rows==1&&!this.hasHTMLLineBreaks(_52)){ +var obj=this; +if(this.options.rows==1&&!this.hasHTMLLineBreaks(_53)){ this.options.textarea=false; -var _53=document.createElement("input"); -_53.type="text"; -_53.name="value"; -_53.value=_52; -_53.style.backgroundColor=this.options.highlightcolor; -var _54=this.options.size||this.options.cols||0; -if(_54!=0){ -_53.size=_54; -} -this.editField=_53; -}else{ -this.options.textarea=true; -var _55=document.createElement("textarea"); +var _55=document.createElement("input"); +_55.obj=this; +_55.type="text"; _55.name="value"; -_55.value=this.convertHTMLLineBreaks(_52); -_55.rows=this.options.rows; -_55.cols=this.options.cols||40; +_55.value=_53; +_55.style.backgroundColor=this.options.highlightcolor; +var _56=this.options.size||this.options.cols||0; +if(_56!=0){ +_55.size=_56; +} +if(this.options.submitOnBlur){ +_55.onblur=this.onSubmit.bind(this); +} this.editField=_55; +}else{ +this.options.textarea=true; +var _57=document.createElement("textarea"); +_57.obj=this; +_57.name="value"; +_57.value=this.convertHTMLLineBreaks(_53); +_57.rows=this.options.rows; +_57.cols=this.options.cols||40; +if(this.options.submitOnBlur){ +_57.onblur=this.onSubmit.bind(this); +} +this.editField=_57; } if(this.options.loadTextURL){ this.loadExternalText(); @@ -1115,26 +1136,26 @@ return this.element.innerHTML; Element.addClassName(this.form,this.options.loadingClassName); this.editField.disabled=true; new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions)); -},onLoadedExternalText:function(_56){ +},onLoadedExternalText:function(_58){ Element.removeClassName(this.form,this.options.loadingClassName); this.editField.disabled=false; -this.editField.value=_56.responseText.stripTags(); +this.editField.value=_58.responseText.stripTags(); },onclickCancel:function(){ this.onComplete(); this.leaveEditMode(); return false; -},onFailure:function(_57){ -this.options.onFailure(_57); +},onFailure:function(_59){ +this.options.onFailure(_59); if(this.oldInnerHTML){ this.element.innerHTML=this.oldInnerHTML; this.oldInnerHTML=null; } return false; },onSubmit:function(){ -var _58=this.form; -var _59=this.editField.value; +var _60=this.form; +var _61=this.editField.value; this.onLoading(); -new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(_58,_59),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions)); +new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(_60,_61),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions)); if(arguments.length>1){ Event.stop(arguments[0]); } @@ -1188,9 +1209,9 @@ this.editing=false; this.saving=false; this.oldInnerHTML=null; this.onLeaveEditMode(); -},onComplete:function(_60){ +},onComplete:function(_62){ this.leaveEditMode(); -this.options.onComplete.bind(this)(_60,this.element); +this.options.onComplete.bind(this)(_62,this.element); },onEnterEditMode:function(){ },onLeaveEditMode:function(){ },dispose:function(){ @@ -1208,14 +1229,14 @@ Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListene } }}; Form.Element.DelayedObserver=Class.create(); -Form.Element.DelayedObserver.prototype={initialize:function(_61,_62,_63){ -this.delay=_62||0.5; -this.element=$(_61); -this.callback=_63; +Form.Element.DelayedObserver.prototype={initialize:function(_63,_64,_65){ +this.delay=_64||0.5; +this.element=$(_63); +this.callback=_65; this.timer=null; this.lastValue=$F(this.element); Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this)); -},delayedListener:function(_64){ +},delayedListener:function(_66){ if(this.lastValue==$F(this.element)){ return; } @@ -1286,6 +1307,7 @@ _18.onHover(_17,_18.element,Position.overlap(_18.overlap,_18.element)); } if(_18.greedy){ Droppables.activate(_18); +throw $break; } } }); @@ -1344,6 +1366,7 @@ return; } this._lastPointer=null; this.activeDraggable.endDrag(_27); +this.activeDraggable=null; },keyPress:function(_28){ if(this.activeDraggable){ this.activeDraggable.keyPress(_28); @@ -1373,15 +1396,15 @@ return o[_35]; }}; var Draggable=Class.create(); Draggable.prototype={initialize:function(_36){ -this.element=$(_36); var _37=Object.extend({handle:false,starteffect:function(_36){ new Effect.Opacity(_36,{duration:0.2,from:1,to:0.7}); },reverteffect:function(_38,_39,_40){ var dur=Math.sqrt(Math.abs(_39^2)+Math.abs(_40^2))*0.02; -_38._revert=new Effect.MoveBy(_38,-_39,-_40,{duration:dur}); +_38._revert=new Effect.Move(_38,{x:-_40,y:-_39,duration:dur}); },endeffect:function(_42){ new Effect.Opacity(_42,{duration:0.2,from:0.7,to:1}); },zindex:1000,revert:false,snap:false},arguments[1]||{}); +this.element=$(element); if(_37.handle&&(typeof _37.handle=="string")){ this.handle=Element.childrenWithClassName(this.element,_37.handle)[0]; } @@ -1402,7 +1425,7 @@ Draggables.register(this); Event.stopObserving(this.handle,"mousedown",this.eventMouseDown); Draggables.unregister(this); },currentDelta:function(){ -return ([parseInt(this.element.style.left||"0"),parseInt(this.element.style.top||"0")]); +return ([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")]); },initDrag:function(_43){ if(Event.isLeftClick(_43)){ var src=Event.element(_43); diff --git a/framework/Web/Javascripts/js/effects.js b/framework/Web/Javascripts/js/effects.js index 44f1a4e8..d72e3eba 100644 --- a/framework/Web/Javascripts/js/effects.js +++ b/framework/Web/Javascripts/js/effects.js @@ -20,20 +20,15 @@ _1=this.toLowerCase(); } return (_1.length==7?_1:(arguments[0]||this)); }; -Element.collectTextNodesIgnoreClass=function(_4,_5){ -var _6=$(_4).childNodes; -var _7=""; -var _8=new RegExp("^([^ ]+ )*"+_5+"( [^ ]+)*$","i"); -for(var i=0;i<_6.length;i++){ -if(_6[i].nodeType==3){ -_7+=_6[i].nodeValue; -}else{ -if((!_6[i].className.match(_8))&&_6[i].hasChildNodes()){ -_7+=Element.collectTextNodesIgnoreClass(_6[i],_5); -} -} -} -return _7; +Element.collectTextNodes=function(_4){ +return $A($(_4).childNodes).collect(function(_5){ +return (_5.nodeType==3?_5.nodeValue:(_5.hasChildNodes()?Element.collectTextNodes(_5):"")); +}).flatten().join(""); +}; +Element.collectTextNodesIgnoreClass=function(_6,_7){ +return $A($(_6).childNodes).collect(function(_8){ +return (_8.nodeType==3?_8.nodeValue:((_8.hasChildNodes()&&!Element.hasClassName(_8,_7))?Element.collectTextNodes(_8):"")); +}).flatten().join(""); }; Element.setStyle=function(_9,_10){ _9=$(_9); @@ -116,6 +111,11 @@ var _31=_30.delay; $A(_29).each(function(_27,_32){ new _28(_27,Object.extend(_30,{delay:_32*_30.speed+_31})); }); +},PAIRS:{"slide":["SlideDown","SlideUp"],"blind":["BlindDown","BlindUp"],"appear":["Appear","Fade"]},toggle:function(_33,_34){ +_33=$(_33); +_34=(_34||"appear").toLowerCase(); +var _35=Object.extend({queue:{position:"end",scope:(_33.id||"global")}},arguments[2]||{}); +Effect[Element.visible(_33)?Effect.PAIRS[_34][1]:Effect.PAIRS[_34][0]](_33,_35); }}; var Effect2=Effect; Effect.Transitions={}; @@ -143,59 +143,72 @@ return 0; Effect.Transitions.full=function(pos){ return 1; }; -Effect.Queue={effects:[],_each:function(_34){ -this.effects._each(_34); -},interval:null,add:function(_35){ -var _36=new Date().getTime(); -switch(_35.options.queue){ +Effect.ScopedQueue=Class.create(); +Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){ +this.effects=[]; +this.interval=null; +},_each:function(_37){ +this.effects._each(_37); +},add:function(_38){ +var _39=new Date().getTime(); +var _40=(typeof _38.options.queue=="string")?_38.options.queue:_38.options.queue.position; +switch(_40){ case "front": this.effects.findAll(function(e){ return e.state=="idle"; }).each(function(e){ -e.startOn+=_35.finishOn; -e.finishOn+=_35.finishOn; +e.startOn+=_38.finishOn; +e.finishOn+=_38.finishOn; }); break; case "end": -_36=this.effects.pluck("finishOn").max()||_36; +_39=this.effects.pluck("finishOn").max()||_39; break; } -_35.startOn+=_36; -_35.finishOn+=_36; -this.effects.push(_35); +_38.startOn+=_39; +_38.finishOn+=_39; +this.effects.push(_38); if(!this.interval){ this.interval=setInterval(this.loop.bind(this),40); } -},remove:function(_38){ +},remove:function(_42){ this.effects=this.effects.reject(function(e){ -return e==_38; +return e==_42; }); if(this.effects.length==0){ clearInterval(this.interval); this.interval=null; } },loop:function(){ -var _39=new Date().getTime(); -this.effects.invoke("loop",_39); +var _43=new Date().getTime(); +this.effects.invoke("loop",_43); +}}); +Effect.Queues={instances:$H(),get:function(_44){ +if(typeof _44!="string"){ +return _44; +} +if(!this.instances[_44]){ +this.instances[_44]=new Effect.ScopedQueue(); +} +return this.instances[_44]; }}; -Object.extend(Effect.Queue,Enumerable); +Effect.Queue=Effect.Queues.get("global"); +Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"}; Effect.Base=function(){ }; -Effect.Base.prototype={position:null,setOptions:function(_40){ -this.options=Object.extend({transition:Effect.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"},_40||{}); -},start:function(_41){ -this.setOptions(_41||{}); +Effect.Base.prototype={position:null,start:function(_45){ +this.options=Object.extend(Object.extend({},Effect.DefaultOptions),_45||{}); 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){ -Effect.Queue.add(this); +Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this); } -},loop:function(_42){ -if(_42>=this.startOn){ -if(_42>=this.finishOn){ +},loop:function(_46){ +if(_46>=this.startOn){ +if(_46>=this.finishOn){ this.render(1); this.cancel(); this.event("beforeFinish"); @@ -205,11 +218,11 @@ this.finish(); this.event("afterFinish"); return; } -var pos=(_42-this.startOn)/(this.finishOn-this.startOn); -var _43=Math.round(pos*this.options.fps*this.options.duration); -if(_43>this.currentFrame){ +var pos=(_46-this.startOn)/(this.finishOn-this.startOn); +var _47=Math.round(pos*this.options.fps*this.options.duration); +if(_47>this.currentFrame){ this.render(pos); -this.currentFrame=_43; +this.currentFrame=_47; } } },render:function(pos){ @@ -236,65 +249,71 @@ this.event("afterUpdate"); } },cancel:function(){ if(!this.options.sync){ -Effect.Queue.remove(this); +Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this); } this.state="finished"; -},event:function(_44){ -if(this.options[_44+"Internal"]){ -this.options[_44+"Internal"](this); +},event:function(_48){ +if(this.options[_48+"Internal"]){ +this.options[_48+"Internal"](this); } -if(this.options[_44]){ -this.options[_44](this); +if(this.options[_48]){ +this.options[_48](this); } },inspect:function(){ return "#<Effect:"+$H(this).inspect()+",options:"+$H(this.options).inspect()+">"; }}; Effect.Parallel=Class.create(); -Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(_45){ -this.effects=_45||[]; +Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(_49){ +this.effects=_49||[]; this.start(arguments[1]); -},update:function(_46){ -this.effects.invoke("render",_46); -},finish:function(_47){ -this.effects.each(function(_48){ -_48.render(1); -_48.cancel(); -_48.event("beforeFinish"); -if(_48.finish){ -_48.finish(_47); -} -_48.event("afterFinish"); +},update:function(_50){ +this.effects.invoke("render",_50); +},finish:function(_51){ +this.effects.each(function(_52){ +_52.render(1); +_52.cancel(); +_52.event("beforeFinish"); +if(_52.finish){ +_52.finish(_51); +} +_52.event("afterFinish"); }); }}); Effect.Opacity=Class.create(); -Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(_49){ -this.element=$(_49); +Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(_53){ +this.element=$(_53); if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout)){ Element.setStyle(this.element,{zoom:1}); } -var _50=Object.extend({from:Element.getOpacity(this.element)||0,to:1},arguments[1]||{}); -this.start(_50); -},update:function(_51){ -Element.setOpacity(this.element,_51); +var _54=Object.extend({from:Element.getOpacity(this.element)||0,to:1},arguments[1]||{}); +this.start(_54); +},update:function(_55){ +Element.setOpacity(this.element,_55); }}); -Effect.MoveBy=Class.create(); -Object.extend(Object.extend(Effect.MoveBy.prototype,Effect.Base.prototype),{initialize:function(_52,_53,_54){ -this.element=$(_52); -this.toTop=_53; -this.toLeft=_54; -this.start(arguments[3]); +Effect.Move=Class.create(); +Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(_56){ +this.element=$(_56); +var _57=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{}); +this.start(_57); },setup:function(){ Element.makePositioned(this.element); -this.originalTop=parseFloat(Element.getStyle(this.element,"top")||"0"); this.originalLeft=parseFloat(Element.getStyle(this.element,"left")||"0"); -},update:function(_55){ -Element.setStyle(this.element,{top:this.toTop*_55+this.originalTop+"px",left:this.toLeft*_55+this.originalLeft+"px"}); +this.originalTop=parseFloat(Element.getStyle(this.element,"top")||"0"); +if(this.options.mode=="absolute"){ +this.options.x=this.options.x-this.originalLeft; +this.options.y=this.options.y-this.originalTop; +} +},update:function(_58){ +Element.setStyle(this.element,{left:this.options.x*_58+this.originalLeft+"px",top:this.options.y*_58+this.originalTop+"px"}); }}); +Effect.MoveBy=function(_59,_60,_61){ +return new Effect.Move(_59,Object.extend({x:_61,y:_60},arguments[3]||{})); +}; Effect.Scale=Class.create(); -Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(_56,_57){ -this.element=$(_56); -var _58=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_57},arguments[2]||{}); -this.start(_58); +Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(_62,_63){ +this.element=$(_62); +var _64=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_63},arguments[2]||{}); +this.start(_64); },setup:function(){ this.restoreAfterFinish=this.options.restoreAfterFinish||false; this.elementPositioning=Element.getStyle(this.element,"position"); @@ -304,11 +323,11 @@ this.originalStyle[k]=this.element.style[k]; }.bind(this)); this.originalTop=this.element.offsetTop; this.originalLeft=this.element.offsetLeft; -var _60=Element.getStyle(this.element,"font-size")||"100%"; -["em","px","%"].each(function(_61){ -if(_60.indexOf(_61)>0){ -this.fontSize=parseFloat(_60); -this.fontSizeType=_61; +var _66=Element.getStyle(this.element,"font-size")||"100%"; +["em","px","%"].each(function(_67){ +if(_66.indexOf(_67)>0){ +this.fontSize=parseFloat(_66); +this.fontSizeType=_67; } }.bind(this)); this.factor=(this.options.scaleTo-this.options.scaleFrom)/100; @@ -322,50 +341,50 @@ this.dims=[this.element.scrollHeight,this.element.scrollWidth]; if(!this.dims){ this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]; } -},update:function(_62){ -var _63=(this.options.scaleFrom/100)+(this.factor*_62); +},update:function(_68){ +var _69=(this.options.scaleFrom/100)+(this.factor*_68); if(this.options.scaleContent&&this.fontSize){ -Element.setStyle(this.element,{fontSize:this.fontSize*_63+this.fontSizeType}); +Element.setStyle(this.element,{fontSize:this.fontSize*_69+this.fontSizeType}); } -this.setDimensions(this.dims[0]*_63,this.dims[1]*_63); -},finish:function(_64){ +this.setDimensions(this.dims[0]*_69,this.dims[1]*_69); +},finish:function(_70){ if(this.restoreAfterFinish){ Element.setStyle(this.element,this.originalStyle); } -},setDimensions:function(_65,_66){ +},setDimensions:function(_71,_72){ var d={}; if(this.options.scaleX){ -d.width=_66+"px"; +d.width=_72+"px"; } if(this.options.scaleY){ -d.height=_65+"px"; +d.height=_71+"px"; } if(this.options.scaleFromCenter){ -var _68=(_65-this.dims[0])/2; -var _69=(_66-this.dims[1])/2; +var _74=(_71-this.dims[0])/2; +var _75=(_72-this.dims[1])/2; if(this.elementPositioning=="absolute"){ if(this.options.scaleY){ -d.top=this.originalTop-_68+"px"; +d.top=this.originalTop-_74+"px"; } if(this.options.scaleX){ -d.left=this.originalLeft-_69+"px"; +d.left=this.originalLeft-_75+"px"; } }else{ if(this.options.scaleY){ -d.top=-_68+"px"; +d.top=-_74+"px"; } if(this.options.scaleX){ -d.left=-_69+"px"; +d.left=-_75+"px"; } } } Element.setStyle(this.element,d); }}); Effect.Highlight=Class.create(); -Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(_70){ -this.element=$(_70); -var _71=Object.extend({startcolor:"#ffff99"},arguments[1]||{}); -this.start(_71); +Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(_76){ +this.element=$(_76); +var _77=Object.extend({startcolor:"#ffff99"},arguments[1]||{}); +this.start(_77); },setup:function(){ if(Element.getStyle(this.element,"display")=="none"){ this.cancel(); @@ -385,134 +404,134 @@ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16); this._delta=$R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]; }.bind(this)); -},update:function(_72){ +},update:function(_78){ Element.setStyle(this.element,{backgroundColor:$R(0,2).inject("#",function(m,v,i){ -return m+(Math.round(this._base[i]+(this._delta[i]*_72)).toColorPart()); +return m+(Math.round(this._base[i]+(this._delta[i]*_78)).toColorPart()); }.bind(this))}); },finish:function(){ Element.setStyle(this.element,Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor})); }}); Effect.ScrollTo=Class.create(); -Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(_75){ -this.element=$(_75); +Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(_81){ +this.element=$(_81); this.start(arguments[1]||{}); },setup:function(){ Position.prepare(); -var _76=Position.cumulativeOffset(this.element); +var _82=Position.cumulativeOffset(this.element); if(this.options.offset){ -_76[1]+=this.options.offset; +_82[1]+=this.options.offset; } var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight); this.scrollStart=Position.deltaY; -this.delta=(_76[1]>max?max:_76[1])-this.scrollStart; -},update:function(_78){ +this.delta=(_82[1]>max?max:_82[1])-this.scrollStart; +},update:function(_84){ Position.prepare(); -window.scrollTo(Position.deltaX,this.scrollStart+(_78*this.delta)); +window.scrollTo(Position.deltaX,this.scrollStart+(_84*this.delta)); }}); -Effect.Fade=function(_79){ -var _80=Element.getInlineOpacity(_79); -var _81=Object.extend({from:Element.getOpacity(_79)||1,to:0,afterFinishInternal:function(_82){ +Effect.Fade=function(_85){ +var _86=Element.getInlineOpacity(_85); +var _87=Object.extend({from:Element.getOpacity(_85)||1,to:0,afterFinishInternal:function(_88){ with(Element){ -if(_82.options.to!=0){ +if(_88.options.to!=0){ return; } -hide(_82.element); -setStyle(_82.element,{opacity:_80}); +hide(_88.element); +setStyle(_88.element,{opacity:_86}); } }},arguments[1]||{}); -return new Effect.Opacity(_79,_81); +return new Effect.Opacity(_85,_87); }; -Effect.Appear=function(_83){ -var _84=Object.extend({from:(Element.getStyle(_83,"display")=="none"?0:Element.getOpacity(_83)||0),to:1,beforeSetup:function(_85){ +Effect.Appear=function(_89){ +var _90=Object.extend({from:(Element.getStyle(_89,"display")=="none"?0:Element.getOpacity(_89)||0),to:1,beforeSetup:function(_91){ with(Element){ -setOpacity(_85.element,_85.options.from); -show(_85.element); +setOpacity(_91.element,_91.options.from); +show(_91.element); } }},arguments[1]||{}); -return new Effect.Opacity(_83,_84); +return new Effect.Opacity(_89,_90); }; -Effect.Puff=function(_86){ -_86=$(_86); -var _87={opacity:Element.getInlineOpacity(_86),position:Element.getStyle(_86,"position")}; -return new Effect.Parallel([new Effect.Scale(_86,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(_86,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(_88){ +Effect.Puff=function(_92){ +_92=$(_92); +var _93={opacity:Element.getInlineOpacity(_92),position:Element.getStyle(_92,"position")}; +return new Effect.Parallel([new Effect.Scale(_92,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(_92,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(_94){ with(Element){ -setStyle(_88.effects[0].element,{position:"absolute"}); +setStyle(_94.effects[0].element,{position:"absolute"}); } -},afterFinishInternal:function(_89){ +},afterFinishInternal:function(_95){ with(Element){ -hide(_89.effects[0].element); -setStyle(_89.effects[0].element,_87); +hide(_95.effects[0].element); +setStyle(_95.effects[0].element,_93); } }},arguments[1]||{})); }; -Effect.BlindUp=function(_90){ -_90=$(_90); -Element.makeClipping(_90); -return new Effect.Scale(_90,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_91){ +Effect.BlindUp=function(_96){ +_96=$(_96); +Element.makeClipping(_96); +return new Effect.Scale(_96,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_97){ with(Element){ -[hide,undoClipping].call(_91.element); +[hide,undoClipping].call(_97.element); } }},arguments[1]||{})); }; -Effect.BlindDown=function(_92){ -_92=$(_92); -var _93=Element.getStyle(_92,"height"); -var _94=Element.getDimensions(_92); -return new Effect.Scale(_92,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_94.height,originalWidth:_94.width},restoreAfterFinish:true,afterSetup:function(_95){ +Effect.BlindDown=function(_98){ +_98=$(_98); +var _99=Element.getStyle(_98,"height"); +var _100=Element.getDimensions(_98); +return new Effect.Scale(_98,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_100.height,originalWidth:_100.width},restoreAfterFinish:true,afterSetup:function(_101){ with(Element){ -makeClipping(_95.element); -setStyle(_95.element,{height:"0px"}); -show(_95.element); +makeClipping(_101.element); +setStyle(_101.element,{height:"0px"}); +show(_101.element); } -},afterFinishInternal:function(_96){ +},afterFinishInternal:function(_102){ with(Element){ -undoClipping(_96.element); -setStyle(_96.element,{height:_93}); +undoClipping(_102.element); +setStyle(_102.element,{height:_99}); } }},arguments[1]||{})); }; -Effect.SwitchOff=function(_97){ -_97=$(_97); -var _98=Element.getInlineOpacity(_97); -return new Effect.Appear(_97,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(_99){ -new Effect.Scale(_99.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(_99){ +Effect.SwitchOff=function(_103){ +_103=$(_103); +var _104=Element.getInlineOpacity(_103); +return new Effect.Appear(_103,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(_105){ +new Effect.Scale(_105.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(_105){ with(Element){ -[makePositioned,makeClipping].call(_99.element); +[makePositioned,makeClipping].call(_105.element); } -},afterFinishInternal:function(_100){ +},afterFinishInternal:function(_106){ with(Element){ -[hide,undoClipping,undoPositioned].call(_100.element); -setStyle(_100.element,{opacity:_98}); +[hide,undoClipping,undoPositioned].call(_106.element); +setStyle(_106.element,{opacity:_104}); } }}); }}); }; -Effect.DropOut=function(_101){ -_101=$(_101); -var _102={top:Element.getStyle(_101,"top"),left:Element.getStyle(_101,"left"),opacity:Element.getInlineOpacity(_101)}; -return new Effect.Parallel([new Effect.MoveBy(_101,100,0,{sync:true}),new Effect.Opacity(_101,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(_103){ +Effect.DropOut=function(_107){ +_107=$(_107); +var _108={top:Element.getStyle(_107,"top"),left:Element.getStyle(_107,"left"),opacity:Element.getInlineOpacity(_107)}; +return new Effect.Parallel([new Effect.Move(_107,{x:0,y:100,sync:true}),new Effect.Opacity(_107,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(_109){ with(Element){ -makePositioned(_103.effects[0].element); +makePositioned(_109.effects[0].element); } -},afterFinishInternal:function(_104){ +},afterFinishInternal:function(_110){ with(Element){ -[hide,undoPositioned].call(_104.effects[0].element); -setStyle(_104.effects[0].element,_102); +[hide,undoPositioned].call(_110.effects[0].element); +setStyle(_110.effects[0].element,_108); } }},arguments[1]||{})); }; -Effect.Shake=function(_105){ -_105=$(_105); -var _106={top:Element.getStyle(_105,"top"),left:Element.getStyle(_105,"left")}; -return new Effect.MoveBy(_105,0,20,{duration:0.05,afterFinishInternal:function(_107){ -new Effect.MoveBy(_107.element,0,-40,{duration:0.1,afterFinishInternal:function(_107){ -new Effect.MoveBy(_107.element,0,40,{duration:0.1,afterFinishInternal:function(_107){ -new Effect.MoveBy(_107.element,0,-40,{duration:0.1,afterFinishInternal:function(_107){ -new Effect.MoveBy(_107.element,0,40,{duration:0.1,afterFinishInternal:function(_107){ -new Effect.MoveBy(_107.element,0,-20,{duration:0.05,afterFinishInternal:function(_107){ +Effect.Shake=function(_111){ +_111=$(_111); +var _112={top:Element.getStyle(_111,"top"),left:Element.getStyle(_111,"left")}; +return new Effect.Move(_111,{x:20,y:0,duration:0.05,afterFinishInternal:function(_113){ +new Effect.Move(_113.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_113){ +new Effect.Move(_113.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_113){ +new Effect.Move(_113.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_113){ +new Effect.Move(_113.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_113){ +new Effect.Move(_113.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(_113){ with(Element){ -undoPositioned(_107.element); -setStyle(_107.element,_106); +undoPositioned(_113.element); +setStyle(_113.element,_112); } }}); }}); @@ -521,200 +540,190 @@ setStyle(_107.element,_106); }}); }}); }; -Effect.SlideDown=function(_108){ -_108=$(_108); -Element.cleanWhitespace(_108); -var _109=Element.getStyle(_108.firstChild,"bottom"); -var _110=Element.getDimensions(_108); -return new Effect.Scale(_108,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_110.height,originalWidth:_110.width},restoreAfterFinish:true,afterSetup:function(_111){ +Effect.SlideDown=function(_114){ +_114=$(_114); +Element.cleanWhitespace(_114); +var _115=Element.getStyle(_114.firstChild,"bottom"); +var _116=Element.getDimensions(_114); +return new Effect.Scale(_114,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_116.height,originalWidth:_116.width},restoreAfterFinish:true,afterSetup:function(_117){ with(Element){ -makePositioned(_111.element); -makePositioned(_111.element.firstChild); +makePositioned(_117.element); +makePositioned(_117.element.firstChild); if(window.opera){ -setStyle(_111.element,{top:""}); +setStyle(_117.element,{top:""}); } -makeClipping(_111.element); -setStyle(_111.element,{height:"0px"}); -show(_108); +makeClipping(_117.element); +setStyle(_117.element,{height:"0px"}); +show(_114); } -},afterUpdateInternal:function(_112){ +},afterUpdateInternal:function(_118){ with(Element){ -setStyle(_112.element.firstChild,{bottom:(_112.dims[0]-_112.element.clientHeight)+"px"}); +setStyle(_118.element.firstChild,{bottom:(_118.dims[0]-_118.element.clientHeight)+"px"}); } -},afterFinishInternal:function(_113){ +},afterFinishInternal:function(_119){ with(Element){ -undoClipping(_113.element); -undoPositioned(_113.element.firstChild); -undoPositioned(_113.element); -setStyle(_113.element.firstChild,{bottom:_109}); +undoClipping(_119.element); +undoPositioned(_119.element.firstChild); +undoPositioned(_119.element); +setStyle(_119.element.firstChild,{bottom:_115}); } }},arguments[1]||{})); }; -Effect.SlideUp=function(_114){ -_114=$(_114); -Element.cleanWhitespace(_114); -var _115=Element.getStyle(_114.firstChild,"bottom"); -return new Effect.Scale(_114,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_116){ +Effect.SlideUp=function(_120){ +_120=$(_120); +Element.cleanWhitespace(_120); +var _121=Element.getStyle(_120.firstChild,"bottom"); +return new Effect.Scale(_120,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_122){ with(Element){ -makePositioned(_116.element); -makePositioned(_116.element.firstChild); +makePositioned(_122.element); +makePositioned(_122.element.firstChild); if(window.opera){ -setStyle(_116.element,{top:""}); +setStyle(_122.element,{top:""}); } -makeClipping(_116.element); -show(_114); +makeClipping(_122.element); +show(_120); } -},afterUpdateInternal:function(_117){ +},afterUpdateInternal:function(_123){ with(Element){ -setStyle(_117.element.firstChild,{bottom:(_117.dims[0]-_117.element.clientHeight)+"px"}); +setStyle(_123.element.firstChild,{bottom:(_123.dims[0]-_123.element.clientHeight)+"px"}); } -},afterFinishInternal:function(_118){ +},afterFinishInternal:function(_124){ with(Element){ -[hide,undoClipping].call(_118.element); -undoPositioned(_118.element.firstChild); -undoPositioned(_118.element); -setStyle(_118.element.firstChild,{bottom:_115}); +[hide,undoClipping].call(_124.element); +undoPositioned(_124.element.firstChild); +undoPositioned(_124.element); +setStyle(_124.element.firstChild,{bottom:_121}); } }},arguments[1]||{})); }; -Effect.Squish=function(_119){ -return new Effect.Scale(_119,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(_120){ +Effect.Squish=function(_125){ +return new Effect.Scale(_125,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(_126){ with(Element){ -makeClipping(_120.element); +makeClipping(_126.element); } -},afterFinishInternal:function(_121){ +},afterFinishInternal:function(_127){ with(Element){ -hide(_121.element); -undoClipping(_121.element); +hide(_127.element); +undoClipping(_127.element); } }}); }; -Effect.Grow=function(_122){ -_122=$(_122); -var _123=Object.extend({direction:"center",moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{}); -var _124={top:_122.style.top,left:_122.style.left,height:_122.style.height,width:_122.style.width,opacity:Element.getInlineOpacity(_122)}; -var dims=Element.getDimensions(_122); -var _126,initialMoveY; -var _127,moveY; -switch(_123.direction){ +Effect.Grow=function(_128){ +_128=$(_128); +var _129=Object.extend({direction:"center",moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{}); +var _130={top:_128.style.top,left:_128.style.left,height:_128.style.height,width:_128.style.width,opacity:Element.getInlineOpacity(_128)}; +var dims=Element.getDimensions(_128); +var _132,initialMoveY; +var _133,moveY; +switch(_129.direction){ case "top-left": -_126=initialMoveY=_127=moveY=0; +_132=initialMoveY=_133=moveY=0; break; case "top-right": -_126=dims.width; +_132=dims.width; initialMoveY=moveY=0; -_127=-dims.width; +_133=-dims.width; break; case "bottom-left": -_126=_127=0; +_132=_133=0; initialMoveY=dims.height; moveY=-dims.height; break; case "bottom-right": -_126=dims.width; +_132=dims.width; initialMoveY=dims.height; -_127=-dims.width; +_133=-dims.width; moveY=-dims.height; break; case "center": -_126=dims.width/2; +_132=dims.width/2; initialMoveY=dims.height/2; -_127=-dims.width/2; +_133=-dims.width/2; moveY=-dims.height/2; break; } -return new Effect.MoveBy(_122,initialMoveY,_126,{duration:0.01,beforeSetup:function(_128){ +return new Effect.Move(_128,{x:_132,y:initialMoveY,duration:0.01,beforeSetup:function(_134){ with(Element){ -hide(_128.element); -makeClipping(_128.element); -makePositioned(_128.element); +hide(_134.element); +makeClipping(_134.element); +makePositioned(_134.element); } -},afterFinishInternal:function(_129){ -new Effect.Parallel([new Effect.Opacity(_129.element,{sync:true,to:1,from:0,transition:_123.opacityTransition}),new Effect.MoveBy(_129.element,moveY,_127,{sync:true,transition:_123.moveTransition}),new Effect.Scale(_129.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:_123.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(_129){ +},afterFinishInternal:function(_135){ +new Effect.Parallel([new Effect.Opacity(_135.element,{sync:true,to:1,from:0,transition:_129.opacityTransition}),new Effect.Move(_135.element,{x:_133,y:moveY,sync:true,transition:_129.moveTransition}),new Effect.Scale(_135.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:_129.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(_135){ with(Element){ -setStyle(_129.effects[0].element,{height:"0px"}); -show(_129.effects[0].element); +setStyle(_135.effects[0].element,{height:"0px"}); +show(_135.effects[0].element); } -},afterFinishInternal:function(_130){ +},afterFinishInternal:function(_136){ with(Element){ -[undoClipping,undoPositioned].call(_130.effects[0].element); -setStyle(_130.effects[0].element,_124); +[undoClipping,undoPositioned].call(_136.effects[0].element); +setStyle(_136.effects[0].element,_130); } -}},_123)); +}},_129)); }}); }; -Effect.Shrink=function(_131){ -_131=$(_131); -var _132=Object.extend({direction:"center",moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{}); -var _133={top:_131.style.top,left:_131.style.left,height:_131.style.height,width:_131.style.width,opacity:Element.getInlineOpacity(_131)}; -var dims=Element.getDimensions(_131); -var _134,moveY; -switch(_132.direction){ +Effect.Shrink=function(_137){ +_137=$(_137); +var _138=Object.extend({direction:"center",moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{}); +var _139={top:_137.style.top,left:_137.style.left,height:_137.style.height,width:_137.style.width,opacity:Element.getInlineOpacity(_137)}; +var dims=Element.getDimensions(_137); +var _140,moveY; +switch(_138.direction){ case "top-left": -_134=moveY=0; +_140=moveY=0; break; case "top-right": -_134=dims.width; +_140=dims.width; moveY=0; break; case "bottom-left": -_134=0; +_140=0; moveY=dims.height; break; case "bottom-right": -_134=dims.width; +_140=dims.width; moveY=dims.height; break; case "center": -_134=dims.width/2; +_140=dims.width/2; moveY=dims.height/2; break; } -return new Effect.Parallel([new Effect.Opacity(_131,{sync:true,to:0,from:1,transition:_132.opacityTransition}),new Effect.Scale(_131,window.opera?1:0,{sync:true,transition:_132.scaleTransition,restoreAfterFinish:true}),new Effect.MoveBy(_131,moveY,_134,{sync:true,transition:_132.moveTransition})],Object.extend({beforeStartInternal:function(_135){ +return new Effect.Parallel([new Effect.Opacity(_137,{sync:true,to:0,from:1,transition:_138.opacityTransition}),new Effect.Scale(_137,window.opera?1:0,{sync:true,transition:_138.scaleTransition,restoreAfterFinish:true}),new Effect.Move(_137,{x:_140,y:moveY,sync:true,transition:_138.moveTransition})],Object.extend({beforeStartInternal:function(_141){ with(Element){ -[makePositioned,makeClipping].call(_135.effects[0].element); +[makePositioned,makeClipping].call(_141.effects[0].element); } -},afterFinishInternal:function(_136){ +},afterFinishInternal:function(_142){ with(Element){ -[hide,undoClipping,undoPositioned].call(_136.effects[0].element); -setStyle(_136.effects[0].element,_133); +[hide,undoClipping,undoPositioned].call(_142.effects[0].element); +setStyle(_142.effects[0].element,_139); } -}},_132)); +}},_138)); }; -Effect.Pulsate=function(_137){ -_137=$(_137); -var _138=arguments[1]||{}; -var _139=Element.getInlineOpacity(_137); -var _140=_138.transition||Effect.Transitions.sinoidal; -var _141=function(pos){ -return _140(1-Effect.Transitions.pulse(pos)); -}; -_141.bind(_140); -return new Effect.Opacity(_137,Object.extend(Object.extend({duration:3,from:0,afterFinishInternal:function(_142){ -Element.setStyle(_142.element,{opacity:_139}); -}},_138),{transition:_141})); -}; -Effect.Fold=function(_143){ +Effect.Pulsate=function(_143){ _143=$(_143); -var _144={top:_143.style.top,left:_143.style.left,width:_143.style.width,height:_143.style.height}; -Element.makeClipping(_143); -return new Effect.Scale(_143,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(_145){ -new Effect.Scale(_143,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_145){ +var _144=arguments[1]||{}; +var _145=Element.getInlineOpacity(_143); +var _146=_144.transition||Effect.Transitions.sinoidal; +var _147=function(pos){ +return _146(1-Effect.Transitions.pulse(pos)); +}; +_147.bind(_146); +return new Effect.Opacity(_143,Object.extend(Object.extend({duration:3,from:0,afterFinishInternal:function(_148){ +Element.setStyle(_148.element,{opacity:_145}); +}},_144),{transition:_147})); +}; +Effect.Fold=function(_149){ +_149=$(_149); +var _150={top:_149.style.top,left:_149.style.left,width:_149.style.width,height:_149.style.height}; +Element.makeClipping(_149); +return new Effect.Scale(_149,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(_151){ +new Effect.Scale(_149,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_151){ with(Element){ -[hide,undoClipping].call(_145.element); -setStyle(_145.element,_144); +[hide,undoClipping].call(_151.element); +setStyle(_151.element,_150); } }}); }},arguments[1]||{})); }; -Prado.Effect={Highlight:function(_1,_2){ -new Effect.Highlight(_1,{"duration":_2}); -},Scale:function(_3,_4){ -new Effect.Scale(_3,_4); -},MoveBy:function(_5,_6,_7){ -new Effect.MoveBy(_5,_6,_7); -},ScrollTo:function(_8,_9){ -new Effect.ScrollTo(_8,{"duration":_9}); -}}; -
diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js index 1683b3fe..9d6ec1b7 100644 --- a/framework/Web/Javascripts/js/prado.js +++ b/framework/Web/Javascripts/js/prado.js @@ -1345,636 +1345,99 @@ return [valueL,_36]; }; } -function getAllChildren(e){ -return e.all?e.all:e.getElementsByTagName("*"); -} -document.getElementsBySelector=function(_2){ -if(!document.getElementsByTagName){ -return new Array(); -} -var _3=_2.split(" "); -var _4=new Array(document); -for(var i=0;i<_3.length;i++){ -token=_3[i].replace(/^\s+/,"").replace(/\s+$/,""); -if(token.indexOf("#")>-1){ -var _6=token.split("#"); -var _7=_6[0]; -var id=_6[1]; -var _9=document.getElementById(id); -if(_7&&_9.nodeName.toLowerCase()!=_7){ -return new Array(); -} -_4=new Array(_9); -continue; -} -if(token.indexOf(".")>-1){ -var _6=token.split("."); -var _7=_6[0]; -var _10=_6[1]; -if(!_7){ -_7="*"; -} -var _11=new Array; -var _12=0; -for(var h=0;h<_4.length;h++){ -var _14; -if(_7=="*"){ -_14=getAllChildren(_4[h]); -}else{ -_14=_4[h].getElementsByTagName(_7); -} -for(var j=0;j<_14.length;j++){ -_11[_12++]=_14[j]; -} -} -_4=new Array; -var _16=0; -for(var k=0;k<_11.length;k++){ -if(_11[k].className&&_11[k].className.match(new RegExp("\\b"+_10+"\\b"))){ -_4[_16++]=_11[k]; -} -} -continue; -} -if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){ -var _7=RegExp.$1; -var _18=RegExp.$2; -var _19=RegExp.$3; -var _20=RegExp.$4; -if(!_7){ -_7="*"; -} -var _11=new Array; -var _12=0; -for(var h=0;h<_4.length;h++){ -var _14; -if(_7=="*"){ -_14=getAllChildren(_4[h]); -}else{ -_14=_4[h].getElementsByTagName(_7); -} -for(var j=0;j<_14.length;j++){ -_11[_12++]=_14[j]; -} -} -_4=new Array; -var _16=0; -var _21; -switch(_19){ -case "=": -_21=function(e){ -return (e.getAttribute(_18)==_20); -}; -break; -case "~": -_21=function(e){ -return (e.getAttribute(_18).match(new RegExp("\\b"+_20+"\\b"))); -}; -break; -case "|": -_21=function(e){ -return (e.getAttribute(_18).match(new RegExp("^"+_20+"-?"))); -}; -break; -case "^": -_21=function(e){ -return (e.getAttribute(_18).indexOf(_20)==0); -}; -break; -case "$": -_21=function(e){ -return (e.getAttribute(_18).lastIndexOf(_20)==e.getAttribute(_18).length-_20.length); -}; -break; -case "*": -_21=function(e){ -return (e.getAttribute(_18).indexOf(_20)>-1); -}; -break; -default: -_21=function(e){ -return e.getAttribute(_18); -}; -} -_4=new Array; -var _16=0; -for(var k=0;k<_11.length;k++){ -if(_21(_11[k])){ -_4[_16++]=_11[k]; -} -} -continue; -} -_7=token; -var _11=new Array; -var _12=0; -for(var h=0;h<_4.length;h++){ -var _14=_4[h].getElementsByTagName(_7); -for(var j=0;j<_14.length;j++){ -_11[_12++]=_14[j]; -} -} -_4=_11; -} -return _4; -}; -
-var Behaviour={list:new Array,register:function(_1){ -Behaviour.list.push(_1); -},start:function(){ -Event.OnLoad(Behaviour.apply); -},apply:function(){ -for(h=0;sheet=Behaviour.list[h];h++){ -for(selector in sheet){ -list=document.getElementsBySelector(selector); -if(!list){ -continue; -} -for(i=0;element=list[i];i++){ -sheet[selector](element); -} -} -} -}}; -Behaviour.start(); -
-Object.debug=function(_1){ -var _2=[]; -if(typeof _1 in ["string","number"]){ -return _1; -}else{ -for(property in _1){ -if(typeof _1[property]!="function"){ -_2.push(property+" => "+(typeof _1[property]=="string"?"\""+_1[property]+"\"":_1[property])); +var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(_1){ +_1=_1.toUpperCase(); +var _2=this.NODEMAP[_1]||"div"; +var _3=document.createElement(_2); +try{ +_3.innerHTML="<"+_1+"></"+_1+">"; } +catch(e){ } +var _4=_3.firstChild||null; +if(_4&&(_4.tagName!=_1)){ +_4=_4.getElementsByTagName(_1)[0]; } -return ("'"+_1+"' #"+typeof _1+": {"+_2.join(", ")+"}"); -}; -String.prototype.toArray=function(){ -var _3=[]; -for(var i=0;i<this.length;i++){ -_3.push(this.charAt(i)); +if(!_4){ +_4=document.createElement(_1); } -return _3; -}; -var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(_5){ -_5=_5.toUpperCase(); -var _6=this.NODEMAP[_5]||"div"; -var _7=document.createElement(_6); -_7.innerHTML="<"+_5+"></"+_5+">"; -var _8=_7.firstChild||null; -if(_8&&(_8.tagName!=_5)){ -_8=_8.getElementsByTagName(_5)[0]; -} -if(!_8){ -_8=document.createElement(_5); -} -if(!_8){ +if(!_4){ return; } if(arguments[1]){ if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)){ -this._children(_8,arguments[1]); +this._children(_4,arguments[1]); }else{ -var _9=this._attributes(arguments[1]); -if(_9.length){ -_7.innerHTML="<"+_5+" "+_9+"></"+_5+">"; -_8=_7.firstChild||null; -if(!_8){ -_8=document.createElement(_5); +var _5=this._attributes(arguments[1]); +if(_5.length){ +try{ +_3.innerHTML="<"+_1+" "+_5+"></"+_1+">"; +} +catch(e){ +} +_4=_3.firstChild||null; +if(!_4){ +_4=document.createElement(_1); for(attr in arguments[1]){ -_8[attr=="class"?"className":attr]=arguments[1][attr]; +_4[attr=="class"?"className":attr]=arguments[1][attr]; } } -if(_8.tagName!=_5){ -_8=_7.getElementsByTagName(_5)[0]; +if(_4.tagName!=_1){ +_4=_3.getElementsByTagName(_1)[0]; } } } } if(arguments[2]){ -this._children(_8,arguments[2]); +this._children(_4,arguments[2]); } -return _8; -},_text:function(_10){ -return document.createTextNode(_10); -},_attributes:function(_11){ -var _12=[]; -for(attribute in _11){ -_12.push((attribute=="className"?"class":attribute)+"=\""+_11[attribute].toString().escapeHTML()+"\""); -} -return _12.join(" "); -},_children:function(_13,_14){ -if(typeof _14=="object"){ -_14.flatten().each(function(e){ +return _4; +},_text:function(_6){ +return document.createTextNode(_6); +},_attributes:function(_7){ +var _8=[]; +for(attribute in _7){ +_8.push((attribute=="className"?"class":attribute)+"=\""+_7[attribute].toString().escapeHTML()+"\""); +} +return _8.join(" "); +},_children:function(_9,_10){ +if(typeof _10=="object"){ +_10.flatten().each(function(e){ if(typeof e=="object"){ -_13.appendChild(e); +_9.appendChild(e); }else{ if(Builder._isStringOrNumber(e)){ -_13.appendChild(Builder._text(e)); +_9.appendChild(Builder._text(e)); } } }); }else{ -if(Builder._isStringOrNumber(_14)){ -_13.appendChild(Builder._text(_14)); +if(Builder._isStringOrNumber(_10)){ +_9.appendChild(Builder._text(_10)); } } -},_isStringOrNumber:function(_16){ -return (typeof _16=="string"||typeof _16=="number"); +},_isStringOrNumber:function(_12){ +return (typeof _12=="string"||typeof _12=="number"); }}; -String.prototype.camelize=function(){ -var _17=this.split("-"); -if(_17.length==1){ -return _17[0]; -} -var ret=this.indexOf("-")==0?_17[0].charAt(0).toUpperCase()+_17[0].substring(1):_17[0]; -for(var i=1,len=_17.length;i<len;i++){ -var s=_17[i]; -ret+=s.charAt(0).toUpperCase()+s.substring(1); -} -return ret; -}; -Element.getStyle=function(_20,_21){ -_20=$(_20); -var _22=_20.style[_21.camelize()]; -if(!_22){ -if(document.defaultView&&document.defaultView.getComputedStyle){ -var css=document.defaultView.getComputedStyle(_20,null); -_22=(css!=null)?css.getPropertyValue(_21):null; -}else{ -if(_20.currentStyle){ -_22=_20.currentStyle[_21.camelize()]; -} -} -} -if(window.opera&&(_21=="left"||_21=="top"||_21=="right"||_21=="bottom")){ -if(Element.getStyle(_20,"position")=="static"){ -_22="auto"; -} -} -if(_22=="auto"){ -_22=null; -} -return _22; -}; -String.prototype.parseColor=function(){ -color="#"; -if(this.slice(0,4)=="rgb("){ -var _24=this.slice(4,this.length-1).split(","); -var i=0; -do{ -color+=parseInt(_24[i]).toColorPart(); -}while(++i<3); -}else{ -if(this.slice(0,1)=="#"){ -if(this.length==4){ -for(var i=1;i<4;i++){ -color+=(this.charAt(i)+this.charAt(i)).toLowerCase(); -} -} -if(this.length==7){ -color=this.toLowerCase(); -} -} -} -return (color.length==7?color:(arguments[0]||this)); -}; -Element.makePositioned=function(_25){ -_25=$(_25); -var pos=Element.getStyle(_25,"position"); -if(pos=="static"||!pos){ -_25._madePositioned=true; -_25.style.position="relative"; -if(window.opera){ -_25.style.top=0; -_25.style.left=0; -} -} -}; -Element.undoPositioned=function(_27){ -_27=$(_27); -if(typeof _27._madePositioned!="undefined"){ -_27._madePositioned=undefined; -_27.style.position=""; -_27.style.top=""; -_27.style.left=""; -_27.style.bottom=""; -_27.style.right=""; -} -}; -Element.makeClipping=function(_28){ -_28=$(_28); -if(typeof _28._overflow!="undefined"){ -return; -} -_28._overflow=_28.style.overflow; -if((Element.getStyle(_28,"overflow")||"visible")!="hidden"){ -_28.style.overflow="hidden"; -} -}; -Element.undoClipping=function(_29){ -_29=$(_29); -if(typeof _29._overflow=="undefined"){ -return; -} -_29.style.overflow=_29._overflow; -_29._overflow=undefined; -}; -Element.collectTextNodesIgnoreClass=function(_30,_31){ -var _32=$(_30).childNodes; -var _33=""; -var _34=new RegExp("^([^ ]+ )*"+_31+"( [^ ]+)*$","i"); -for(var i=0;i<_32.length;i++){ -if(_32[i].nodeType==3){ -_33+=_32[i].nodeValue; -}else{ -if((!_32[i].className.match(_34))&&_32[i].hasChildNodes()){ -_33+=Element.collectTextNodesIgnoreClass(_32[i],_31); -} -} -} -return _33; -}; -Element.setContentZoom=function(_35,_36){ -_35=$(_35); -_35.style.fontSize=(_36/100)+"em"; -if(navigator.appVersion.indexOf("AppleWebKit")>0){ -window.scrollBy(0,0); -} -}; -Element.getOpacity=function(_37){ -var _38; -if(_38=Element.getStyle(_37,"opacity")){ -return parseFloat(_38); -} -if(_38=(Element.getStyle(_37,"filter")||"").match(/alpha\(opacity=(.*)\)/)){ -if(_38[1]){ -return parseFloat(_38[1])/100; -} -} -return 1; -}; -Element.setOpacity=function(_39,_40){ -_39=$(_39); -var els=_39.style; -if(_40==1){ -els.opacity="0.999999"; -if(/MSIE/.test(navigator.userAgent)){ -els.filter=Element.getStyle(_39,"filter").replace(/alpha\([^\)]*\)/gi,""); -} -}else{ -if(_40<0.00001){ -_40=0; -} -els.opacity=_40; -if(/MSIE/.test(navigator.userAgent)){ -els.filter=Element.getStyle(_39,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_40*100+")"; -} -} -}; -Element.getInlineOpacity=function(_42){ -_42=$(_42); -var op; -op=_42.style.opacity; -if(typeof op!="undefined"&&op!=""){ -return op; -} -return ""; -}; -Element.setInlineOpacity=function(_44,_45){ -_44=$(_44); -var els=_44.style; -els.opacity=_45; -}; -Element.getDimensions=function(_46){ -_46=$(_46); -if(Element.getStyle(_46,"display")=="none"){ -var els=_46.style; -var _47=els.visibility; -var _48=els.position; -els.visibility="hidden"; -els.position="absolute"; -els.display=""; -var _49=_46.clientWidth; -var _50=_46.clientHeight; -els.display="none"; -els.position=_48; -els.visibility=_47; -return {width:_49,height:_50}; -} -return {width:_46.offsetWidth,height:_46.offsetHeight}; -}; -Position.positionedOffset=function(_51){ -var _52=0,valueL=0; -do{ -_52+=_51.offsetTop||0; -valueL+=_51.offsetLeft||0; -_51=_51.offsetParent; -if(_51){ -p=Element.getStyle(_51,"position"); -if(p=="relative"||p=="absolute"){ -break; -} -} -}while(_51); -return [valueL,_52]; -}; -if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){ -Position.cumulativeOffset=function(_53){ -var _54=0,valueL=0; -do{ -_54+=_53.offsetTop||0; -valueL+=_53.offsetLeft||0; -if(_53.offsetParent==document.body){ -if(Element.getStyle(_53,"position")=="absolute"){ -break; -} -} -_53=_53.offsetParent; -}while(_53); -return [valueL,_54]; -}; -} -Position.page=function(_55){ -var _56=0,valueL=0; -var _57=_55; -do{ -_56+=_57.offsetTop||0; -valueL+=_57.offsetLeft||0; -if(_57.offsetParent==document.body){ -if(Element.getStyle(_57,"position")=="absolute"){ -break; -} -} -}while(_57=_57.offsetParent); -_57=_55; -do{ -_56-=_57.scrollTop||0; -valueL-=_57.scrollLeft||0; -}while(_57=_57.parentNode); -return [valueL,_56]; -}; -Position.offsetParent=function(_58){ -if(_58.offsetParent){ -return _58.offsetParent; -} -if(_58==document.body){ -return _58; -} -while((_58=_58.parentNode)&&_58!=document.body){ -if(Element.getStyle(_58,"position")!="static"){ -return _58; -} -} -return document.body; -}; -Position.clone=function(_59,_60){ -var _61=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{}); -_59=$(_59); -var p=Position.page(_59); -_60=$(_60); -var _63=[0,0]; -var _64=null; -if(Element.getStyle(_60,"position")=="absolute"){ -_64=Position.offsetParent(_60); -_63=Position.page(_64); -} -if(_64==document.body){ -_63[0]-=document.body.offsetLeft; -_63[1]-=document.body.offsetTop; -} -if(_61.setLeft){ -_60.style.left=(p[0]-_63[0]+_61.offsetLeft)+"px"; -} -if(_61.setTop){ -_60.style.top=(p[1]-_63[1]+_61.offsetTop)+"px"; +
+Object.extend(Builder,{exportTags:function(){ +var _1=["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"]; +_1.each(function(_2){ +window[_2]=function(){ +var _3=$A(arguments); +if(_3.length==0){ +return Builder.node(_2,null); } -if(_61.setWidth){ -_60.style.width=_59.offsetWidth+"px"; +if(_3.length==1){ +return Builder.node(_2,_3[1]); } -if(_61.setHeight){ -_60.style.height=_59.offsetHeight+"px"; +if(_3.length>1){ +return Builder.node(_2,_3.shift(),_3); } }; -Position.absolutize=function(_65){ -_65=$(_65); -if(_65.style.position=="absolute"){ -return; -} -Position.prepare(); -var _66=Position.positionedOffset(_65); -var top=_66[1]; -var _68=_66[0]; -var _69=_65.clientWidth; -var _70=_65.clientHeight; -_65._originalLeft=_68-parseFloat(_65.style.left||0); -_65._originalTop=top-parseFloat(_65.style.top||0); -_65._originalWidth=_65.style.width; -_65._originalHeight=_65.style.height; -_65.style.position="absolute"; -_65.style.top=top+"px"; -_65.style.left=_68+"px"; -_65.style.width=_69+"px"; -_65.style.height=_70+"px"; -}; -Position.relativize=function(_71){ -_71=$(_71); -if(_71.style.position=="relative"){ -return; -} -Position.prepare(); -_71.style.position="relative"; -var top=parseFloat(_71.style.top||0)-(_71._originalTop||0); -var _72=parseFloat(_71.style.left||0)-(_71._originalLeft||0); -_71.style.top=top+"px"; -_71.style.left=_72+"px"; -_71.style.height=_71._originalHeight; -_71.style.width=_71._originalWidth; -}; -Element.Class={toggle:function(_73,_74){ -if(Element.Class.has(_73,_74)){ -Element.Class.remove(_73,_74); -if(arguments.length==3){ -Element.Class.add(_73,arguments[2]); -} -}else{ -Element.Class.add(_73,_74); -if(arguments.length==3){ -Element.Class.remove(_73,arguments[2]); -} -} -},get:function(_75){ -return $(_75).className.split(" "); -},remove:function(_76){ -_76=$(_76); -var _77=arguments; -$R(1,arguments.length-1).each(function(_78){ -_76.className=_76.className.split(" ").reject(function(_79){ -return (_79==_77[_78]); -}).join(" "); }); -},add:function(_80){ -_80=$(_80); -for(var i=1;i<arguments.length;i++){ -Element.Class.remove(_80,arguments[i]); -_80.className+=(_80.className.length>0?" ":"")+arguments[i]; -} -},has:function(_81){ -_81=$(_81); -if(!_81||!_81.className){ -return false; -} -var _82; -for(var i=1;i<arguments.length;i++){ -if((typeof arguments[i]=="object")&&(arguments[i].constructor==Array)){ -for(var j=0;j<arguments[i].length;j++){ -_82=new RegExp("(^|\\s)"+arguments[i][j]+"(\\s|$)"); -if(!_82.test(_81.className)){ -return false; -} -} -}else{ -_82=new RegExp("(^|\\s)"+arguments[i]+"(\\s|$)"); -if(!_82.test(_81.className)){ -return false; -} -} -} -return true; -},has_any:function(_84){ -_84=$(_84); -if(!_84||!_84.className){ -return false; -} -var _85; -for(var i=1;i<arguments.length;i++){ -if((typeof arguments[i]=="object")&&(arguments[i].constructor==Array)){ -for(var j=0;j<arguments[i].length;j++){ -_85=new RegExp("(^|\\s)"+arguments[i][j]+"(\\s|$)"); -if(_85.test(_84.className)){ -return true; -} -} -}else{ -_85=new RegExp("(^|\\s)"+arguments[i]+"(\\s|$)"); -if(_85.test(_84.className)){ -return true; -} -} -} -return false; -},childrenWith:function(_86,_87){ -var _88=$(_86).getElementsByTagName("*"); -var _89=new Array(); -for(var i=0;i<_88.length;i++){ -if(Element.Class.has(_88[i],_87)){ -_89.push(_88[i]); -} -} -return _89; -}}; +}}); +Builder.exportTags(); Object.extend(Date.prototype,{SimpleFormat:function(_1,_2){ _2=_2||{}; @@ -2448,4 +1911,32 @@ Event.stop(ev); } } }}); +Prado.WebUI.TTextHighlighter=Class.create(); +Prado.WebUI.TTextHighlighter.prototype={initialize:function(id){ +if(!window.clipboardData){ +return; +} +var _16={href:"javascript:;//copy code to clipboard",onclick:"Prado.WebUI.TTextHighlighter.copy(this)",onmouseover:"Prado.WebUI.TTextHighlighter.hover(this)",onmouseout:"Prado.WebUI.TTextHighlighter.out(this)"}; +var div=DIV({className:"copycode"},A(_16,"Copy Code")); +document.write(DIV(null,div).innerHTML); +}}; +Object.extend(Prado.WebUI.TTextHighlighter,{copy:function(obj){ +var _19=obj.parentNode.parentNode.parentNode; +var _20=""; +for(var i=0;i<_19.childNodes.length;i++){ +var _22=_19.childNodes[i]; +if(_22.innerText){ +_20+=_22.innerText=="Copy Code"?"":_22.innerText; +}else{ +_20+=_22.nodeValue; +} +} +if(_20.length>0){ +window.clipboardData.setData("Text",_20); +} +},hover:function(obj){ +obj.parentNode.className="copycode copycode_hover"; +},out:function(obj){ +obj.parentNode.className="copycode"; +}}); diff --git a/framework/Web/Javascripts/js/validator.js b/framework/Web/Javascripts/js/validator.js index ee1717b9..7f3335ec 100644 --- a/framework/Web/Javascripts/js/validator.js +++ b/framework/Web/Javascripts/js/validator.js @@ -504,9 +504,6 @@ var min=undef(this.attr.min)?Number.NEGATIVE_INFINITY:parseInt(this.attr.min); var max=undef(this.attr.max)?Number.POSITIVE_INFINITY:parseInt(this.attr.max); var _24=document.getElementsByName(this.attr.selector); if(_24.length<=0){ -_24=document.getElementsBySelector(this.attr.selector); -} -if(_24.length<=0){ return true; } var _25=new Array(); |