widget-modality-min.js revision dcd96d6eae6d34898f9193fe57d0058fa3173374
YUI.add("widget-modality",function(b){var i="widget",p="host",o="renderUI",j="bindUI",q="syncUI",l="rendered",m="boundingBox",n="contentBox",k="visible",f="zIndex",g="align",h="Change",c=b.Lang.isBoolean,e=b.ClassNameManager.getClassName,a=(function(){
/*! IS_POSITION_FIXED_SUPPORTED - Juriy Zaytsev (kangax) - http://yura.thinkweb2.com/cft/ */
var s=null,t,r;if(document.createElement){t=document.createElement("div");if(t&&t.style){t.style.position="fixed";t.style.top="10px";r=document.body;if(r&&r.appendChild&&r.removeChild){r.appendChild(t);s=(t.offsetTop===10);r.removeChild(t);}}}return s;}()),d;(function(){var u="widgetModal",t="modal",s="mask",r={modal:e(i,t)},v={mask:e(i,s)};d=b.Base.create(u,b.Plugin.Base,[],{_maskNode:null,_uiHandles:null,initializer:function(w){this.afterHostMethod(o,this.renderUI);this.afterHostMethod(j,this.bindUI);this.afterHostMethod(q,this.syncUI);if(this.get(p).get(l)){this.renderUI();this.bindUI();this.syncUI();}this.set("maskNode",d.MASK);},destructor:function(){if(this._maskNode){this._maskNode.remove(true);}this._detachUIHandles();this.get(p).get(m).removeClass(r.modal);},renderUI:function(){var y=this.get(p).get(m),w=this.get(p).get(n),x=y.get("parentNode")||b.one("body");w.setStyles({position:"relative"});this._maskNode.remove();x.insert(this._maskNode,x.get("firstChild"));y.addClass(r.modal);},bindUI:function(){this.afterHostEvent(k+h,this._afterHostVisibleChange);this.afterHostEvent(f+h,this._afterHostZIndexChange);},syncUI:function(){var w=this.get(p);this._uiSetHostVisible(w.get(k));this._uiSetHostZIndex(w.get(f));},_focus:function(y){var x=this.get(p),z=x.get(m),w=z.get("tabIndex");z.set("tabIndex",w>=0?w:0);x.focus();},_blur:function(){this.get(p).blur();},_getMaskNode:function(){return d.MASK;},_uiSetHostVisible:function(w){if(w){b.later(1,this,"_attachUIHandles");this._maskNode.setStyle("display","block");this._focus();}else{this._detachUIHandles();this._maskNode.setStyle("display","none");this._blur();}},_uiSetHostZIndex:function(w){this._maskNode.setStyle(f,w||0);},_attachUIHandles:function(x){if(this._uiHandles){return;}var w=this.get(p),y=w.get(m);this._uiHandles=[y.on("clickoutside",b.bind(this._focus,this)),y.on("focusoutside",b.bind(this._focus,this)),];if(!a){this._uiHandles.push(b.one("win").on("scroll",b.bind(function(A){var z=this._maskNode;z.setStyle("top",z.get("docScrollY"));},this)));}},_detachUIHandles:function(){b.each(this._uiHandles,function(w){w.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(w){this._uiSetHostVisible(w.newVal);},_afterHostZIndexChange:function(w){this._uiSetHostZIndex(w.newVal);}},{NS:t,ATTRS:{maskNode:{getter:"_getMaskNode",readOnly:true},node:{value:undefined}},CLASSES:r,MASK:d._GET_MASK(),_GET_MASK:function(){var w=b.one("#yui3-widget-mask")||null;if(w){return w;}else{w=b.Node.create("<div></div>");w.set("id",v.mask);w.setStyles({position:a?"fixed":"absolute",width:"100%",height:"100%",top:"0",left:"0",display:"block"});return w;}}});b.namespace("Plugin").Modal=d;}());},"@VERSION@",{requires:["widget","plugin","gallery-outside-events"]});