📄 effects.js
字号:
//script.aculo.us 1.7.0//(c) 2005-2006 Thomas Fuchs//(c) 2005-2006 Sammi Williamsif(!window.z_effects_js){z_effects_js=true;String.prototype.parseColor=function(){var _1="#";if(this.slice(0,4)=="rgb("){var _2=this.slice(4,this.length-1).split(",");var i=0;do{_1+=parseInt(_2[i]).toColorPart();}while(++i<3);}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var i=1;i<4;i++){_1+=(this.charAt(i)+this.charAt(i)).toLowerCase();}}if(this.length==7){_1=this.toLowerCase();}}}return (_1.length==7?_1:(arguments[0]||this));};Element.getOpacity=function(_4){return $(_4).getStyle("opacity");};Element.setOpacity=function(_5,_6){return $(_5).setStyle({opacity:_6});};Element.getInlineOpacity=function(_7){return $(_7).style.opacity||"";};Element.forceRerendering=function(_8){try{_8=$(_8);var n=document.createTextNode(" ");_8.appendChild(n);_8.removeChild(n);}catch(e){}};Array.prototype.call=function(){var _a=arguments;this.each(function(f){f.apply(this,_a);});};var Effect={_elNotExistErr:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"}};Effect.Transitions={sinoidal:function(_c){return (-Math.cos(_c*Math.PI)/2)+0.5;},flicker:function(_d){return ((-Math.cos(_d*Math.PI)/4)+0.75)+Math.random()/4;},pulse:function(_e,_f){_f=_f||5;return (Math.round((_e%(1/_f))*_f)==0?((_e*_f*2)-Math.floor(_e*_f*2)):1-((_e*_f*2)-Math.floor(_e*_f*2)));},none:function(pos){return 0;},full:function(pos){return 1;}};Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null;},_each:function(_12){this.effects._each(_12);},add:function(_13){var _14=new Date().getTime();var _15=(typeof _13.options.queue=="string")?_13.options.queue:_13.options.queue.position;switch(_15){case "front":this.effects.findAll(function(e){return e.state=="idle";}).each(function(e){e.startOn+=_13.finishOn;e.finishOn+=_13.finishOn;});break;case "with-last":_14=this.effects.pluck("startOn").max()||_14;break;case "end":_14=this.effects.pluck("finishOn").max()||_14;break;}_13.startOn+=_14;_13.finishOn+=_14;if(!_13.options.queue.limit||(this.effects.length<_13.options.queue.limit)){this.effects.push(_13);}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15);}},remove:function(_18){this.effects=this.effects.reject(function(e){return e==_18;});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var _1a=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++){if(this.effects[i]){this.effects[i].loop(_1a);}}}});Effect.Queues={instances:$H(),get:function(_1d){if(typeof _1d!="string"){return _1d;}if(!this.instances[_1d]){this.instances[_1d]=new Effect.ScopedQueue();}return this.instances[_1d];}};Effect.Queue=Effect.Queues.get("global");Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:60,sync:false,from:0,to:1,delay:0,queue:"parallel"};Effect.Base=function(){};Effect.Base.prototype={position:null,start:function(_1e){this.options=Object.extend(Object.extend({},Effect.DefaultOptions),_1e||{});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.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this);}},loop:function(_1f){if(_1f>=this.startOn){if(_1f>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish();}this.event("afterFinish");return;}var pos=(_1f-this.startOn)/(this.finishOn-this.startOn);var _21=Math.round(pos*this.options.fps*this.options.duration);if(_21>this.currentFrame){this.render(pos);this.currentFrame=_21;}}},render:function(pos){if(this.state=="idle"){this.state="running";this.event("beforeSetup");if(this.setup){this.setup();}this.event("afterSetup");}if(this.state=="running"){if(this.options.transition){pos=this.options.transition(pos);}pos*=(this.options.to-this.options.from);pos+=this.options.from;this.position=pos;this.event("beforeUpdate");if(this.update){this.update(pos);}this.event("afterUpdate");}},cancel:function(){if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this);}this.state="finished";},event:function(_23){if(this.options[_23+"Internal"]){this.options[_23+"Internal"](this);}if(this.options[_23]){this.options[_23](this);}},inspect:function(){var _24=$H();for(property in this){if(typeof this[property]!="function"){_24[property]=this[property];}}return "#<Effect:"+_24.inspect()+",options:"+$H(this.options).inspect()+">";}};Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(_25){this.effects=_25||[];this.start(arguments[1]);},update:function(_26){this.effects.invoke("render",_26);},finish:function(_27){this.effects.each(function(_28){_28.render(1);_28.cancel();_28.event("beforeFinish");if(_28.finish){_28.finish(_27);}_28.event("afterFinish");});}});Effect.Event=Class.create();Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize:function(){var _29=Object.extend({duration:0},arguments[0]||{});this.start(_29);},update:Prototype.emptyFunction});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(_2a){this.element=$(_2a);if(!this.element){throw (Effect._elNotExistErr);}if(/MSIE/.test(navigator.userAgent)&&!window.opera&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1});}var _2b=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(_2b);},update:function(_2c){this.element.setOpacity(_2c);}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(_2d){this.element=$(_2d);if(!this.element){throw (Effect._elNotExistErr);}var _2e=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(_2e);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("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(_2f){this.element.setStyle({left:Math.round(this.options.x*_2f+this.originalLeft)+"px",top:Math.round(this.options.y*_2f+this.originalTop)+"px"});}});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -