📄 popupbehavior.js
字号:
this.raiseHidden(Sys.EventArgs.Empty);
},
_onMove : function() {
/// <summary>
/// Track the popup's movements so the hidden IFrame (IE6 only) can
/// be moved along with it
/// </summary>
var element = this.get_element();
if (element._hideWindowedElementsIFrame) {
element.parentNode.insertBefore(element._hideWindowedElementsIFrame, element);
element._hideWindowedElementsIFrame.style.top = element.style.top;
element._hideWindowedElementsIFrame.style.left = element.style.left;
}
},
get_onShow : function() {
/// <value type="String" mayBeNull="true">
/// Generic OnShow Animation's JSON definition
/// </value>
return this._onShow ? this._onShow.get_json() : null;
},
set_onShow : function(value) {
if (!this._onShow) {
this._onShow = new AjaxControlToolkit.Animation.GenericAnimationBehavior(this.get_element());
this._onShow.initialize();
}
this._onShow.set_json(value);
var animation = this._onShow.get_animation();
if (animation) {
animation.add_ended(this._onShowEndedHandler);
}
this.raisePropertyChanged('onShow');
},
get_onShowBehavior : function() {
/// <value type="AjaxControlToolkit.Animation.GenericAnimationBehavior">
/// Generic OnShow Animation's behavior
/// </value>
return this._onShow;
},
onShow : function() {
/// <summary>
/// Play the OnShow animation
/// </summary>
/// <returns />
if (this._onShow) {
if (this._onHide) {
this._onHide.quit();
}
this._onShow.play();
}
},
_onShowEnded : function() {
/// <summary>
/// Handler for the OnShow Animation's Ended event
/// </summary>
// Make sure the popup is where it belongs
this.adjustPopupPosition();
this.addBackgroundIFrame();
this.raiseShown(Sys.EventArgs.Empty);
},
get_onHide : function() {
/// <value type="String" mayBeNull="true">
/// Generic OnHide Animation's JSON definition
/// </value>
return this._onHide ? this._onHide.get_json() : null;
},
set_onHide : function(value) {
if (!this._onHide) {
this._onHide = new AjaxControlToolkit.Animation.GenericAnimationBehavior(this.get_element());
this._onHide.initialize();
}
this._onHide.set_json(value);
var animation = this._onHide.get_animation();
if (animation) {
animation.add_ended(this._onHideEndedHandler);
}
this.raisePropertyChanged('onHide');
},
get_onHideBehavior : function() {
/// <value type="AjaxControlToolkit.Animation.GenericAnimationBehavior">
/// Generic OnHide Animation's behavior
/// </value>
return this._onHide;
},
onHide : function() {
/// <summary>
/// Play the OnHide animation
/// </summary>
/// <returns />
if (this._onHide) {
if (this._onShow) {
this._onShow.quit();
}
this._onHide.play();
}
},
_onHideEnded : function() {
/// <summary>
/// Handler for the OnHide Animation's Ended event
/// </summary>
this._hideCleanup();
},
get_parentElement : function() {
/// <value type="Sys.UI.DomElement" domElement="true">
/// Parent dom element.
/// </value>
if (!this._parentElement && this._parentElementID) {
this.set_parentElement($get(this._parentElementID));
Sys.Debug.assert(this._parentElement != null, String.format(AjaxControlToolkit.Resources.PopupExtender_NoParentElement, this._parentElementID));
}
return this._parentElement;
},
set_parentElement : function(element) {
this._parentElement = element;
this.raisePropertyChanged('parentElement');
},
get_parentElementID : function() {
/// <value type="String">
/// Parent dom element.
/// </value>
if (this._parentElement) {
return this._parentElement.id
}
return this._parentElementID;
},
set_parentElementID : function(elementID) {
this._parentElementID = elementID;
if (this.get_isInitialized()) {
this.set_parentElement($get(elementID));
}
},
get_positioningMode : function() {
/// <value type="AjaxControlToolkit.PositioningMode">
/// Positioning mode.
/// </value>
return this._positioningMode;
},
set_positioningMode : function(mode) {
this._positioningMode = mode;
this.raisePropertyChanged('positioningMode');
},
get_x : function() {
/// <value type="Number">
/// X coordinate.
/// </value>
return this._x;
},
set_x : function(value) {
if (value != this._x) {
this._x = value;
// Reposition the popup if it's already showing
if (this._visible) {
this.setupPopup();
}
this.raisePropertyChanged('x');
}
},
get_y : function() {
/// <value type="Number">
/// Y coordinate.
/// </value>
return this._y;
},
set_y : function(value) {
if (value != this._y) {
this._y = value;
// Reposition the popup if it's already showing
if (this._visible) {
this.setupPopup();
}
this.raisePropertyChanged('y');
}
},
get_visible : function() {
/// <value type="Boolean" mayBeNull="false">
/// Whether or not the popup is currently visible
/// </value>
return this._visible;
},
add_showing : function(handler) {
/// <summary>
/// Add an event handler for the showing event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().addHandler('showing', handler);
},
remove_showing : function(handler) {
/// <summary>
/// Remove an event handler from the showing event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().removeHandler('showing', handler);
},
raiseShowing : function(eventArgs) {
/// <summary>
/// Raise the showing event
/// </summary>
/// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false">
/// Event arguments for the showing event
/// </param>
/// <returns />
var handler = this.get_events().getHandler('showing');
if (handler) {
handler(this, eventArgs);
}
},
add_shown : function(handler) {
/// <summary>
/// Add an event handler for the shown event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().addHandler('shown', handler);
},
remove_shown : function(handler) {
/// <summary>
/// Remove an event handler from the shown event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().removeHandler('shown', handler);
},
raiseShown : function(eventArgs) {
/// <summary>
/// Raise the shown event
/// </summary>
/// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false">
/// Event arguments for the shown event
/// </param>
/// <returns />
var handler = this.get_events().getHandler('shown');
if (handler) {
handler(this, eventArgs);
}
},
add_hiding : function(handler) {
/// <summary>
/// Add an event handler for the hiding event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().addHandler('hiding', handler);
},
remove_hiding : function(handler) {
/// <summary>
/// Remove an event handler from the hiding event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().removeHandler('hiding', handler);
},
raiseHiding : function(eventArgs) {
/// <summary>
/// Raise the hiding event
/// </summary>
/// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false">
/// Event arguments for the hiding event
/// </param>
/// <returns />
var handler = this.get_events().getHandler('hiding');
if (handler) {
handler(this, eventArgs);
}
},
add_hidden : function(handler) {
/// <summary>
/// Add an event handler for the hidden event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().addHandler('hidden', handler);
},
remove_hidden : function(handler) {
/// <summary>
/// Remove an event handler from the hidden event
/// </summary>
/// <param name="handler" type="Function" mayBeNull="false">
/// Event handler
/// </param>
/// <returns />
this.get_events().removeHandler('hidden', handler);
},
raiseHidden : function(eventArgs) {
/// <summary>
/// Raise the hidden event
/// </summary>
/// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false">
/// Event arguments for the hidden event
/// </param>
/// <returns />
var handler = this.get_events().getHandler('hidden');
if (handler) {
handler(this, eventArgs);
}
}
}
AjaxControlToolkit.PopupBehavior.registerClass('AjaxControlToolkit.PopupBehavior', AjaxControlToolkit.BehaviorBase);
//AjaxControlToolkit.PopupBehavior.descriptor = {
// properties: [ {name: 'parentElement', attributes: [ Sys.Attributes.Element, true ] },
// {name: 'positioningMode', type: AjaxControlToolkit.PositioningMode},
// {name: 'x', type: Number},
// {name: 'y', type: Number} ],
// events: [ {name: 'show'},
// {name: 'hide'} ]
//}
AjaxControlToolkit.PositioningMode = function() {
/// <summary>
/// Positioning mode describing how the popup should be positioned
/// relative to its specified parent
/// </summary>
/// <field name="Absolute" type="Number" integer="true" />
/// <field name="Center" type="Number" integer="true" />
/// <field name="BottomLeft" type="Number" integer="true" />
/// <field name="BottomRight" type="Number" integer="true" />
/// <field name="TopLeft" type="Number" integer="true" />
/// <field name="TopRight" type="Number" integer="true" />
/// <field name="Right" type="Number" integer="true" />
/// <field name="Left" type="Number" integer="true" />
throw Error.invalidOperation();
}
AjaxControlToolkit.PositioningMode.prototype = {
Absolute: 0,
Center: 1,
BottomLeft: 2,
BottomRight: 3,
TopLeft: 4,
TopRight: 5,
Right: 6,
Left: 7
}
AjaxControlToolkit.PositioningMode.registerEnum('AjaxControlToolkit.PositioningMode');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -