Telerik.Web.UI.RadContextMenuEventArgs=function(){
Telerik.Web.UI.RadContextMenuEventArgs.initializeBase(this);
};
Telerik.Web.UI.RadContextMenuEventArgs.registerClass("Telerik.Web.UI.RadContextMenuEventArgs",Sys.EventArgs);
Telerik.Web.UI.RadContextMenuShownEventArgs=function(_1){
Telerik.Web.UI.RadContextMenuShownEventArgs.initializeBase(this);
this._targetElement=_1;
};
Telerik.Web.UI.RadContextMenuShownEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
}};
Telerik.Web.UI.RadContextMenuShownEventArgs.registerClass("Telerik.Web.UI.RadContextMenuShownEventArgs",Telerik.Web.UI.RadMenuEventArgs);
Telerik.Web.UI.RadContextMenuShowingEventArgs=function(_2,_3){
Telerik.Web.UI.RadContextMenuShowingEventArgs.initializeBase(this);
this._targetElement=_2;
this._domEvent=_3;
};
Telerik.Web.UI.RadContextMenuShowingEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
},get_domEvent:function(){
return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuShowingEventArgs.registerClass("Telerik.Web.UI.RadContextMenuShowingEventArgs",Sys.CancelEventArgs);
Telerik.Web.UI.RadContextMenuItemEventArgs=function(_4,_5){
Telerik.Web.UI.RadContextMenuItemEventArgs.initializeBase(this,[_4]);
this._targetElement=_5;
};
Telerik.Web.UI.RadContextMenuItemEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
}};
Telerik.Web.UI.RadContextMenuItemEventArgs.registerClass("Telerik.Web.UI.RadContextMenuItemEventArgs",Telerik.Web.UI.RadMenuItemEventArgs);
Telerik.Web.UI.RadContextMenuItemCancelEventArgs=function(_6,_7){
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.initializeBase(this,[_6]);
this._targetElement=_7;
};
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
}};
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.registerClass("Telerik.Web.UI.RadContextMenuItemCancelEventArgs",Telerik.Web.UI.RadMenuItemCancelEventArgs);;Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.ContextMenuTargetType=function(){
throw Error.notImplemented();
};
Telerik.Web.UI.ContextMenuTargetType.prototype={Control:0,Element:1,TagName:2,Document:3};
Telerik.Web.UI.ContextMenuTargetType.registerEnum("Telerik.Web.UI.ContextMenuTargetType");
Telerik.Web.UI.RadContextMenu=function(_1){
Telerik.Web.UI.RadContextMenu.initializeBase(this,[_1]);
this._targets=[];
this._targetElements=null;
this._shown=false;
this._scrollWrapElement=null;
this._scroller=null;
this._animatedElement=null;
this._slide=null;
this._collapseAnimationEndedDelegate=null;
this._detached=false;
this._currentTarget=null;
this._originalDomPositionHelper=null;
this._postbackInitiated=false;
};
Telerik.Web.UI.RadContextMenu.contextMenus={};
Telerik.Web.UI.RadContextMenu.hideAll=function(){
for(var _2 in Telerik.Web.UI.RadContextMenu.contextMenus){
Telerik.Web.UI.RadContextMenu.contextMenus[_2].hide();
}
};
Telerik.Web.UI.RadContextMenu.prototype={initialize:function(){
this.get_element().style.display="block";
this.get_element().style.visibility="hidden";
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"initialize");
this.get_element().style.display="none";
this.get_element().style.visibility="visible";
this.get_childListElement().style.cssFloat="left";
Telerik.Web.UI.RadContextMenu.contextMenus[this.get_id()]=this;
this._elementContextMenu=Function.createDelegate(this,this._elementContextMenu);
this._attachShowHandlers();
this._documentClickHandler=Function.createDelegate(this,this._documentClickHandler);
$addHandler(document,"click",this._documentClickHandler);
this._itemClickedHandler=Function.createDelegate(this,this._itemClickedHandler);
this.add_itemClicked(this._itemClickedHandler);
this._initializeAnimation();
this._initializeScroller();
this._initOriginalDomPositionHelper();
this._beforePostbackHandler=Function.createDelegate(this,this._beforePostBack);
Telerik.Web.UI.PostbackWrapper.add_beforePostback(this._beforePostbackHandler);
if(Sys.WebForms&&Sys.WebForms.PageRequestManager){
this._endRequestHandler=Function.createDelegate(this,this._onEndRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler);
}
},dispose:function(){
$removeHandler(document,"click",this._documentClickHandler);
if(Sys.WebForms&&Sys.WebForms.PageRequestManager){
Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);
}
Telerik.Web.UI.PostbackWrapper.remove_beforePostback(this._beforePostbackHandler);
this._originalDomPositionHelper=null;
this._detachShowHandlers();
this._targetElements=null;
if(this._collapseAnimationEndedDelegate){
if(this._slide){
this._slide.remove_collapseAnimationEnded(this._collapseAnimationEndedDelegate);
}
this._collapseAnimationEndedDelegate=null;
}
if(this._slide){
this._slide.dispose();
this._slide=null;
}
if(this._scroller){
this._scroller.dispose();
this._scroller=null;
}
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"dispose");
},_onEndRequest:function(_3,_4){
this._postbackInitiated=false;
},_attachShowHandlers:function(){
var _5=$telerik.isOpera?"mousedown":"contextmenu";
var _6=this._getTargetElements();
for(var i=0;i<_6.length;i++){
$addHandler(_6[i],_5,this._elementContextMenu);
}
},_detachShowHandlers:function(){
var _8=$telerik.isOpera?"mousedown":"contextmenu";
var _9=this._getTargetElements();
for(var i=0;i<_9.length;i++){
var _b=_9[i];
try{
$removeHandler(_b,_8,this._elementContextMenu);
}
catch(ex){
}
}
},_documentClickHandler:function(e){
var _d=this.get_element();
if(!$telerik.isDescendant(_d,e.target)){
this.close();
this._clicked=false;
this.hide();
}
},_itemClickedHandler:function(_e,_f){
if(!this.get_clickToOpen()){
this.hide();
}
},_initializeAnimation:function(){
this._determineExpandDirection();
var _10=this._getAnimatedElement();
if(_10){
this._slide=new Telerik.Web.UI.Slide(_10,this.get_expandAnimation(),this.get_collapseAnimation());
this._slide.initialize();
this._slide.set_direction(this._getSlideDirection());
this._collapseAnimationEndedDelegate=Function.createDelegate(this,this._onCollapseAnimationEnded);
this._slide.add_collapseAnimationEnded(this._collapseAnimationEndedDelegate);
}
},_getRtlClassName:function(){
return "rmRtlContext";
},_getSlideDirection:function(){
var _11=this.get_defaultGroupSettings().get_expandDirection();
if(_11==Telerik.Web.UI.ExpandDirection.Auto){
return null;
}
return _11;
},_getScrollWrapElement:function(){
var _12=this.get_element();
if(!this._scrollWrapElement){
if(this.get_defaultGroupSettings().get_height()||this.get_defaultGroupSettings().get_width()){
this._scrollWrapElement=$telerik.getFirstChildByTagName(_12,"div",0);
}
}
return this._scrollWrapElement;
},_getAnimatedElement:function(){
if(!this._animatedElement){
this._animatedElement=this._getScrollWrapElement()||this.get_childListElement();
}
return this._animatedElement;
},_determineExpandDirection:function(){
var _13=this.get_defaultGroupSettings();
if(_13.get_expandDirection()!=Telerik.Web.UI.ExpandDirection.Auto){
return;
}
_13.set_expandDirection(Telerik.Web.UI.ExpandDirection.Down);
},_onCollapseAnimationEnded:function(_14,e){
this._restoreZIndex();
},_getTargetElements:function(){
if(this._targetElements==null){
this._targetElements=[];
for(var i=0;i<this._targets.length;i++){
this._addTargetElements(this._targets[i]);
}
}
return this._targetElements;
},_addTargetElements:function(_17){
switch(_17.type){
case Telerik.Web.UI.ContextMenuTargetType.Document:
this._addTargetElement(document);
break;
case Telerik.Web.UI.ContextMenuTargetType.Control:
case Telerik.Web.UI.ContextMenuTargetType.Element:
this._addTargetElement($get(_17.id));
break;
case Telerik.Web.UI.ContextMenuTargetType.TagName:
var _18=document.getElementsByTagName(_17.tagName);
for(var i=0;i<_18.length;i++){
this._addTargetElement(_18[i]);
}
break;
}
},_addTargetElement:function(_1a){
if(_1a){
this._targetElements[this._targetElements.length]=_1a;
}
},_adjustPositionForScreenBoundaries:function(_1b,top){
var _1d=$telerik.getViewPortSize();
_1b=Math.min(_1b,_1d.width-this.get_element().offsetWidth);
top=Math.min(top,_1d.height-this.get_element().offsetHeight);
if(isNaN(_1b)){
_1b=0;
}
if(isNaN(top)){
top=0;
}
this.get_element().style.left=_1b+"px";
this.get_element().style.top=top+"px";
},_initOriginalDomPositionHelper:function(){
this._originalDomPositionHelper=document.createElement("span");
this.get_element().parentNode.insertBefore(this._originalDomPositionHelper,this.get_element());
var _1e=$get(this.get_clientStateFieldID());
_1e.parentNode.removeChild(_1e);
this._originalDomPositionHelper.parentNode.insertBefore(_1e,this._originalDomPositionHelper);
},_detach:function(){
if(!$telerik.isIE||document.readyState=="complete"){
this.get_element().parentNode.removeChild(this.get_element());
document.forms[0].insertBefore(this.get_element(),document.forms[0].firstChild);
this._detached=true;
}
},_beforePostBack:function(){
this._postbackInitiated=true;
this._reAttach();
},_reAttach:function(){
this.get_element().parentNode.removeChild(this.get_element());
this._originalDomPositionHelper.parentNode.insertBefore(this.get_element(),this._originalDomPositionHelper);
this._detached=false;
},_getExtendedItemClickingEventArgs:function(_1f){
return new Telerik.Web.UI.RadContextMenuItemCancelEventArgs(_1f.get_item(),this._targetElement);
},_getExtendedItemClickedEventArgs:function(_20){
return new Telerik.Web.UI.RadContextMenuItemEventArgs(_20.get_item(),this._targetElement);
},_updateScrollWrapSize:function(){
var _21=this._getScrollWrapElement();
var _22=this.get_childListElement();
if(!_21){
return;
}
if(!_21.style.height){
_21.style.height=_22.offsetHeight+"px";
}
_21.style.width=_22.offsetWidth+"px";
},_getAnimationContainer:function(){
return this.get_element();
},_initializeScroller:function(){
var _23=this._getScrollWrapElement();
if(_23){
this._scroller=new Telerik.Web.UI.MenuItemScroller(this.get_childListElement(),Telerik.Web.UI.ItemFlow.Vertical);
this._scroller.initialize();
}
},_adjustRootItemsWidthOnShow:function(){
var _24=this.get_items();
var _25=_24.get_count();
for(var i=0;i<_25;i++){
var _27=_24.getItem(i);
var _28=_27.get_parent();
if(_27._adjustSiblingsWidthOnShow){
_27._adjustSiblingsWidth();
_27._adjustSiblingsWidthOnShow=false;
return;
}
}
},_onTopArrowMouseDown:function(e){
var _2a=this._extractItemFromDomElement(e.eventMapTarget);
if(_2a!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseUp:function(e){
var _2c=this._extractItemFromDomElement(e.eventMapTarget);
if(_2c!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOver:function(e){
var _2e=this._extractItemFromDomElement(e.eventMapTarget);
if(_2e!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOut:function(e){
var _30=this._extractItemFromDomElement(e.eventMapTarget);
if(_30!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Top);
},_onBottomArrowMouseDown:function(e){
var _32=this._extractItemFromDomElement(e.eventMapTarget);
if(_32!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseUp:function(e){
var _34=this._extractItemFromDomElement(e.eventMapTarget);
if(_34!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOver:function(e){
var _36=this._extractItemFromDomElement(e.eventMapTarget);
if(_36!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOut:function(e){
var _38=this._extractItemFromDomElement(e.eventMapTarget);
if(_38!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Bottom);
},_onLeftArrowMouseDown:function(e){
var _3a=this._extractItemFromDomElement(e.eventMapTarget);
if(_3a!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseUp:function(e){
var _3c=this._extractItemFromDomElement(e.eventMapTarget);
if(_3c!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOver:function(e){
var _3e=this._extractItemFromDomElement(e.eventMapTarget);
if(_3e!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOut:function(e){
var _40=this._extractItemFromDomElement(e.eventMapTarget);
if(_40!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Left);
},_onRightArrowMouseDown:function(e){
var _42=this._extractItemFromDomElement(e.eventMapTarget);
if(_42!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseUp:function(e){
var _44=this._extractItemFromDomElement(e.eventMapTarget);
if(_44!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOver:function(e){
var _46=this._extractItemFromDomElement(e.eventMapTarget);
if(_46!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOut:function(e){
var _48=this._extractItemFromDomElement(e.eventMapTarget);
if(_48!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Right);
},_onScrollArrowMouseDown:function(_49){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Fast);
},_onScrollArrowMouseUp:function(_4a){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Slow);
},_onScrollArrowMouseOver:function(_4b){
if(!this._scroller){
return;
}
var _4c=1;
if(_4b==Telerik.Web.UI.ArrowPosition.Top||_4b==Telerik.Web.UI.ArrowPosition.Left){
_4c=-1;
}
this._scroller.startScroll(Telerik.Web.UI.ScrollerSpeed.Slow,_4c);
},_onScrollArrowMouseOut:function(_4d){
if(!this._scroller){
return;
}
this._scroller.stopScroll();
},_elementContextMenu:function(_4e){
if($telerik.isOpera){
if(_4e.button!=2){
return;
}
}
this.show(_4e);
},get_childListElement:function(){
if(this._getScrollWrapElement()){
this._childListElement=$telerik.getFirstChildByTagName(this._getScrollWrapElement(),"ul",0);
}
return Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"get_childListElement");
},set_targets:function(_4f){
this._targets=_4f;
},get_targets:function(){
return this._targets;
},show:function(e){
this._targetElement=e.target;
var _51=new Telerik.Web.UI.RadContextMenuShowingEventArgs(this._targetElement,e);
this.raise_showing(_51);
if(_51.get_cancel()){
return;
}
var _52=$telerik.getDocumentRelativeCursorPosition(e);
this.showAt(_52.left,_52.top,e.target);
$telerik.cancelRawEvent(e);
},showAt:function(_53,top){
if(this._postbackInitiated){
return;
}
Telerik.Web.UI.RadContextMenu.hideAll();
this._shown=true;
if(!this._detached){
this._detach();
}
var _55=this._getAnimatedElement();
this._slide.show();
if(this._rightToLeft){
_53-=this.get_element().offsetWidth;
}
this.get_element().style.left=_53+"px";
this.get_element().style.top=top+"px";
if(this.get_enableScreenBoundaryDetection()){
this._adjustPositionForScreenBoundaries(_53,top);
}
this._adjustRootItemsWidthOnShow();
this._updateScrollWrapSize();
this._slide.updateSize();
if(this._scroller){
this._scroller.updateState();
}
this._slide.expand();
this.raise_shown(new Telerik.Web.UI.RadContextMenuShownEventArgs(this._targetElement));
},hide:function(){
if(this._shown){
this._shown=false;
this._slide.collapse();
this.raise_hidden(new Telerik.Web.UI.RadContextMenuEventArgs());
this._targetElement=null;
this._clicked=false;
if(this._focusedItem){
this._focusedItem._doBlur();
}
var _56=this.get_openedItem();
if(_56){
_56.close();
}
}
},add_showing:function(_57){
this.get_events().addHandler("showing",_57);
},remove_showing:function(_58){
this.get_events().removeHandler("showing",_58);
},raise_showing:function(_59){
if(this._fireEvents){
this.raiseEvent("showing",_59);
}
},add_shown:function(_5a){
this.get_events().addHandler("shown",_5a);
},remove_shown:function(_5b){
this.get_events().removeHandler("shown",_5b);
},raise_shown:function(_5c){
if(this._fireEvents){
this.raiseEvent("shown",_5c);
}
},add_hidden:function(_5d){
this.get_events().addHandler("hidden",_5d);
},remove_hidden:function(_5e){
this.get_events().removeHandler("hidden",_5e);
},raise_hidden:function(_5f){
if(this._fireEvents){
this.raiseEvent("hidden",_5f);
}
}};
Telerik.Web.UI.RadContextMenu.registerClass("Telerik.Web.UI.RadContextMenu",Telerik.Web.UI.RadMenu);;