⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 container.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.configzIndex = function(type, args, obj) {	var zIndex = args[0];	var el = this.element;	if (! zIndex) {		zIndex = YAHOO.util.Dom.getStyle(el, "zIndex");		if (! zIndex || isNaN(zIndex)) {			zIndex = 0;		}	}	if (this.iframe) {		if (zIndex <= 0) {			zIndex = 1;		}		YAHOO.util.Dom.setStyle(this.iframe, "zIndex", (zIndex-1));	}	YAHOO.util.Dom.setStyle(el, "zIndex", zIndex);	this.cfg.setProperty("zIndex", zIndex, true);};/*** The default event handler fired when the "xy" property is changed.* @method configXY* @param {String} type	The CustomEvent type (usually the property name)* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.configXY = function(type, args, obj) {	var pos = args[0];	var x = pos[0];	var y = pos[1];	this.cfg.setProperty("x", x);	this.cfg.setProperty("y", y);	this.beforeMoveEvent.fire([x,y]);	x = this.cfg.getProperty("x");	y = this.cfg.getProperty("y");	this.cfg.refireEvent("iframe");	this.moveEvent.fire([x,y]);};/*** The default event handler fired when the "x" property is changed.* @method configX* @param {String} type	The CustomEvent type (usually the property name)* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.configX = function(type, args, obj) {	var x = args[0];	var y = this.cfg.getProperty("y");	this.cfg.setProperty("x", x, true);	this.cfg.setProperty("y", y, true);	this.beforeMoveEvent.fire([x,y]);	x = this.cfg.getProperty("x");	y = this.cfg.getProperty("y");	YAHOO.util.Dom.setX(this.element, x, true);		this.cfg.setProperty("xy", [x, y], true);	this.cfg.refireEvent("iframe");	this.moveEvent.fire([x, y]);};/*** The default event handler fired when the "y" property is changed.* @method configY* @param {String} type	The CustomEvent type (usually the property name)* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.configY = function(type, args, obj) {	var x = this.cfg.getProperty("x");	var y = args[0];	this.cfg.setProperty("x", x, true);	this.cfg.setProperty("y", y, true);	this.beforeMoveEvent.fire([x,y]);	x = this.cfg.getProperty("x");	y = this.cfg.getProperty("y");	YAHOO.util.Dom.setY(this.element, y, true);	this.cfg.setProperty("xy", [x, y], true);	this.cfg.refireEvent("iframe");	this.moveEvent.fire([x, y]);};/*** Shows the iframe shim, if it has been enabled* @method showIframe*/YAHOO.widget.Overlay.prototype.showIframe = function() {	if (this.iframe) {		this.iframe.style.display = "block";	}};/*** Hides the iframe shim, if it has been enabled* @method hideIframe*/YAHOO.widget.Overlay.prototype.hideIframe = function() {	if (this.iframe) {		this.iframe.style.display = "none";	}};/*** The default event handler fired when the "iframe" property is changed.* @method configIframe* @param {String} type	The CustomEvent type (usually the property name)* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) {	var val = args[0];	if (val) { // IFRAME shim is enabled		if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, this.showIframe, this)) {			this.showEvent.subscribe(this.showIframe, this, true);		}		if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, this.hideIframe, this)) {			this.hideEvent.subscribe(this.hideIframe, this, true);		}		var x = this.cfg.getProperty("x");		var y = this.cfg.getProperty("y");		if (! x || ! y) {			this.syncPosition();			x = this.cfg.getProperty("x");			y = this.cfg.getProperty("y");		}		if (! isNaN(x) && ! isNaN(y)) {			if (! this.iframe) {				this.iframe = document.createElement("iframe");				if (this.isSecure) {					this.iframe.src = YAHOO.widget.Overlay.IFRAME_SRC;				}								var parent = this.element.parentNode;				if (parent) {					parent.appendChild(this.iframe);				} else {					document.body.appendChild(this.iframe);				}				YAHOO.util.Dom.setStyle(this.iframe, "position", "absolute");				YAHOO.util.Dom.setStyle(this.iframe, "border", "none");				YAHOO.util.Dom.setStyle(this.iframe, "margin", "0");				YAHOO.util.Dom.setStyle(this.iframe, "padding", "0");				YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");				if (this.cfg.getProperty("visible")) {					this.showIframe();				} else {					this.hideIframe();				}			}						var iframeDisplay = YAHOO.util.Dom.getStyle(this.iframe, "display");			if (iframeDisplay == "none") {				this.iframe.style.display = "block";			}			YAHOO.util.Dom.setXY(this.iframe, [x,y]);			var width = this.element.clientWidth;			var height = this.element.clientHeight;			YAHOO.util.Dom.setStyle(this.iframe, "width", (width+2) + "px");			YAHOO.util.Dom.setStyle(this.iframe, "height", (height+2) + "px");			if (iframeDisplay == "none") {				this.iframe.style.display = "none";			}		}	} else {		if (this.iframe) {			this.iframe.style.display = "none";		}		this.showEvent.unsubscribe(this.showIframe, this);		this.hideEvent.unsubscribe(this.hideIframe, this);	}};/*** The default event handler fired when the "constraintoviewport" property is changed.* @method configConstrainToViewport* @param {String} type	The CustomEvent type (usually the property name)* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.configConstrainToViewport = function(type, args, obj) {	var val = args[0];	if (val) {		if (! YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {			this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);		}	} else {		this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);	}};/*** The default event handler fired when the "context" property is changed.* @method configContext* @param {String} type	The CustomEvent type (usually the property name)* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.configContext = function(type, args, obj) {	var contextArgs = args[0];	if (contextArgs) {		var contextEl = contextArgs[0];		var elementMagnetCorner = contextArgs[1];		var contextMagnetCorner = contextArgs[2];		if (contextEl) {			if (typeof contextEl == "string") {				this.cfg.setProperty("context", [document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner], true);			}						if (elementMagnetCorner && contextMagnetCorner) {				this.align(elementMagnetCorner, contextMagnetCorner);			}		}		}};// END BUILT-IN PROPERTY EVENT HANDLERS ///*** Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, and BOTTOM_RIGHT.* @method align* @param {String} elementAlign		The String representing the corner of the Overlay that should be aligned to the context element* @param {String} contextAlign		The corner of the context element that the elementAlign corner should stick to.*/YAHOO.widget.Overlay.prototype.align = function(elementAlign, contextAlign) {	var contextArgs = this.cfg.getProperty("context");	if (contextArgs) {		var context = contextArgs[0];				var element = this.element;		var me = this;		if (! elementAlign) {			elementAlign = contextArgs[1];		}		if (! contextAlign) {			contextAlign = contextArgs[2];		}		if (element && context) {			var elementRegion = YAHOO.util.Dom.getRegion(element);			var contextRegion = YAHOO.util.Dom.getRegion(context);			var doAlign = function(v,h) {				switch (elementAlign) {					case YAHOO.widget.Overlay.TOP_LEFT:						me.moveTo(h,v);						break;					case YAHOO.widget.Overlay.TOP_RIGHT:						me.moveTo(h-element.offsetWidth,v);						break;					case YAHOO.widget.Overlay.BOTTOM_LEFT:						me.moveTo(h,v-element.offsetHeight);						break;					case YAHOO.widget.Overlay.BOTTOM_RIGHT:						me.moveTo(h-element.offsetWidth,v-element.offsetHeight);						break;				}			};			switch (contextAlign) {				case YAHOO.widget.Overlay.TOP_LEFT:					doAlign(contextRegion.top, contextRegion.left);					break;				case YAHOO.widget.Overlay.TOP_RIGHT:					doAlign(contextRegion.top, contextRegion.right);					break;						case YAHOO.widget.Overlay.BOTTOM_LEFT:					doAlign(contextRegion.bottom, contextRegion.left);					break;				case YAHOO.widget.Overlay.BOTTOM_RIGHT:					doAlign(contextRegion.bottom, contextRegion.right);					break;			}		}	}};/*** The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.* @method enforceConstraints* @param {String} type	The CustomEvent type (usually the property name)* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.*/YAHOO.widget.Overlay.prototype.enforceConstraints = function(type, args, obj) {	var pos = args[0];	var x = pos[0];	var y = pos[1];	var offsetHeight = this.element.offsetHeight;	var offsetWidth = this.element.offsetWidth;	var viewPortWidth = YAHOO.util.Dom.getViewportWidth();	var viewPortHeight = YAHOO.util.Dom.getViewportHeight();	var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;	var scrollY = document.documentElement.scrollTop || document.body.scrollTop;	var topConstraint = scrollY + 10;	var leftConstraint = scrollX + 10;	var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;	var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;		if (x < leftConstraint) {		x = leftConstraint;	} else if (x > rightConstraint) {		x = rightConstraint;	}	if (y < topConstraint) {		y = topConstraint;	} else if (y > bottomConstraint) {		y = bottomConstraint;	}	this.cfg.setProperty("x", x, true);	this.cfg.setProperty("y", y, true);	this.cfg.setProperty("xy", [x,y], true);};/*** Centers the container in the viewport.* @method center*/YAHOO.widget.Overlay.prototype.center = function() {	var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;	var scrollY = document.documentElement.scrollTop || document.body.scrollTop;	var viewPortWidth = YAHOO.util.Dom.getClientWidth();	var viewPortHeight = YAHOO.util.Dom.getClientHeight();	var elementWidth = this.element.offsetWidth;	var elementHeight = this.element.offsetHeight;	var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;	var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;			this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);	this.cfg.refireEvent("iframe");};/*** Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.* @method syncPosition*/YAHOO.widget.Overlay.prototype.syncPosition = function() {	var pos = YAHOO.util.Dom.getXY(this.element);	this.cfg.setProperty("x", pos[0], true);	this.cfg.setProperty("y", pos[1], true);	this.cfg.setProperty("xy", pos, true);};/*** Event handler fired when the resize monitor element is resized.* @method onDomResize* @param {DOMEvent} e	The resize DOM event* @param {Object} obj	The scope object*/YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {	YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);	var me = this;	setTimeout(function() {		me.syncPosition();		me.cfg.refireEvent("iframe");		me.cfg.refireEvent("context");	}, 0);};/*** Removes the Overlay element from the DOM and sets all child elements to null.* @method destroy*/YAHOO.widget.Overlay.prototype.destroy = function() {	if (this.iframe) {		this.iframe.parentNode

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -