Skip to content
Browse files

gallery-2012.09.26-20-36 wenbing gallery-widget-modalshim

  • Loading branch information...
1 parent 2dbf816 commit c28919160d5db22f768b94b8e1e2e91d80d6fbba YUI Builder committed Sep 26, 2012
View
29 src/gallery-widget-modalshim/build.properties
@@ -0,0 +1,29 @@
+# ModalShim Build Properties
+
+# As long as the 'builder' project is cloned to the default folder
+# next to the 'yui3-gallery' project folder, the 'builddir' property does not
+# need to be changed
+#
+# If the 'builder' project is checked out to an alternate location, this
+# property should be updated to point to the checkout location.
+builddir=../../../builder/componentbuild
+
+# The name of the component. E.g. event, attribute, widget
+component=gallery-widget-modalshim
+
+# The list of files which should be concatenated to create the component
+# NOTE: For a css component. (e.g. cssfonts, cssgrids etc.) use component.cssfiles instead.
+# component.jsfiles=widget-modalshim.js, widget-modalshimHelperClass.js, widget-modalshimSubComponentClass.js
+component.jsfiles=widget-modalshim.js
+
+# The list of modules this component. requires. Used to set up the Y.add module call for YUI 3.
+component.requires=widget, widget-modality
+
+# The list of modules this component. supersedes. Used to set up the Y.add module call for YUI 3.
+component.supersedes=
+
+# The list of modules that are optional for this module. Used to set up the Y.add module call for YUI 3.
+component.optional=
+# If your module has a skin file, set this flag to "true"
+#component.skinnable=false
+component.skinnable=true
View
7 src/gallery-widget-modalshim/build.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- YUI 3 Gallery Component Build File -->
+<project name="ModalShim" default="local">
+ <description>ModalShim Build File</description>
+ <property file="build.properties" />
+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
+</project>
View
82 src/gallery-widget-modalshim/js/widget-modalshim.js
@@ -0,0 +1,82 @@
+/**
+ * 修复 Y.WidgetModality IE6 的问题
+ */
+
+function ModalShim(config) {
+ Y.after(this._renderUIModalShim, this, '_renderUIModal');
+ Y.after(this._syncUIModalShim, this, '_syncUIModal');
+}
+
+ModalShim.NAME = 'modal-shim';
+ModalShim.ATTRS = {
+ modalShim: {
+ value: UA.ie === 6,
+ validator: L.isBoolean
+ }
+};
+ModalShim.CLASS_NAME = Widget.getClassName('modal', 'shim');
+ModalShim.TEMPLATE = '<iframe class="' + ModalShim.CLASS_NAME + '" frameborder="0" title="Widget Modal Shim" src="javascript:false" tabindex="-1" role="presentation"></iframe>';
+
+ModalShim.prototype = {
+ _renderUIModalShim: function() {
+ this._uiSetModalShim(this.get('modalShim'));
+ },
+ _syncUIModalShim: function() {
+ this._uiSetModalShim(this.get('modalShim'));
+ },
+ _uiSetModalShim: function(enable) {
+ if(enable) {
+ this._renderModalShim();
+ this._addModalShimResizeHandlers();
+ } else {
+ this._destroyModalShim();
+ }
+ },
+ _renderModalShim: function() {
+ var modalShimNode = this._modalShimNode,
+ maskNode = this.get('maskNode');
+ if( ! modalShimNode) {
+ modalShimNode = this._modalShimNode = this._getModalShimTemplate();
+ maskNode.prepend(modalShimNode);
+ this.sizeModalShim();
+ }
+ },
+ _addModalShimResizeHandlers: function() {
+ this._modalShimHandles || (this._modalShimHandles = []);
+ var handles = this._modalShimHandles,
+ sizeModalShim = this.sizeModalShim;
+ handles.push(this.after('visibleChange', sizeModalShim));
+ handles.push(this.after('WidthChange', sizeModalShim));
+ handles.push(this.after('HeightChange', sizeModalShim));
+ handles.push(this.after('contentUpdate', sizeModalShim));
+ },
+ _detachModalShimHandlers: function() {
+ var handlers = this._modalShimHandles, handle;
+ if(handlers && handlers.length > 0) {
+ while((handle = handlers.pop())) {
+ handle.detach();
+ }
+ }
+ },
+ sizeModalShim: function() {
+ var shim = this._modalShimNode,
+ maskNode = this.get('maskNode');
+ if(shim && this.get('visible')) {
+ shim.setStyles({
+ width: maskNode.get('offsetWidth') + 'px',
+ height: maskNode.get('offsetHeight') + 'px'
+ });
+ }
+ },
+ _getModalShimTemplate: function() {
+ return Node.create(ModalShim.TEMPLATE);
+ },
+ _destroyModalShim: function() {
+ this._modalShimNode.remove(true);
+ this._detachModalShimHandlers();
+ }
+};
+
+Y.WidgetModalShim = ModalShim;
+
+
View
17 ...ry-widget-modalshim/src/gallery-widget-modalshim/assets/gallery-widget-modalshim-core.css
@@ -0,0 +1,17 @@
+
+.yui3-widget-mask .yui3-widget-modal-shim {
+ position:absolute;
+ top:0;
+ left:0;
+ margin:0;
+ border:0;
+ padding:0;
+ z-index:-1;
+ width:100%;
+ height:100%;
+ _width:0;
+ _height:0;
+ opacity:0;
+ filter:alpha(opacity=0)
+}
+
View
0 ...modalshim/src/gallery-widget-modalshim/assets/skins/sam/gallery-widget-modalshim-skin.css
No changes.

0 comments on commit c289191

Please sign in to comment.
Something went wrong with that request. Please try again.