import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -1,8 +1,8 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
.yui-overlay,
.yui-panel-container {
@ -11,6 +11,10 @@ version: 2.6.0
z-index: 2;
}
.yui-panel {
position:relative;
}
.yui-panel-container form {
margin: 0;
}
@ -140,7 +144,7 @@ PLEASE NOTE:
padding-bottom: 1px;
}
.yui-effect-fade .underlay {
.yui-effect-fade .underlay, .yui-effect-fade .yui-tt-shadow {
display:none;
}
@ -165,4 +169,8 @@ PLEASE NOTE:
overflow:hidden;
text-indent:-10000em;
text-decoration:none;
}
.yui-overlay.yui-force-redraw, .yui-panel-container.yui-force-redraw {
margin-bottom:1px;
}

View File

@ -1,8 +1,8 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
.yui-overlay,
.yui-panel-container {

View File

@ -1,14 +1,14 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
/* Panel modality mask styles */
.yui-skin-sam .mask {
background-color: #000;
opacity: .25;
*filter: alpha(opacity=25); /* Set opacity in IE */
filter: alpha(opacity=25); /* Set opacity in IE */
}
/* Panel styles */
@ -128,7 +128,7 @@ version: 2.6.0
background-color: #000;
opacity: .12;
*filter: alpha(opacity=12); /* Set opacity in IE */
filter: alpha(opacity=12); /* Set opacity in IE */
}
@ -238,5 +238,5 @@ version: 2.6.0
.yui-skin-sam .yui-tt-shadow-visible {
opacity: .12;
*filter: alpha(opacity=12); /* For IE */
filter: alpha(opacity=12); /* For IE */
}

View File

@ -1,7 +1,7 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
.yui-overlay,.yui-panel-container{visibility:hidden;position:absolute;z-index:2;}.yui-panel-container form{margin:0;}.mask{z-index:1;display:none;position:absolute;top:0;left:0;right:0;bottom:0;}.mask.block-scrollbars{overflow:auto;}.masked select,.drag select,.hide-select select{_visibility:hidden;}.yui-panel-container select{_visibility:inherit;}.hide-scrollbars,.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.show-scrollbars{overflow:auto;}.yui-panel-container.show-scrollbars,.yui-tt.show-scrollbars{overflow:visible;}.yui-panel-container.show-scrollbars .underlay,.yui-tt.show-scrollbars .yui-tt-shadow{overflow:auto;}.yui-panel-container.shadow .underlay.yui-force-redraw{padding-bottom:1px;}.yui-effect-fade .underlay{display:none;}.yui-tt-shadow{position:absolute;}.yui-override-padding{padding:0 !important;}.yui-panel-container .container-close{overflow:hidden;text-indent:-10000em;text-decoration:none;}.yui-skin-sam .mask{background-color:#000;opacity:.25;*filter:alpha(opacity=25);}.yui-skin-sam .yui-panel-container{padding:0 1px;*padding:2px;}.yui-skin-sam .yui-panel{position:relative;left:0;top:0;border-style:solid;border-width:1px 0;border-color:#808080;z-index:1;*border-width:1px;*zoom:1;_zoom:normal;}.yui-skin-sam .yui-panel .hd,.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{border-style:solid;border-width:0 1px;border-color:#808080;margin:0 -1px;*margin:0;*border:0;}.yui-skin-sam .yui-panel .hd{border-bottom:solid 1px #ccc;}.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{background-color:#F2F2F2;}.yui-skin-sam .yui-panel .hd{padding:0 10px;font-size:93%;line-height:2;*line-height:1.9;font-weight:bold;color:#000;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -200px;}.yui-skin-sam .yui-panel .bd{padding:10px;}.yui-skin-sam .yui-panel .ft{border-top:solid 1px #808080;padding:5px 10px;font-size:77%;}.yui-skin-sam .yui-panel-container.focused .yui-panel .hd{}.yui-skin-sam .container-close{position:absolute;top:5px;right:6px;width:25px;height:15px;background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -300px;cursor:pointer;}.yui-skin-sam .yui-panel-container .underlay{right:-1px;left:-1px;}.yui-skin-sam .yui-panel-container.matte{padding:9px 10px;background-color:#fff;}.yui-skin-sam .yui-panel-container.shadow{_padding:2px 4px 0 2px;}.yui-skin-sam .yui-panel-container.shadow .underlay{position:absolute;top:2px;left:-3px;right:-3px;bottom:-3px;*top:4px;*left:-1px;*right:-1px;*bottom:-1px;_top:0;_left:0;_right:0;_bottom:0;_margin-top:3px;_margin-left:-1px;background-color:#000;opacity:.12;*filter:alpha(opacity=12);}.yui-skin-sam .yui-dialog .ft{border-top:none;padding:0 10px 10px 10px;font-size:100%;}.yui-skin-sam .yui-dialog .ft .button-group{display:block;text-align:right;}.yui-skin-sam .yui-dialog .ft button.default{font-weight:bold;}.yui-skin-sam .yui-dialog .ft span.default{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-dialog .ft span.default .first-child{border-color:#304369;}.yui-skin-sam .yui-dialog .ft span.default button{color:#fff;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled{background-position:0pt -1500px;border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled button{color:#a6a6a6;}.yui-skin-sam .yui-simple-dialog .bd .yui-icon{background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 0;width:16px;height:16px;margin-right:10px;float:left;}.yui-skin-sam .yui-simple-dialog .bd span.blckicon{background-position:0 -1100px;}.yui-skin-sam .yui-simple-dialog .bd span.alrticon{background-position:0 -1050px;}.yui-skin-sam .yui-simple-dialog .bd span.hlpicon{background-position:0 -1150px;}.yui-skin-sam .yui-simple-dialog .bd span.infoicon{background-position:0 -1200px;}.yui-skin-sam .yui-simple-dialog .bd span.warnicon{background-position:0 -1900px;}.yui-skin-sam .yui-simple-dialog .bd span.tipicon{background-position:0 -1250px;}.yui-skin-sam .yui-tt .bd{position:relative;top:0;left:0;z-index:1;color:#000;padding:2px 5px;border-color:#D4C237 #A6982B #A6982B #A6982B;border-width:1px;border-style:solid;background-color:#FFEE69;}.yui-skin-sam .yui-tt.show-scrollbars .bd{overflow:auto;}.yui-skin-sam .yui-tt-shadow{top:2px;right:-3px;left:-3px;bottom:-3px;background-color:#000;}.yui-skin-sam .yui-tt-shadow-visible{opacity:.12;*filter:alpha(opacity=12);}
.yui-overlay,.yui-panel-container{visibility:hidden;position:absolute;z-index:2;}.yui-panel{position:relative;}.yui-panel-container form{margin:0;}.mask{z-index:1;display:none;position:absolute;top:0;left:0;right:0;bottom:0;}.mask.block-scrollbars{overflow:auto;}.masked select,.drag select,.hide-select select{_visibility:hidden;}.yui-panel-container select{_visibility:inherit;}.hide-scrollbars,.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.show-scrollbars{overflow:auto;}.yui-panel-container.show-scrollbars,.yui-tt.show-scrollbars{overflow:visible;}.yui-panel-container.show-scrollbars .underlay,.yui-tt.show-scrollbars .yui-tt-shadow{overflow:auto;}.yui-panel-container.shadow .underlay.yui-force-redraw{padding-bottom:1px;}.yui-effect-fade .underlay,.yui-effect-fade .yui-tt-shadow{display:none;}.yui-tt-shadow{position:absolute;}.yui-override-padding{padding:0!important;}.yui-panel-container .container-close{overflow:hidden;text-indent:-10000em;text-decoration:none;}.yui-overlay.yui-force-redraw,.yui-panel-container.yui-force-redraw{margin-bottom:1px;}.yui-skin-sam .mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-panel-container{padding:0 1px;*padding:2px;}.yui-skin-sam .yui-panel{position:relative;left:0;top:0;border-style:solid;border-width:1px 0;border-color:#808080;z-index:1;*border-width:1px;*zoom:1;_zoom:normal;}.yui-skin-sam .yui-panel .hd,.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{border-style:solid;border-width:0 1px;border-color:#808080;margin:0 -1px;*margin:0;*border:0;}.yui-skin-sam .yui-panel .hd{border-bottom:solid 1px #ccc;}.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{background-color:#F2F2F2;}.yui-skin-sam .yui-panel .hd{padding:0 10px;font-size:93%;line-height:2;*line-height:1.9;font-weight:bold;color:#000;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -200px;}.yui-skin-sam .yui-panel .bd{padding:10px;}.yui-skin-sam .yui-panel .ft{border-top:solid 1px #808080;padding:5px 10px;font-size:77%;}.yui-skin-sam .container-close{position:absolute;top:5px;right:6px;width:25px;height:15px;background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -300px;cursor:pointer;}.yui-skin-sam .yui-panel-container .underlay{right:-1px;left:-1px;}.yui-skin-sam .yui-panel-container.matte{padding:9px 10px;background-color:#fff;}.yui-skin-sam .yui-panel-container.shadow{_padding:2px 4px 0 2px;}.yui-skin-sam .yui-panel-container.shadow .underlay{position:absolute;top:2px;left:-3px;right:-3px;bottom:-3px;*top:4px;*left:-1px;*right:-1px;*bottom:-1px;_top:0;_left:0;_right:0;_bottom:0;_margin-top:3px;_margin-left:-1px;background-color:#000;opacity:.12;filter:alpha(opacity=12);}.yui-skin-sam .yui-dialog .ft{border-top:none;padding:0 10px 10px 10px;font-size:100%;}.yui-skin-sam .yui-dialog .ft .button-group{display:block;text-align:right;}.yui-skin-sam .yui-dialog .ft button.default{font-weight:bold;}.yui-skin-sam .yui-dialog .ft span.default{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-dialog .ft span.default .first-child{border-color:#304369;}.yui-skin-sam .yui-dialog .ft span.default button{color:#fff;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled{background-position:0 -1500px;border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled button{color:#a6a6a6;}.yui-skin-sam .yui-simple-dialog .bd .yui-icon{background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 0;width:16px;height:16px;margin-right:10px;float:left;}.yui-skin-sam .yui-simple-dialog .bd span.blckicon{background-position:0 -1100px;}.yui-skin-sam .yui-simple-dialog .bd span.alrticon{background-position:0 -1050px;}.yui-skin-sam .yui-simple-dialog .bd span.hlpicon{background-position:0 -1150px;}.yui-skin-sam .yui-simple-dialog .bd span.infoicon{background-position:0 -1200px;}.yui-skin-sam .yui-simple-dialog .bd span.warnicon{background-position:0 -1900px;}.yui-skin-sam .yui-simple-dialog .bd span.tipicon{background-position:0 -1250px;}.yui-skin-sam .yui-tt .bd{position:relative;top:0;left:0;z-index:1;color:#000;padding:2px 5px;border-color:#D4C237 #A6982B #A6982B #A6982B;border-width:1px;border-style:solid;background-color:#FFEE69;}.yui-skin-sam .yui-tt.show-scrollbars .bd{overflow:auto;}.yui-skin-sam .yui-tt-shadow{top:2px;right:-3px;left:-3px;bottom:-3px;background-color:#000;}.yui-skin-sam .yui-tt-shadow-visible{opacity:.12;filter:alpha(opacity=12);}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
(function () {
@ -741,6 +741,7 @@ version: 2.6.0
Event = YAHOO.util.Event,
CustomEvent = YAHOO.util.CustomEvent,
Module = YAHOO.widget.Module,
UA = YAHOO.env.ua,
m_oModuleTemplate,
m_oHeaderTemplate,
@ -785,24 +786,24 @@ version: 2.6.0
value: true,
validator: YAHOO.lang.isBoolean
},
"EFFECT": {
key: "effect",
suppressEvent: true,
supercedes: ["visible"]
"EFFECT": {
key: "effect",
suppressEvent: true,
supercedes: ["visible"]
},
"MONITOR_RESIZE": {
key: "monitorresize",
value: true
"MONITOR_RESIZE": {
key: "monitorresize",
value: true
},
"APPEND_TO_DOCUMENT_BODY": {
key: "appendtodocumentbody",
"APPEND_TO_DOCUMENT_BODY": {
key: "appendtodocumentbody",
value: false
}
};
/**
* Constant representing the prefix path to use for non-secure images
* @property YAHOO.widget.Module.IMG_ROOT
@ -866,7 +867,19 @@ version: 2.6.0
* @type String
*/
Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
/**
* Constant representing the buffer amount (in pixels) to use when positioning
* the text resize monitor offscreen. The resize monitor is positioned
* offscreen by an amount eqaul to its offsetHeight + the buffer value.
*
* @property YAHOO.widget.Module.RESIZE_MONITOR_BUFFER
* @static
* @type Number
*/
// Set to 1, to work around pixel offset in IE8, which increases when zoom is used
Module.RESIZE_MONITOR_BUFFER = 1;
/**
* Singleton CustomEvent fired when the font size is changed in the browser.
* Opera's "zoom" functionality currently does not support text
@ -875,6 +888,22 @@ version: 2.6.0
*/
Module.textResizeEvent = new CustomEvent("textResize");
/**
* Helper utility method, which forces a document level
* redraw for Opera, which can help remove repaint
* irregularities after applying DOM changes.
*
* @method YAHOO.widget.Module.forceDocumentRedraw
* @static
*/
Module.forceDocumentRedraw = function() {
var docEl = document.documentElement;
if (docEl) {
docEl.className += " ";
docEl.className = YAHOO.lang.trim(docEl.className);
}
};
function createModuleTemplate() {
if (!m_oModuleTemplate) {
@ -1223,6 +1252,10 @@ version: 2.6.0
* called by the constructor, and sets up all DOM references for
* pre-existing markup, and creates required markup if it is not
* already present.
* <p>
* If the element passed in does not have an id, one will be generated
* for it.
* </p>
* @method init
* @param {String} el The element ID representing the Module <em>OR</em>
* @param {HTMLElement} el The element representing the Module
@ -1258,12 +1291,9 @@ version: 2.6.0
}
}
this.id = Dom.generateId(el);
this.element = el;
if (el.id) {
this.id = el.id;
}
child = this.element.firstChild;
if (child) {
@ -1313,7 +1343,7 @@ version: 2.6.0
*/
initResizeMonitor: function () {
var isGeckoWin = (YAHOO.env.ua.gecko && this.platform == "windows");
var isGeckoWin = (UA.gecko && this.platform == "windows");
if (isGeckoWin) {
// Help prevent spinning loading icon which
// started with FireFox 2.0.0.8/Win
@ -1340,7 +1370,7 @@ version: 2.6.0
Module.textResizeEvent.fire();
}
if (!YAHOO.env.ua.opera) {
if (!UA.opera) {
oIFrame = Dom.get("_yuiResizeMonitor");
var supportsCWResize = this._supportsCWResize();
@ -1348,7 +1378,7 @@ version: 2.6.0
if (!oIFrame) {
oIFrame = document.createElement("iframe");
if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL && YAHOO.env.ua.ie) {
if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL && UA.ie) {
oIFrame.src = Module.RESIZE_MONITOR_SECURE_URL;
}
@ -1384,10 +1414,10 @@ version: 2.6.0
db.appendChild(oIFrame);
}
oIFrame.style.width = "10em";
oIFrame.style.height = "10em";
oIFrame.style.top = (-1 * oIFrame.offsetHeight) + "px";
oIFrame.style.left = (-1 * oIFrame.offsetWidth) + "px";
oIFrame.style.width = "2em";
oIFrame.style.height = "2em";
oIFrame.style.top = (-1 * (oIFrame.offsetHeight + Module.RESIZE_MONITOR_BUFFER)) + "px";
oIFrame.style.left = "0";
oIFrame.style.borderWidth = "0";
oIFrame.style.visibility = "visible";
@ -1395,7 +1425,7 @@ version: 2.6.0
Don't open/close the document for Gecko like we used to, since it
leads to duplicate cookies. (See SourceForge bug #1721755)
*/
if (YAHOO.env.ua.webkit) {
if (UA.webkit) {
oDoc = oIFrame.contentWindow.document;
oDoc.open();
oDoc.close();
@ -1436,22 +1466,11 @@ version: 2.6.0
Gecko 1.8.1.6+ (FF2.0.0.6+) and all other browsers will fire resize on contentWindow.
We don't want to start sniffing for patch versions, so fire textResize the same
way on all FF, until 1.9 (3.x) is out
way on all FF2 flavors
*/
var bSupported = true;
if (YAHOO.env.ua.gecko && YAHOO.env.ua.gecko <= 1.8) {
if (UA.gecko && UA.gecko <= 1.8) {
bSupported = false;
/*
var v = navigator.userAgent.match(/rv:([^\s\)]*)/); // From YAHOO.env.ua
if (v && v[0]) {
var sv = v[0].match(/\d\.\d\.(\d)/);
if (sv && sv[1]) {
if (parseInt(sv[1], 10) > 0) {
bSupported = true;
}
}
}
*/
}
return bSupported;
},
@ -1464,12 +1483,10 @@ version: 2.6.0
*/
onDomResize: function (e, obj) {
var nLeft = -1 * this.resizeMonitor.offsetWidth,
nTop = -1 * this.resizeMonitor.offsetHeight;
this.resizeMonitor.style.top = nTop + "px";
this.resizeMonitor.style.left = nLeft + "px";
var nTop = -1 * (this.resizeMonitor.offsetHeight + Module.RESIZE_MONITOR_BUFFER);
this.resizeMonitor.style.top = nTop + "px";
this.resizeMonitor.style.left = "0";
},
/**
@ -1719,8 +1736,7 @@ version: 2.6.0
*/
destroy: function () {
var parent,
e;
var parent;
if (this.element) {
Event.purgeElement(this.element, true);
@ -1789,7 +1805,7 @@ version: 2.6.0
this.hideEvent.fire();
}
},
/**
* Default event handler for the "monitorresize" configuration property
* @param {String} type The CustomEvent type (usually the property name)
@ -1882,6 +1898,7 @@ version: 2.6.0
_SUBSCRIBE = "subscribe",
_UNSUBSCRIBE = "unsubscribe",
_CONTAINED = "contained",
m_oIFrameTemplate,
@ -1935,7 +1952,6 @@ version: 2.6.0
"FIXED_CENTER": {
key: "fixedcenter",
value: false,
validator: Lang.isBoolean,
supercedes: ["iframe", "visible"]
},
@ -1953,7 +1969,6 @@ version: 2.6.0
"AUTO_FILL_HEIGHT" : {
key: "autofillheight",
supressEvent: true,
supercedes: ["height"],
value:"body"
},
@ -1976,14 +1991,14 @@ version: 2.6.0
validator: Lang.isBoolean,
supercedes: ["zindex"]
},
"PREVENT_CONTEXT_OVERLAP": {
key: "preventcontextoverlap",
value: false,
validator: Lang.isBoolean,
supercedes: ["constraintoviewport"]
}
};
/**
@ -2395,10 +2410,47 @@ version: 2.6.0
});
/**
* True if the Overlay should be anchored to the center of
* the viewport.
* Determines whether or not the Overlay should be anchored
* to the center of the viewport.
*
* <p>This property can be set to:</p>
*
* <dl>
* <dt>true</dt>
* <dd>
* To enable fixed center positioning
* <p>
* When enabled, the overlay will
* be positioned in the center of viewport when initially displayed, and
* will remain in the center of the viewport whenever the window is
* scrolled or resized.
* </p>
* <p>
* If the overlay is too big for the viewport,
* it's top left corner will be aligned with the top left corner of the viewport.
* </p>
* </dd>
* <dt>false</dt>
* <dd>
* To disable fixed center positioning.
* <p>In this case the overlay can still be
* centered as a one-off operation, by invoking the <code>center()</code> method,
* however it will not remain centered when the window is scrolled/resized.
* </dd>
* <dt>"contained"<dt>
* <dd>To enable fixed center positioning, as with the <code>true</code> option.
* <p>However, unlike setting the property to <code>true</code>,
* when the property is set to <code>"contained"</code>, if the overlay is
* too big for the viewport, it will not get automatically centered when the
* user scrolls or resizes the window (until the window is large enough to contain the
* overlay). This is useful in cases where the Overlay has both header and footer
* UI controls which the user may need to access.
* </p>
* </dd>
* </dl>
*
* @config fixedcenter
* @type Boolean
* @type Boolean | String
* @default false
*/
cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key, {
@ -2444,7 +2496,6 @@ version: 2.6.0
handler: this.configAutoFillHeight,
value : DEFAULT_CONFIG.AUTO_FILL_HEIGHT.value,
validator : this._validateAutoFill,
suppressEvent: DEFAULT_CONFIG.AUTO_FILL_HEIGHT.suppressEvent,
supercedes: DEFAULT_CONFIG.AUTO_FILL_HEIGHT.supercedes
});
@ -2543,6 +2594,23 @@ version: 2.6.0
Dom.replaceClass(this.element, "hide-scrollbars", "show-scrollbars");
},
/**
* Internal implementation to set the visibility of the overlay in the DOM.
*
* @method _setDomVisibility
* @param {boolean} visible Whether to show or hide the Overlay's outer element
* @protected
*/
_setDomVisibility : function(show) {
Dom.setStyle(this.element, "visibility", (show) ? "visible" : "hidden");
if (show) {
Dom.removeClass(this.element, "yui-overlay-hidden");
} else {
Dom.addClass(this.element, "yui-overlay-hidden");
}
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "visible" property is
@ -2573,8 +2641,8 @@ version: 2.6.0
while (e.nodeType != 9 && e.nodeType != 11) {
currentVis = Dom.getStyle(e, "visibility");
if (currentVis != "inherit") {
break;
if (currentVis != "inherit") {
break;
}
e = e.parentNode;
@ -2601,7 +2669,6 @@ version: 2.6.0
}
}
if (visible) { // Show
if (isMacGecko) {
this.showMacGeckoScrollbars();
@ -2635,10 +2702,12 @@ version: 2.6.0
if (currentVis != "visible" || currentVis === "") {
this.beforeShowEvent.fire();
Dom.setStyle(this.element, "visibility", "visible");
this._setDomVisibility(true);
this.cfg.refireEvent("iframe");
this.showEvent.fire();
} else {
this._setDomVisibility(true);
}
}
} else { // Hide
@ -2646,7 +2715,7 @@ version: 2.6.0
if (isMacGecko) {
this.hideMacGeckoScrollbars();
}
if (effect) { // Animate out if showing
if (currentVis == "visible") {
this.beforeHideEvent.fire();
@ -2672,31 +2741,58 @@ version: 2.6.0
}
} else if (currentVis === "") {
Dom.setStyle(this.element, "visibility", "hidden");
this._setDomVisibility(false);
}
} else { // Simple hide
if (currentVis == "visible" || currentVis === "") {
this.beforeHideEvent.fire();
Dom.setStyle(this.element, "visibility", "hidden");
this._setDomVisibility(false);
this.hideEvent.fire();
} else {
this._setDomVisibility(false);
}
}
}
},
/**
* Center event handler used for centering on scroll/resize, but only if
* the Overlay is visible
* Fixed center event handler used for centering on scroll/resize, but only if
* the overlay is visible and, if "fixedcenter" is set to "contained", only if
* the overlay fits within the viewport.
*
* @method doCenterOnDOMEvent
*/
doCenterOnDOMEvent: function () {
if (this.cfg.getProperty("visible")) {
this.center();
var cfg = this.cfg,
fc = cfg.getProperty("fixedcenter");
if (cfg.getProperty("visible")) {
if (fc && (fc !== _CONTAINED || this.fitsInViewport())) {
this.center();
}
}
},
/**
* Determines if the Overlay (including the offset value defined by Overlay.VIEWPORT_OFFSET)
* will fit entirely inside the viewport, in both dimensions - width and height.
*
* @method fitsInViewport
* @return boolean true if the Overlay will fit, false if not
*/
fitsInViewport : function() {
var nViewportOffset = Overlay.VIEWPORT_OFFSET,
element = this.element,
elementWidth = element.offsetWidth,
elementHeight = element.offsetHeight,
viewportWidth = Dom.getViewportWidth(),
viewportHeight = Dom.getViewportHeight();
return ((elementWidth + nViewportOffset < viewportWidth) && (elementHeight + nViewportOffset < viewportHeight));
},
/**
* The default event handler fired when the "fixedcenter" property
* is changed.
@ -2717,7 +2813,7 @@ version: 2.6.0
if (val) {
this.center();
if (!alreadySubscribed(this.beforeShowEvent, this.center, this)) {
if (!alreadySubscribed(this.beforeShowEvent, this.center)) {
this.beforeShowEvent.subscribe(this.center);
}
@ -2736,7 +2832,7 @@ version: 2.6.0
windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);
}
},
/**
* The default event handler fired when the "height" property is changed.
* @method configHeight
@ -2767,22 +2863,28 @@ version: 2.6.0
*/
configAutoFillHeight: function (type, args, obj) {
var fillEl = args[0],
currEl = this.cfg.getProperty("autofillheight");
cfg = this.cfg,
autoFillHeight = "autofillheight",
height = "height",
currEl = cfg.getProperty(autoFillHeight),
autoFill = this._autoFillOnHeightChange;
this.cfg.unsubscribeFromConfigEvent("height", this._autoFillOnHeightChange);
Module.textResizeEvent.unsubscribe("height", this._autoFillOnHeightChange);
cfg.unsubscribeFromConfigEvent(height, autoFill);
Module.textResizeEvent.unsubscribe(autoFill);
this.changeContentEvent.unsubscribe(autoFill);
if (currEl && fillEl !== currEl && this[currEl]) {
Dom.setStyle(this[currEl], "height", "");
Dom.setStyle(this[currEl], height, "");
}
if (fillEl) {
fillEl = Lang.trim(fillEl.toLowerCase());
this.cfg.subscribeToConfigEvent("height", this._autoFillOnHeightChange, this[fillEl], this);
Module.textResizeEvent.subscribe(this._autoFillOnHeightChange, this[fillEl], this);
cfg.subscribeToConfigEvent(height, autoFill, this[fillEl], this);
Module.textResizeEvent.subscribe(autoFill, this[fillEl], this);
this.changeContentEvent.subscribe(autoFill, this[fillEl], this);
this.cfg.setProperty("autofillheight", fillEl, true);
cfg.setProperty(autoFillHeight, fillEl, true);
}
},
@ -3059,6 +3161,7 @@ version: 2.6.0
m_oIFrameTemplate.style.margin = "0";
m_oIFrameTemplate.style.padding = "0";
m_oIFrameTemplate.style.display = "none";
m_oIFrameTemplate.tabIndex = -1;
}
oIFrame = m_oIFrameTemplate.cloneNode(false);
@ -3430,8 +3533,8 @@ version: 2.6.0
nLeftRegionWidth,
nRightRegionWidth,
leftConstraint,
rightConstraint,
leftConstraint = scrollX + nViewportOffset,
rightConstraint = scrollX + viewPortWidth - nOverlayOffsetWidth - nViewportOffset,
xNew = x,
@ -3523,42 +3626,52 @@ version: 2.6.0
};
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
if (bCanConstrain) {
oContextEl = aContext[0];
nContextElX = Dom.getX(oContextEl) - scrollX;
nContextElWidth = oContextEl.offsetWidth;
nLeftRegionWidth = nContextElX;
nRightRegionWidth = (viewPortWidth - (nContextElX + nContextElWidth));
setHorizontalPosition();
}
xNew = this.cfg.getProperty("x");
// Determine if the current value for the Overlay's "x" configuration property will
// result in the Overlay being positioned outside the boundaries of the viewport
}
else {
if (x < leftConstraint || x > rightConstraint) {
// The current value for the Overlay's "x" configuration property WILL
// result in the Overlay being positioned outside the boundaries of the viewport
if (bCanConstrain) {
// If the "preventcontextoverlap" configuration property is set to "true",
// try to flip the Overlay to both keep it inside the boundaries of the
// viewport AND from overlaping its context element.
leftConstraint = scrollX + nViewportOffset;
rightConstraint =
scrollX + viewPortWidth - nOverlayOffsetWidth - nViewportOffset;
if (x < leftConstraint) {
xNew = leftConstraint;
} else if (x > rightConstraint) {
xNew = rightConstraint;
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
oContextEl = aContext[0];
nContextElX = Dom.getX(oContextEl) - scrollX;
nContextElWidth = oContextEl.offsetWidth;
nLeftRegionWidth = nContextElX;
nRightRegionWidth = (viewPortWidth - (nContextElX + nContextElWidth));
setHorizontalPosition();
xNew = this.cfg.getProperty("x");
}
else {
if (x < leftConstraint) {
xNew = leftConstraint;
} else if (x > rightConstraint) {
xNew = rightConstraint;
}
}
} else {
// The "x" configuration property cannot be set to a value that will keep
// entire Overlay inside the boundary of the viewport. Therefore, set
// the "x" configuration property to scrollY to keep as much of the
// Overlay inside the viewport as possible.
xNew = nViewportOffset + scrollX;
}
}
return xNew;
@ -3596,8 +3709,8 @@ version: 2.6.0
nTopRegionHeight,
nBottomRegionHeight,
topConstraint,
bottomConstraint,
topConstraint = scrollY + nViewportOffset,
bottomConstraint = scrollY + viewPortHeight - nOverlayOffsetHeight - nViewportOffset,
yNew = y,
@ -3688,42 +3801,56 @@ version: 2.6.0
};
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
// Determine if the current value for the Overlay's "y" configuration property will
// result in the Overlay being positioned outside the boundaries of the viewport
if (bCanConstrain) {
if (y < topConstraint || y > bottomConstraint) {
// The current value for the Overlay's "y" configuration property WILL
// result in the Overlay being positioned outside the boundaries of the viewport
oContextEl = aContext[0];
nContextElHeight = oContextEl.offsetHeight;
nContextElY = (Dom.getY(oContextEl) - scrollY);
nTopRegionHeight = nContextElY;
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
setVerticalPosition();
if (bCanConstrain) {
// If the "preventcontextoverlap" configuration property is set to "true",
// try to flip the Overlay to both keep it inside the boundaries of the
// viewport AND from overlaping its context element.
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
oContextEl = aContext[0];
nContextElHeight = oContextEl.offsetHeight;
nContextElY = (Dom.getY(oContextEl) - scrollY);
nTopRegionHeight = nContextElY;
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
setVerticalPosition();
yNew = oOverlay.cfg.getProperty("y");
}
else {
if (y < topConstraint) {
yNew = topConstraint;
} else if (y > bottomConstraint) {
yNew = bottomConstraint;
}
}
}
yNew = oOverlay.cfg.getProperty("y");
}
else {
if (bCanConstrain) {
topConstraint = scrollY + nViewportOffset;
bottomConstraint =
scrollY + viewPortHeight - nOverlayOffsetHeight - nViewportOffset;
if (y < topConstraint) {
yNew = topConstraint;
} else if (y > bottomConstraint) {
yNew = bottomConstraint;
}
} else {
else {
// The "y" configuration property cannot be set to a value that will keep
// entire Overlay inside the boundary of the viewport. Therefore, set
// the "y" configuration property to scrollY to keep as much of the
// Overlay inside the viewport as possible.
yNew = nViewportOffset + scrollY;
}
}
return yNew;
@ -3771,6 +3898,10 @@ version: 2.6.0
this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
this.cfg.refireEvent("iframe");
if (UA.webkit) {
this.forceContainerRedraw();
}
},
/**
@ -3865,7 +3996,10 @@ version: 2.6.0
* out the containers height
*/
_autoFillOnHeightChange : function(type, args, el) {
this.fillHeight(el);
var height = this.cfg.getProperty("height");
if ((height && height !== "auto") || (height === 0)) {
this.fillHeight(el);
}
},
/**
@ -3941,13 +4075,13 @@ version: 2.6.0
Dom.removeClass(container, "yui-override-padding");
}
remaining = total - filled;
remaining = Math.max(total - filled, 0);
Dom.setStyle(el, "height", remaining + "px");
// Re-adjust height if required, to account for el padding and border
if (el.offsetHeight != remaining) {
remaining = remaining - (el.offsetHeight - remaining);
remaining = Math.max(remaining - (el.offsetHeight - remaining), 0);
}
Dom.setStyle(el, "height", remaining + "px");
}
@ -4048,6 +4182,26 @@ version: 2.6.0
Overlay.superclass.destroy.call(this);
},
/**
* Can be used to force the container to repaint/redraw it's contents.
* <p>
* By default applies and then removes a 1px bottom margin through the
* application/removal of a "yui-force-redraw" class.
* </p>
* <p>
* It is currently used by Overlay to force a repaint for webkit
* browsers, when centering.
* </p>
* @method forceContainerRedraw
*/
forceContainerRedraw : function() {
var c = this;
Dom.addClass(c.element, "yui-force-redraw");
setTimeout(function() {
Dom.removeClass(c.element, "yui-force-redraw");
}, 0);
},
/**
* Returns a String representation of the object.
* @method toString
@ -4495,8 +4649,7 @@ version: 2.6.0
*/
register: function (overlay) {
var zIndex,
registered = false,
var registered = false,
i,
n;
@ -4792,7 +4945,7 @@ version: 2.6.0
obj.handleUnderlayStart();
Dom.setStyle(obj.overlay.element, "visibility", "visible");
obj.overlay._setDomVisibility(true);
Dom.setStyle(obj.overlay.element, "opacity", 0);
};
@ -4819,7 +4972,7 @@ version: 2.6.0
if (obj.overlay.element.style.filter) {
obj.overlay.element.style.filter = null;
}
Dom.setStyle(obj.overlay.element, "visibility", "hidden");
obj.overlay._setDomVisibility(false);
Dom.setStyle(obj.overlay.element, "opacity", 1);
obj.handleUnderlayComplete();
@ -4878,7 +5031,7 @@ version: 2.6.0
if (Dom.getStyle(obj.overlay.element, "visibility") ==
"hidden" && currentX < x) {
Dom.setStyle(obj.overlay.element, "visibility", "visible");
obj.overlay._setDomVisibility(true);
}
@ -4914,8 +5067,8 @@ version: 2.6.0
};
slide.handleCompleteAnimateOut = function (type, args, obj) {
Dom.setStyle(obj.overlay.element, "visibility", "hidden");
obj.overlay._setDomVisibility(false);
obj.overlay.cfg.setProperty("xy", [x, y]);
obj.animateOutCompleteEvent.fire();
};
@ -5056,4 +5209,4 @@ version: 2.6.0
})();
YAHOO.register("containercore", YAHOO.widget.Module, {version: "2.6.0", build: "1321"});
YAHOO.register("containercore", YAHOO.widget.Module, {version: "2.7.0", build: "1799"});

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
(function () {
@ -733,6 +733,7 @@ version: 2.6.0
Event = YAHOO.util.Event,
CustomEvent = YAHOO.util.CustomEvent,
Module = YAHOO.widget.Module,
UA = YAHOO.env.ua,
m_oModuleTemplate,
m_oHeaderTemplate,
@ -777,24 +778,24 @@ version: 2.6.0
value: true,
validator: YAHOO.lang.isBoolean
},
"EFFECT": {
key: "effect",
suppressEvent: true,
supercedes: ["visible"]
"EFFECT": {
key: "effect",
suppressEvent: true,
supercedes: ["visible"]
},
"MONITOR_RESIZE": {
key: "monitorresize",
value: true
"MONITOR_RESIZE": {
key: "monitorresize",
value: true
},
"APPEND_TO_DOCUMENT_BODY": {
key: "appendtodocumentbody",
"APPEND_TO_DOCUMENT_BODY": {
key: "appendtodocumentbody",
value: false
}
};
/**
* Constant representing the prefix path to use for non-secure images
* @property YAHOO.widget.Module.IMG_ROOT
@ -858,7 +859,19 @@ version: 2.6.0
* @type String
*/
Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
/**
* Constant representing the buffer amount (in pixels) to use when positioning
* the text resize monitor offscreen. The resize monitor is positioned
* offscreen by an amount eqaul to its offsetHeight + the buffer value.
*
* @property YAHOO.widget.Module.RESIZE_MONITOR_BUFFER
* @static
* @type Number
*/
// Set to 1, to work around pixel offset in IE8, which increases when zoom is used
Module.RESIZE_MONITOR_BUFFER = 1;
/**
* Singleton CustomEvent fired when the font size is changed in the browser.
* Opera's "zoom" functionality currently does not support text
@ -867,6 +880,22 @@ version: 2.6.0
*/
Module.textResizeEvent = new CustomEvent("textResize");
/**
* Helper utility method, which forces a document level
* redraw for Opera, which can help remove repaint
* irregularities after applying DOM changes.
*
* @method YAHOO.widget.Module.forceDocumentRedraw
* @static
*/
Module.forceDocumentRedraw = function() {
var docEl = document.documentElement;
if (docEl) {
docEl.className += " ";
docEl.className = YAHOO.lang.trim(docEl.className);
}
};
function createModuleTemplate() {
if (!m_oModuleTemplate) {
@ -1215,6 +1244,10 @@ version: 2.6.0
* called by the constructor, and sets up all DOM references for
* pre-existing markup, and creates required markup if it is not
* already present.
* <p>
* If the element passed in does not have an id, one will be generated
* for it.
* </p>
* @method init
* @param {String} el The element ID representing the Module <em>OR</em>
* @param {HTMLElement} el The element representing the Module
@ -1250,12 +1283,9 @@ version: 2.6.0
}
}
this.id = Dom.generateId(el);
this.element = el;
if (el.id) {
this.id = el.id;
}
child = this.element.firstChild;
if (child) {
@ -1305,7 +1335,7 @@ version: 2.6.0
*/
initResizeMonitor: function () {
var isGeckoWin = (YAHOO.env.ua.gecko && this.platform == "windows");
var isGeckoWin = (UA.gecko && this.platform == "windows");
if (isGeckoWin) {
// Help prevent spinning loading icon which
// started with FireFox 2.0.0.8/Win
@ -1332,7 +1362,7 @@ version: 2.6.0
Module.textResizeEvent.fire();
}
if (!YAHOO.env.ua.opera) {
if (!UA.opera) {
oIFrame = Dom.get("_yuiResizeMonitor");
var supportsCWResize = this._supportsCWResize();
@ -1340,7 +1370,7 @@ version: 2.6.0
if (!oIFrame) {
oIFrame = document.createElement("iframe");
if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL && YAHOO.env.ua.ie) {
if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL && UA.ie) {
oIFrame.src = Module.RESIZE_MONITOR_SECURE_URL;
}
@ -1376,10 +1406,10 @@ version: 2.6.0
db.appendChild(oIFrame);
}
oIFrame.style.width = "10em";
oIFrame.style.height = "10em";
oIFrame.style.top = (-1 * oIFrame.offsetHeight) + "px";
oIFrame.style.left = (-1 * oIFrame.offsetWidth) + "px";
oIFrame.style.width = "2em";
oIFrame.style.height = "2em";
oIFrame.style.top = (-1 * (oIFrame.offsetHeight + Module.RESIZE_MONITOR_BUFFER)) + "px";
oIFrame.style.left = "0";
oIFrame.style.borderWidth = "0";
oIFrame.style.visibility = "visible";
@ -1387,7 +1417,7 @@ version: 2.6.0
Don't open/close the document for Gecko like we used to, since it
leads to duplicate cookies. (See SourceForge bug #1721755)
*/
if (YAHOO.env.ua.webkit) {
if (UA.webkit) {
oDoc = oIFrame.contentWindow.document;
oDoc.open();
oDoc.close();
@ -1428,22 +1458,11 @@ version: 2.6.0
Gecko 1.8.1.6+ (FF2.0.0.6+) and all other browsers will fire resize on contentWindow.
We don't want to start sniffing for patch versions, so fire textResize the same
way on all FF, until 1.9 (3.x) is out
way on all FF2 flavors
*/
var bSupported = true;
if (YAHOO.env.ua.gecko && YAHOO.env.ua.gecko <= 1.8) {
if (UA.gecko && UA.gecko <= 1.8) {
bSupported = false;
/*
var v = navigator.userAgent.match(/rv:([^\s\)]*)/); // From YAHOO.env.ua
if (v && v[0]) {
var sv = v[0].match(/\d\.\d\.(\d)/);
if (sv && sv[1]) {
if (parseInt(sv[1], 10) > 0) {
bSupported = true;
}
}
}
*/
}
return bSupported;
},
@ -1456,12 +1475,10 @@ version: 2.6.0
*/
onDomResize: function (e, obj) {
var nLeft = -1 * this.resizeMonitor.offsetWidth,
nTop = -1 * this.resizeMonitor.offsetHeight;
this.resizeMonitor.style.top = nTop + "px";
this.resizeMonitor.style.left = nLeft + "px";
var nTop = -1 * (this.resizeMonitor.offsetHeight + Module.RESIZE_MONITOR_BUFFER);
this.resizeMonitor.style.top = nTop + "px";
this.resizeMonitor.style.left = "0";
},
/**
@ -1710,8 +1727,7 @@ version: 2.6.0
*/
destroy: function () {
var parent,
e;
var parent;
if (this.element) {
Event.purgeElement(this.element, true);
@ -1780,7 +1796,7 @@ version: 2.6.0
this.hideEvent.fire();
}
},
/**
* Default event handler for the "monitorresize" configuration property
* @param {String} type The CustomEvent type (usually the property name)
@ -1873,6 +1889,7 @@ version: 2.6.0
_SUBSCRIBE = "subscribe",
_UNSUBSCRIBE = "unsubscribe",
_CONTAINED = "contained",
m_oIFrameTemplate,
@ -1926,7 +1943,6 @@ version: 2.6.0
"FIXED_CENTER": {
key: "fixedcenter",
value: false,
validator: Lang.isBoolean,
supercedes: ["iframe", "visible"]
},
@ -1944,7 +1960,6 @@ version: 2.6.0
"AUTO_FILL_HEIGHT" : {
key: "autofillheight",
supressEvent: true,
supercedes: ["height"],
value:"body"
},
@ -1967,14 +1982,14 @@ version: 2.6.0
validator: Lang.isBoolean,
supercedes: ["zindex"]
},
"PREVENT_CONTEXT_OVERLAP": {
key: "preventcontextoverlap",
value: false,
validator: Lang.isBoolean,
supercedes: ["constraintoviewport"]
}
};
/**
@ -2386,10 +2401,47 @@ version: 2.6.0
});
/**
* True if the Overlay should be anchored to the center of
* the viewport.
* Determines whether or not the Overlay should be anchored
* to the center of the viewport.
*
* <p>This property can be set to:</p>
*
* <dl>
* <dt>true</dt>
* <dd>
* To enable fixed center positioning
* <p>
* When enabled, the overlay will
* be positioned in the center of viewport when initially displayed, and
* will remain in the center of the viewport whenever the window is
* scrolled or resized.
* </p>
* <p>
* If the overlay is too big for the viewport,
* it's top left corner will be aligned with the top left corner of the viewport.
* </p>
* </dd>
* <dt>false</dt>
* <dd>
* To disable fixed center positioning.
* <p>In this case the overlay can still be
* centered as a one-off operation, by invoking the <code>center()</code> method,
* however it will not remain centered when the window is scrolled/resized.
* </dd>
* <dt>"contained"<dt>
* <dd>To enable fixed center positioning, as with the <code>true</code> option.
* <p>However, unlike setting the property to <code>true</code>,
* when the property is set to <code>"contained"</code>, if the overlay is
* too big for the viewport, it will not get automatically centered when the
* user scrolls or resizes the window (until the window is large enough to contain the
* overlay). This is useful in cases where the Overlay has both header and footer
* UI controls which the user may need to access.
* </p>
* </dd>
* </dl>
*
* @config fixedcenter
* @type Boolean
* @type Boolean | String
* @default false
*/
cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key, {
@ -2435,7 +2487,6 @@ version: 2.6.0
handler: this.configAutoFillHeight,
value : DEFAULT_CONFIG.AUTO_FILL_HEIGHT.value,
validator : this._validateAutoFill,
suppressEvent: DEFAULT_CONFIG.AUTO_FILL_HEIGHT.suppressEvent,
supercedes: DEFAULT_CONFIG.AUTO_FILL_HEIGHT.supercedes
});
@ -2534,6 +2585,23 @@ version: 2.6.0
Dom.replaceClass(this.element, "hide-scrollbars", "show-scrollbars");
},
/**
* Internal implementation to set the visibility of the overlay in the DOM.
*
* @method _setDomVisibility
* @param {boolean} visible Whether to show or hide the Overlay's outer element
* @protected
*/
_setDomVisibility : function(show) {
Dom.setStyle(this.element, "visibility", (show) ? "visible" : "hidden");
if (show) {
Dom.removeClass(this.element, "yui-overlay-hidden");
} else {
Dom.addClass(this.element, "yui-overlay-hidden");
}
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "visible" property is
@ -2564,8 +2632,8 @@ version: 2.6.0
while (e.nodeType != 9 && e.nodeType != 11) {
currentVis = Dom.getStyle(e, "visibility");
if (currentVis != "inherit") {
break;
if (currentVis != "inherit") {
break;
}
e = e.parentNode;
@ -2592,7 +2660,6 @@ version: 2.6.0
}
}
if (visible) { // Show
if (isMacGecko) {
this.showMacGeckoScrollbars();
@ -2626,10 +2693,12 @@ version: 2.6.0
if (currentVis != "visible" || currentVis === "") {
this.beforeShowEvent.fire();
Dom.setStyle(this.element, "visibility", "visible");
this._setDomVisibility(true);
this.cfg.refireEvent("iframe");
this.showEvent.fire();
} else {
this._setDomVisibility(true);
}
}
} else { // Hide
@ -2637,7 +2706,7 @@ version: 2.6.0
if (isMacGecko) {
this.hideMacGeckoScrollbars();
}
if (effect) { // Animate out if showing
if (currentVis == "visible") {
this.beforeHideEvent.fire();
@ -2663,31 +2732,58 @@ version: 2.6.0
}
} else if (currentVis === "") {
Dom.setStyle(this.element, "visibility", "hidden");
this._setDomVisibility(false);
}
} else { // Simple hide
if (currentVis == "visible" || currentVis === "") {
this.beforeHideEvent.fire();
Dom.setStyle(this.element, "visibility", "hidden");
this._setDomVisibility(false);
this.hideEvent.fire();
} else {
this._setDomVisibility(false);
}
}
}
},
/**
* Center event handler used for centering on scroll/resize, but only if
* the Overlay is visible
* Fixed center event handler used for centering on scroll/resize, but only if
* the overlay is visible and, if "fixedcenter" is set to "contained", only if
* the overlay fits within the viewport.
*
* @method doCenterOnDOMEvent
*/
doCenterOnDOMEvent: function () {
if (this.cfg.getProperty("visible")) {
this.center();
var cfg = this.cfg,
fc = cfg.getProperty("fixedcenter");
if (cfg.getProperty("visible")) {
if (fc && (fc !== _CONTAINED || this.fitsInViewport())) {
this.center();
}
}
},
/**
* Determines if the Overlay (including the offset value defined by Overlay.VIEWPORT_OFFSET)
* will fit entirely inside the viewport, in both dimensions - width and height.
*
* @method fitsInViewport
* @return boolean true if the Overlay will fit, false if not
*/
fitsInViewport : function() {
var nViewportOffset = Overlay.VIEWPORT_OFFSET,
element = this.element,
elementWidth = element.offsetWidth,
elementHeight = element.offsetHeight,
viewportWidth = Dom.getViewportWidth(),
viewportHeight = Dom.getViewportHeight();
return ((elementWidth + nViewportOffset < viewportWidth) && (elementHeight + nViewportOffset < viewportHeight));
},
/**
* The default event handler fired when the "fixedcenter" property
* is changed.
@ -2708,7 +2804,7 @@ version: 2.6.0
if (val) {
this.center();
if (!alreadySubscribed(this.beforeShowEvent, this.center, this)) {
if (!alreadySubscribed(this.beforeShowEvent, this.center)) {
this.beforeShowEvent.subscribe(this.center);
}
@ -2727,7 +2823,7 @@ version: 2.6.0
windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);
}
},
/**
* The default event handler fired when the "height" property is changed.
* @method configHeight
@ -2758,22 +2854,28 @@ version: 2.6.0
*/
configAutoFillHeight: function (type, args, obj) {
var fillEl = args[0],
currEl = this.cfg.getProperty("autofillheight");
cfg = this.cfg,
autoFillHeight = "autofillheight",
height = "height",
currEl = cfg.getProperty(autoFillHeight),
autoFill = this._autoFillOnHeightChange;
this.cfg.unsubscribeFromConfigEvent("height", this._autoFillOnHeightChange);
Module.textResizeEvent.unsubscribe("height", this._autoFillOnHeightChange);
cfg.unsubscribeFromConfigEvent(height, autoFill);
Module.textResizeEvent.unsubscribe(autoFill);
this.changeContentEvent.unsubscribe(autoFill);
if (currEl && fillEl !== currEl && this[currEl]) {
Dom.setStyle(this[currEl], "height", "");
Dom.setStyle(this[currEl], height, "");
}
if (fillEl) {
fillEl = Lang.trim(fillEl.toLowerCase());
this.cfg.subscribeToConfigEvent("height", this._autoFillOnHeightChange, this[fillEl], this);
Module.textResizeEvent.subscribe(this._autoFillOnHeightChange, this[fillEl], this);
cfg.subscribeToConfigEvent(height, autoFill, this[fillEl], this);
Module.textResizeEvent.subscribe(autoFill, this[fillEl], this);
this.changeContentEvent.subscribe(autoFill, this[fillEl], this);
this.cfg.setProperty("autofillheight", fillEl, true);
cfg.setProperty(autoFillHeight, fillEl, true);
}
},
@ -3049,6 +3151,7 @@ version: 2.6.0
m_oIFrameTemplate.style.margin = "0";
m_oIFrameTemplate.style.padding = "0";
m_oIFrameTemplate.style.display = "none";
m_oIFrameTemplate.tabIndex = -1;
}
oIFrame = m_oIFrameTemplate.cloneNode(false);
@ -3420,8 +3523,8 @@ version: 2.6.0
nLeftRegionWidth,
nRightRegionWidth,
leftConstraint,
rightConstraint,
leftConstraint = scrollX + nViewportOffset,
rightConstraint = scrollX + viewPortWidth - nOverlayOffsetWidth - nViewportOffset,
xNew = x,
@ -3513,42 +3616,52 @@ version: 2.6.0
};
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
if (bCanConstrain) {
oContextEl = aContext[0];
nContextElX = Dom.getX(oContextEl) - scrollX;
nContextElWidth = oContextEl.offsetWidth;
nLeftRegionWidth = nContextElX;
nRightRegionWidth = (viewPortWidth - (nContextElX + nContextElWidth));
setHorizontalPosition();
}
xNew = this.cfg.getProperty("x");
// Determine if the current value for the Overlay's "x" configuration property will
// result in the Overlay being positioned outside the boundaries of the viewport
}
else {
if (x < leftConstraint || x > rightConstraint) {
// The current value for the Overlay's "x" configuration property WILL
// result in the Overlay being positioned outside the boundaries of the viewport
if (bCanConstrain) {
// If the "preventcontextoverlap" configuration property is set to "true",
// try to flip the Overlay to both keep it inside the boundaries of the
// viewport AND from overlaping its context element.
leftConstraint = scrollX + nViewportOffset;
rightConstraint =
scrollX + viewPortWidth - nOverlayOffsetWidth - nViewportOffset;
if (x < leftConstraint) {
xNew = leftConstraint;
} else if (x > rightConstraint) {
xNew = rightConstraint;
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
oContextEl = aContext[0];
nContextElX = Dom.getX(oContextEl) - scrollX;
nContextElWidth = oContextEl.offsetWidth;
nLeftRegionWidth = nContextElX;
nRightRegionWidth = (viewPortWidth - (nContextElX + nContextElWidth));
setHorizontalPosition();
xNew = this.cfg.getProperty("x");
}
else {
if (x < leftConstraint) {
xNew = leftConstraint;
} else if (x > rightConstraint) {
xNew = rightConstraint;
}
}
} else {
// The "x" configuration property cannot be set to a value that will keep
// entire Overlay inside the boundary of the viewport. Therefore, set
// the "x" configuration property to scrollY to keep as much of the
// Overlay inside the viewport as possible.
xNew = nViewportOffset + scrollX;
}
}
return xNew;
@ -3586,8 +3699,8 @@ version: 2.6.0
nTopRegionHeight,
nBottomRegionHeight,
topConstraint,
bottomConstraint,
topConstraint = scrollY + nViewportOffset,
bottomConstraint = scrollY + viewPortHeight - nOverlayOffsetHeight - nViewportOffset,
yNew = y,
@ -3678,42 +3791,56 @@ version: 2.6.0
};
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
// Determine if the current value for the Overlay's "y" configuration property will
// result in the Overlay being positioned outside the boundaries of the viewport
if (bCanConstrain) {
if (y < topConstraint || y > bottomConstraint) {
// The current value for the Overlay's "y" configuration property WILL
// result in the Overlay being positioned outside the boundaries of the viewport
oContextEl = aContext[0];
nContextElHeight = oContextEl.offsetHeight;
nContextElY = (Dom.getY(oContextEl) - scrollY);
nTopRegionHeight = nContextElY;
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
setVerticalPosition();
if (bCanConstrain) {
// If the "preventcontextoverlap" configuration property is set to "true",
// try to flip the Overlay to both keep it inside the boundaries of the
// viewport AND from overlaping its context element.
if (this.cfg.getProperty("preventcontextoverlap") && aContext &&
oOverlapPositions[(aContext[1] + aContext[2])]) {
oContextEl = aContext[0];
nContextElHeight = oContextEl.offsetHeight;
nContextElY = (Dom.getY(oContextEl) - scrollY);
nTopRegionHeight = nContextElY;
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
setVerticalPosition();
yNew = oOverlay.cfg.getProperty("y");
}
else {
if (y < topConstraint) {
yNew = topConstraint;
} else if (y > bottomConstraint) {
yNew = bottomConstraint;
}
}
}
yNew = oOverlay.cfg.getProperty("y");
}
else {
if (bCanConstrain) {
topConstraint = scrollY + nViewportOffset;
bottomConstraint =
scrollY + viewPortHeight - nOverlayOffsetHeight - nViewportOffset;
if (y < topConstraint) {
yNew = topConstraint;
} else if (y > bottomConstraint) {
yNew = bottomConstraint;
}
} else {
else {
// The "y" configuration property cannot be set to a value that will keep
// entire Overlay inside the boundary of the viewport. Therefore, set
// the "y" configuration property to scrollY to keep as much of the
// Overlay inside the viewport as possible.
yNew = nViewportOffset + scrollY;
}
}
return yNew;
@ -3761,6 +3888,10 @@ version: 2.6.0
this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
this.cfg.refireEvent("iframe");
if (UA.webkit) {
this.forceContainerRedraw();
}
},
/**
@ -3855,7 +3986,10 @@ version: 2.6.0
* out the containers height
*/
_autoFillOnHeightChange : function(type, args, el) {
this.fillHeight(el);
var height = this.cfg.getProperty("height");
if ((height && height !== "auto") || (height === 0)) {
this.fillHeight(el);
}
},
/**
@ -3931,13 +4065,13 @@ version: 2.6.0
Dom.removeClass(container, "yui-override-padding");
}
remaining = total - filled;
remaining = Math.max(total - filled, 0);
Dom.setStyle(el, "height", remaining + "px");
// Re-adjust height if required, to account for el padding and border
if (el.offsetHeight != remaining) {
remaining = remaining - (el.offsetHeight - remaining);
remaining = Math.max(remaining - (el.offsetHeight - remaining), 0);
}
Dom.setStyle(el, "height", remaining + "px");
}
@ -4038,6 +4172,26 @@ version: 2.6.0
Overlay.superclass.destroy.call(this);
},
/**
* Can be used to force the container to repaint/redraw it's contents.
* <p>
* By default applies and then removes a 1px bottom margin through the
* application/removal of a "yui-force-redraw" class.
* </p>
* <p>
* It is currently used by Overlay to force a repaint for webkit
* browsers, when centering.
* </p>
* @method forceContainerRedraw
*/
forceContainerRedraw : function() {
var c = this;
Dom.addClass(c.element, "yui-force-redraw");
setTimeout(function() {
Dom.removeClass(c.element, "yui-force-redraw");
}, 0);
},
/**
* Returns a String representation of the object.
* @method toString
@ -4485,8 +4639,7 @@ version: 2.6.0
*/
register: function (overlay) {
var zIndex,
registered = false,
var registered = false,
i,
n;
@ -4782,7 +4935,7 @@ version: 2.6.0
obj.handleUnderlayStart();
Dom.setStyle(obj.overlay.element, "visibility", "visible");
obj.overlay._setDomVisibility(true);
Dom.setStyle(obj.overlay.element, "opacity", 0);
};
@ -4809,7 +4962,7 @@ version: 2.6.0
if (obj.overlay.element.style.filter) {
obj.overlay.element.style.filter = null;
}
Dom.setStyle(obj.overlay.element, "visibility", "hidden");
obj.overlay._setDomVisibility(false);
Dom.setStyle(obj.overlay.element, "opacity", 1);
obj.handleUnderlayComplete();
@ -4868,7 +5021,7 @@ version: 2.6.0
if (Dom.getStyle(obj.overlay.element, "visibility") ==
"hidden" && currentX < x) {
Dom.setStyle(obj.overlay.element, "visibility", "visible");
obj.overlay._setDomVisibility(true);
}
@ -4904,8 +5057,8 @@ version: 2.6.0
};
slide.handleCompleteAnimateOut = function (type, args, obj) {
Dom.setStyle(obj.overlay.element, "visibility", "hidden");
obj.overlay._setDomVisibility(false);
obj.overlay.cfg.setProperty("xy", [x, y]);
obj.animateOutCompleteEvent.fire();
};
@ -5046,4 +5199,4 @@ version: 2.6.0
})();
YAHOO.register("containercore", YAHOO.widget.Module, {version: "2.6.0", build: "1321"});
YAHOO.register("containercore", YAHOO.widget.Module, {version: "2.7.0", build: "1799"});