Index: openacs-4/packages/ajaxhelper/www/resources/yui/slider/slider-min.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/resources/yui/slider/slider-min.js,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajaxhelper/www/resources/yui/slider/slider-min.js 21 Oct 2006 06:14:59 -0000 1.1 +++ openacs-4/packages/ajaxhelper/www/resources/yui/slider/slider-min.js 25 Dec 2006 16:40:03 -0000 1.2 @@ -1 +1,29 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ YAHOO.widget.Slider=function(_1,_2,_3,_4){if(_1){this.type=_4;this.init(_1,_2,true);var _5=this;this.thumb=_3;_3.onChange=function(){_5.onThumbChange();};this.isTarget=false;this.animate=YAHOO.widget.Slider.ANIM_AVAIL;this.backgroundEnabled=true;this.tickPause=40;if(_3._isHoriz&&_3.xTicks&&_3.xTicks.length){this.tickPause=Math.round(360/_3.xTicks.length);}else{if(_3.yTicks&&_3.yTicks.length){this.tickPause=Math.round(360/_3.yTicks.length);}}_3.onMouseDown=function(){return _5.focus();};_3.onMouseUp=function(){_5.thumbMouseUp();};_3.onDrag=function(){_5.fireEvents();};_3.onAvailable=function(){return _5.setStartSliderState();};}};YAHOO.extend(YAHOO.widget.Slider,YAHOO.util.DragDrop);YAHOO.widget.Slider.getHorizSlider=function(_6,_7,_8,_9,_10){return new YAHOO.widget.Slider(_6,_6,new YAHOO.widget.SliderThumb(_7,_6,_8,_9,0,0,_10),"horiz");};YAHOO.widget.Slider.getVertSlider=function(_11,_12,iUp,_14,_15){return new YAHOO.widget.Slider(_11,_11,new YAHOO.widget.SliderThumb(_12,_11,0,0,iUp,_14,_15),"vert");};YAHOO.widget.Slider.getSliderRegion=function(_16,_17,_18,_19,iUp,_20,_21){return new YAHOO.widget.Slider(_16,_16,new YAHOO.widget.SliderThumb(_17,_16,_18,_19,iUp,_20,_21),"region");};YAHOO.widget.Slider.ANIM_AVAIL=true;YAHOO.widget.Slider.prototype.setStartSliderState=function(){this.setThumbCenterPoint();this.baselinePos=YAHOO.util.Dom.getXY(this.getEl());this.thumb.startOffset=this.thumb.getOffsetFromParent(this.baselinePos);if(this.thumb._isRegion){if(this.deferredSetRegionValue){this.setRegionValue.apply(this,this.deferredSetRegionValue,true);}else{this.setRegionValue(0,0,true);}}else{if(this.deferredSetValue){this.setValue.apply(this,this.deferredSetValue,true);}else{this.setValue(0,true,true);}}};YAHOO.widget.Slider.prototype.setThumbCenterPoint=function(){var el=this.thumb.getEl();if(el){this.thumbCenterPoint={x:parseInt(el.offsetWidth/2,10),y:parseInt(el.offsetHeight/2,10)};}};YAHOO.widget.Slider.prototype.lock=function(){this.thumb.lock();this.locked=true;};YAHOO.widget.Slider.prototype.unlock=function(){this.thumb.unlock();this.locked=false;};YAHOO.widget.Slider.prototype.thumbMouseUp=function(){if(!this.isLocked()&&!this.moveComplete){this.endMove();}};YAHOO.widget.Slider.prototype.getThumb=function(){return this.thumb;};YAHOO.widget.Slider.prototype.focus=function(){var el=this.getEl();if(el.focus){el.focus();}this.verifyOffset();if(this.isLocked()){return false;}else{this.onSlideStart();return true;}};YAHOO.widget.Slider.prototype.onChange=function(_23,_24){};YAHOO.widget.Slider.prototype.onSlideStart=function(){};YAHOO.widget.Slider.prototype.onSlideEnd=function(){};YAHOO.widget.Slider.prototype.getValue=function(){return this.thumb.getValue();};YAHOO.widget.Slider.prototype.getXValue=function(){return this.thumb.getXValue();};YAHOO.widget.Slider.prototype.getYValue=function(){return this.thumb.getYValue();};YAHOO.widget.Slider.prototype.onThumbChange=function(){var t=this.thumb;if(t._isRegion){t.onChange(t.getXValue(),t.getYValue());}else{t.onChange(t.getValue());}};YAHOO.widget.Slider.prototype.setValue=function(_26,_27,_28){if(!this.thumb.available){this.deferredSetValue=arguments;return false;}if(this.isLocked()&&!_28){return false;}if(isNaN(_26)){return false;}var t=this.thumb;var _29,newY;this.verifyOffset();if(t._isRegion){return false;}else{if(t._isHoriz){this.onSlideStart();_29=t.initPageX+_26+this.thumbCenterPoint.x;this.moveThumb(_29,t.initPageY,_27);}else{this.onSlideStart();newY=t.initPageY+_26+this.thumbCenterPoint.y;this.moveThumb(t.initPageX,newY,_27);}}return true;};YAHOO.widget.Slider.prototype.setRegionValue=function(_30,_31,_32){if(!this.thumb.available){this.deferredSetRegionValue=arguments;return false;}if(this.isLocked()&&!force){return false;}if(isNaN(_30)){return false;}var t=this.thumb;if(t._isRegion){this.onSlideStart();var _33=t.initPageX+_30+this.thumbCenterPoint.x;var _34=t.initPageY+_31+this.thumbCenterPoint.y;this.moveThumb(_33,_34,_32);return true;}return false;};YAHOO.widget.Slider.prototype.verifyOffset=function(){var _35=YAHOO.util.Dom.getXY(this.getEl());if(_35[0]!=this.baselinePos[0]||_35[1]!=this.baselinePos[1]){this.thumb.resetConstraints();this.baselinePos=_35;return false;}return true;};YAHOO.widget.Slider.prototype.moveThumb=function(x,y,_38){var t=this.thumb;var _39=this;if(!t.available){return;}t.setDelta(this.thumbCenterPoint.x,this.thumbCenterPoint.y);var _p=t.getTargetCoord(x,y);var p=[_p.x,_p.y];if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&t._graduated&&!_38){this.lock();setTimeout(function(){_39.moveOneTick(p);},this.tickPause);}else{if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&!_38){this.lock();var _42=new YAHOO.util.Motion(t.id,{points:{to:p}},0.4,YAHOO.util.Easing.easeOut);_42.onComplete.subscribe(function(){_39.endMove();});_42.animate();}else{t.setDragElPos(x,y);this.endMove();}}};YAHOO.widget.Slider.prototype.moveOneTick=function(_43){var t=this.thumb;var _44=YAHOO.util.Dom.getXY(t.getEl());var tmp;var _46=null;if(t._isRegion){_46=this._getNextX(_44,_43);var _47=(_46)?_46[0]:_44[0];_46=this._getNextY([_47,_44[1]],_43);}else{if(t._isHoriz){_46=this._getNextX(_44,_43);}else{_46=this._getNextY(_44,_43);}}if(_46){this.thumb.alignElWithMouse(t.getEl(),_46[0],_46[1]);if(!(_46[0]==_43[0]&&_46[1]==_43[1])){var _48=this;setTimeout(function(){_48.moveOneTick(_43);},this.tickPause);}else{this.endMove();}}else{this.endMove();}};YAHOO.widget.Slider.prototype._getNextX=function(_49,_50){var t=this.thumb;var _51;var tmp=[];var _52=null;if(_49[0]>_50[0]){_51=t.tickSize-this.thumbCenterPoint.x;tmp=t.getTargetCoord(_49[0]-_51,_49[1]);_52=[tmp.x,tmp.y];}else{if(_49[0]<_50[0]){_51=t.tickSize+this.thumbCenterPoint.x;tmp=t.getTargetCoord(_49[0]+_51,_49[1]);_52=[tmp.x,tmp.y];}else{}}return _52;};YAHOO.widget.Slider.prototype._getNextY=function(_53,_54){var t=this.thumb;var _55;var tmp=[];var _56=null;if(_53[1]>_54[1]){_55=t.tickSize-this.thumbCenterPoint.y;tmp=t.getTargetCoord(_53[0],_53[1]-_55);_56=[tmp.x,tmp.y];}else{if(_53[1]<_54[1]){_55=t.tickSize+this.thumbCenterPoint.y;tmp=t.getTargetCoord(_53[0],_53[1]+_55);_56=[tmp.x,tmp.y];}else{}}return _56;};YAHOO.widget.Slider.prototype.b4MouseDown=function(e){this.thumb.autoOffset();this.thumb.resetConstraints();};YAHOO.widget.Slider.prototype.onMouseDown=function(e){if(!this.isLocked()&&this.backgroundEnabled){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.focus();this.moveThumb(x,y);}};YAHOO.widget.Slider.prototype.onDrag=function(e){if(!this.isLocked()){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.moveThumb(x,y,true);}};YAHOO.widget.Slider.prototype.endMove=function(){this.unlock();this.moveComplete=true;this.fireEvents();};YAHOO.widget.Slider.prototype.fireEvents=function(){var t=this.thumb;t.cachePosition();if(!this.isLocked()){if(t._isRegion){var _58=t.getXValue();var _59=t.getYValue();if(_58!=this.previousX||_59!=this.previousY){this.onChange(_58,_59);}this.previousX=_58;this.previousY=_59;}else{var _60=t.getValue();if(_60!=this.previousVal){this.onChange(_60);}this.previousVal=_60;}if(this.moveComplete){this.onSlideEnd();this.moveComplete=false;}}};YAHOO.widget.Slider.prototype.toString=function(){return ("Slider ("+this.type+") "+this.id);};YAHOO.widget.SliderThumb=function(id,_62,_63,_64,iUp,_65,_66){if(id){this.init(id,_62);this.parentElId=_62;}this.isTarget=false;this.tickSize=_66;this.maintainOffset=true;this.initSlider(_63,_64,iUp,_65,_66);this.scroll=false;};YAHOO.extend(YAHOO.widget.SliderThumb,YAHOO.util.DD);YAHOO.widget.SliderThumb.prototype.getOffsetFromParent=function(_67){var _68=YAHOO.util.Dom.getXY(this.getEl());var _69=_67||YAHOO.util.Dom.getXY(this.parentElId);return [(_68[0]-_69[0]),(_68[1]-_69[1])];};YAHOO.widget.SliderThumb.prototype.startOffset=null;YAHOO.widget.SliderThumb.prototype._isHoriz=false;YAHOO.widget.SliderThumb.prototype._prevVal=0;YAHOO.widget.SliderThumb.prototype._graduated=false;YAHOO.widget.SliderThumb.prototype.initSlider=function(_70,_71,iUp,_72,_73){this.setXConstraint(_70,_71,_73);this.setYConstraint(iUp,_72,_73);if(_73&&_73>1){this._graduated=true;}this._isHoriz=(_70>0||_71>0);this._isVert=(iUp>0||_72>0);this._isRegion=(this._isHoriz&&this._isVert);};YAHOO.widget.SliderThumb.prototype.clearTicks=function(){YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);this._graduated=false;};YAHOO.widget.SliderThumb.prototype.getValue=function(){if(!this.available){return 0;}var val=(this._isHoriz)?this.getXValue():this.getYValue();return val;};YAHOO.widget.SliderThumb.prototype.getXValue=function(){if(!this.available){return 0;}var _75=this.getOffsetFromParent();return (_75[0]-this.startOffset[0]);};YAHOO.widget.SliderThumb.prototype.getYValue=function(){if(!this.available){return 0;}var _76=this.getOffsetFromParent();return (_76[1]-this.startOffset[1]);};YAHOO.widget.SliderThumb.prototype.toString=function(){return "SliderThumb "+this.id;};YAHOO.widget.SliderThumb.prototype.onChange=function(x,y){};if("undefined"==typeof YAHOO.util.Anim){YAHOO.widget.Slider.ANIM_AVAIL=false;} \ No newline at end of file +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.1 */ +YAHOO.widget.Slider=function(sElementId,sGroup,oThumb,sType){if(sElementId){this.init(sElementId,sGroup,true);this.initSlider(sType);this.initThumb(oThumb);}};YAHOO.widget.Slider.getHorizSlider=function(sBGElId,sHandleElId,iLeft,iRight,iTickSize){return new YAHOO.widget.Slider(sBGElId,sBGElId,new YAHOO.widget.SliderThumb(sHandleElId,sBGElId,iLeft,iRight,0,0,iTickSize),"horiz");};YAHOO.widget.Slider.getVertSlider=function(sBGElId,sHandleElId,iUp,iDown,iTickSize){return new YAHOO.widget.Slider(sBGElId,sBGElId,new YAHOO.widget.SliderThumb(sHandleElId,sBGElId,0,0,iUp,iDown,iTickSize),"vert");};YAHOO.widget.Slider.getSliderRegion=function(sBGElId,sHandleElId,iLeft,iRight,iUp,iDown,iTickSize){return new YAHOO.widget.Slider(sBGElId,sBGElId,new YAHOO.widget.SliderThumb(sHandleElId,sBGElId,iLeft,iRight,iUp,iDown,iTickSize),"region");};YAHOO.widget.Slider.ANIM_AVAIL=true;YAHOO.extend(YAHOO.widget.Slider,YAHOO.util.DragDrop,{initSlider:function(sType){this.type=sType;this.createEvent("change",this);this.createEvent("slideStart",this);this.createEvent("slideEnd",this);this.isTarget=false;this.animate=YAHOO.widget.Slider.ANIM_AVAIL;this.backgroundEnabled=true;this.tickPause=40;this.enableKeys=true;this.keyIncrement=20;this.moveComplete=true;this.animationDuration=0.2;},initThumb:function(t){var self=this;this.thumb=t;t.cacheBetweenDrags=true;t.onChange=function(){self.handleThumbChange();};if(t._isHoriz&&t.xTicks&&t.xTicks.length){this.tickPause=Math.round(360/t.xTicks.length);}else if(t.yTicks&&t.yTicks.length){this.tickPause=Math.round(360/t.yTicks.length);} +t.onMouseDown=function(){return self.focus();};t.onMouseUp=function(){self.thumbMouseUp();};t.onDrag=function(){self.fireEvents(true);};t.onAvailable=function(){return self.setStartSliderState();};},onAvailable:function(){var Event=YAHOO.util.Event;Event.on(this.id,"keydown",this.handleKeyDown,this,true);Event.on(this.id,"keypress",this.handleKeyPress,this,true);},handleKeyPress:function(e){if(this.enableKeys){var Event=YAHOO.util.Event;var kc=Event.getCharCode(e);switch(kc){case 0x25:case 0x26:case 0x27:case 0x28:case 0x24:case 0x23:Event.preventDefault(e);break;default:}}},handleKeyDown:function(e){if(this.enableKeys){var Event=YAHOO.util.Event;var kc=Event.getCharCode(e),t=this.thumb;var h=this.getXValue(),v=this.getYValue();var horiz=false;var changeValue=true;switch(kc){case 0x25:h-=this.keyIncrement;break;case 0x26:v-=this.keyIncrement;break;case 0x27:h+=this.keyIncrement;break;case 0x28:v+=this.keyIncrement;break;case 0x24:h=t.leftConstraint;v=t.topConstraint;break;case 0x23:h=t.rightConstraint;v=t.bottomConstraint;break;default:changeValue=false;} +if(changeValue){if(t._isRegion){this.setRegionValue(h,v,true);}else{var newVal=(t._isHoriz)?h:v;this.setValue(newVal,true);} +Event.stopEvent(e);}}},setStartSliderState:function(){this.setThumbCenterPoint();this.baselinePos=YAHOO.util.Dom.getXY(this.getEl());this.thumb.startOffset=this.thumb.getOffsetFromParent(this.baselinePos);if(this.thumb._isRegion){if(this.deferredSetRegionValue){this.setRegionValue.apply(this,this.deferredSetRegionValue,true);this.deferredSetRegionValue=null;}else{this.setRegionValue(0,0,true);}}else{if(this.deferredSetValue){this.setValue.apply(this,this.deferredSetValue,true);this.deferredSetValue=null;}else{this.setValue(0,true,true);}}},setThumbCenterPoint:function(){var el=this.thumb.getEl();if(el){this.thumbCenterPoint={x:parseInt(el.offsetWidth/2,10),y:parseInt(el.offsetHeight/2,10)};}},lock:function(){this.thumb.lock();this.locked=true;},unlock:function(){this.thumb.unlock();this.locked=false;},thumbMouseUp:function(){if(!this.isLocked()&&!this.moveComplete){this.endMove();}},getThumb:function(){return this.thumb;},focus:function(){var el=this.getEl();if(el.focus){try{el.focus();}catch(e){}} +this.verifyOffset();if(this.isLocked()){return false;}else{this.onSlideStart();return true;}},onChange:function(firstOffset,secondOffset){},onSlideStart:function(){},onSlideEnd:function(){},getValue:function(){return this.thumb.getValue();},getXValue:function(){return this.thumb.getXValue();},getYValue:function(){return this.thumb.getYValue();},handleThumbChange:function(){var t=this.thumb;if(t._isRegion){t.onChange(t.getXValue(),t.getYValue());this.fireEvent("change",{x:t.getXValue(),y:t.getYValue()});}else{t.onChange(t.getValue());this.fireEvent("change",t.getValue());}},setValue:function(newOffset,skipAnim,force){if(!this.thumb.available){this.deferredSetValue=arguments;return false;} +if(this.isLocked()&&!force){return false;} +if(isNaN(newOffset)){return false;} +var t=this.thumb;var newX,newY;this.verifyOffset(true);if(t._isRegion){return false;}else if(t._isHoriz){this.onSlideStart();newX=t.initPageX+newOffset+this.thumbCenterPoint.x;this.moveThumb(newX,t.initPageY,skipAnim);}else{this.onSlideStart();newY=t.initPageY+newOffset+this.thumbCenterPoint.y;this.moveThumb(t.initPageX,newY,skipAnim);} +return true;},setRegionValue:function(newOffset,newOffset2,skipAnim){if(!this.thumb.available){this.deferredSetRegionValue=arguments;return false;} +if(this.isLocked()&&!force){return false;} +if(isNaN(newOffset)){return false;} +var t=this.thumb;if(t._isRegion){this.onSlideStart();var newX=t.initPageX+newOffset+this.thumbCenterPoint.x;var newY=t.initPageY+newOffset2+this.thumbCenterPoint.y;this.moveThumb(newX,newY,skipAnim);return true;} +return false;},verifyOffset:function(checkPos){var newPos=YAHOO.util.Dom.getXY(this.getEl());if(newPos[0]!=this.baselinePos[0]||newPos[1]!=this.baselinePos[1]){this.thumb.resetConstraints();this.baselinePos=newPos;return false;} +return true;},moveThumb:function(x,y,skipAnim){var t=this.thumb;var self=this;if(!t.available){return;} +t.setDelta(this.thumbCenterPoint.x,this.thumbCenterPoint.y);var _p=t.getTargetCoord(x,y);var p=[_p.x,_p.y];this.fireEvent("slideStart");if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&t._graduated&&!skipAnim){this.lock();this.curCoord=YAHOO.util.Dom.getXY(this.thumb.getEl());setTimeout(function(){self.moveOneTick(p);},this.tickPause);}else if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&!skipAnim){this.lock();var oAnim=new YAHOO.util.Motion(t.id,{points:{to:p}},this.animationDuration,YAHOO.util.Easing.easeOut);oAnim.onComplete.subscribe(function(){self.endMove();});oAnim.animate();}else{t.setDragElPos(x,y);this.endMove();}},moveOneTick:function(finalCoord){var t=this.thumb,tmp;var nextCoord=null;if(t._isRegion){nextCoord=this._getNextX(this.curCoord,finalCoord);var tmpX=(nextCoord)?nextCoord[0]:this.curCoord[0];nextCoord=this._getNextY([tmpX,this.curCoord[1]],finalCoord);}else if(t._isHoriz){nextCoord=this._getNextX(this.curCoord,finalCoord);}else{nextCoord=this._getNextY(this.curCoord,finalCoord);} +if(nextCoord){this.curCoord=nextCoord;this.thumb.alignElWithMouse(t.getEl(),nextCoord[0],nextCoord[1]);if(!(nextCoord[0]==finalCoord[0]&&nextCoord[1]==finalCoord[1])){var self=this;setTimeout(function(){self.moveOneTick(finalCoord);},this.tickPause);}else{this.endMove();}}else{this.endMove();}},_getNextX:function(curCoord,finalCoord){var t=this.thumb;var thresh;var tmp=[];var nextCoord=null;if(curCoord[0]>finalCoord[0]){thresh=t.tickSize-this.thumbCenterPoint.x;tmp=t.getTargetCoord(curCoord[0]-thresh,curCoord[1]);nextCoord=[tmp.x,tmp.y];}else if(curCoord[0]finalCoord[1]){thresh=t.tickSize-this.thumbCenterPoint.y;tmp=t.getTargetCoord(curCoord[0],curCoord[1]-thresh);nextCoord=[tmp.x,tmp.y];}else if(curCoord[1]1){this._graduated=true;} +this._isHoriz=(iLeft||iRight);this._isVert=(iUp||iDown);this._isRegion=(this._isHoriz&&this._isVert);},clearTicks:function(){YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);this.tickSize=0;this._graduated=false;},getValue:function(){if(!this.available){return 0;} +var val=(this._isHoriz)?this.getXValue():this.getYValue();return val;},getXValue:function(){if(!this.available){return 0;} +var newOffset=this.getOffsetFromParent();return(newOffset[0]-this.startOffset[0]);},getYValue:function(){if(!this.available){return 0;} +var newOffset=this.getOffsetFromParent();return(newOffset[1]-this.startOffset[1]);},toString:function(){return"SliderThumb "+this.id;},onChange:function(x,y){}});if("undefined"==typeof YAHOO.util.Anim){YAHOO.widget.Slider.ANIM_AVAIL=false;} \ No newline at end of file