widget-modality-min.js revision 63a47ff5ac5d4231f3090a83ea11139f74df5f42
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),mask:e(i,s)};d=b.Base.create(u,b.Plugin.Base,[],{_maskNode:null,_uiHandles:null,initializer:function(v){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();}},destructor:function(){if(this._maskNode){}this._detachUIHandles();this.get(p).get(m).removeClass(r.modal);},renderUI:function(){var x=this.get(p).get(m),v=this.get(p).get(n),w=x.get("parentNode")||b.one("body");this._maskNode=b.Node.create("<div></div>");this._maskNode.addClass(r.mask);this._maskNode.setStyles({position:a?"fixed":"absolute",width:"100%",height:"100%",top:"0",left:"0",display:"block"});v.setStyles({zIndex:1,position:"relative"});w.insert(this._maskNode,w.get("firstChild"));x.addClass(r.modal);},bindUI:function(){this.afterHostEvent(k+h,this._afterHostVisibleChange);this.afterHostEvent(f+h,this._afterHostZIndexChange);},syncUI:function(){var v=this.get(p);this._uiSetHostVisible(v.get(k));this._uiSetHostZIndex(v.get(f));},_focus:function(x){if(x){console.log(x.currentTarget.getDOMNode().activeElement);}var w=this.get(p),y=w.get(m),v=y.get("tabIndex");y.set("tabIndex",v>=0?v:0);w.focus();y.set("tabIndex",v);},_blur:function(){this.get(p).blur();},_getMaskNode:function(){return this._maskNode;},_uiSetHostVisible:function(v){if(v){b.later(1,this,"_attachUIHandles");this._maskNode.setStyle("display","block");this._focus();}else{this._detachUIHandles();this._maskNode.setStyle("display","none");this._blur();}},_uiSetHostZIndex:function(v){this._maskNode.setStyle(f,v||0);},_attachUIHandles:function(w){if(this._uiHandles){return;}var v=this.get(p),x=v.get(m);this._uiHandles=[x.on("clickoutside",b.bind(this._focus,this)),x.on("focusoutside",b.bind(this._focus,this)),x.on("selectoutside",b.bind(this._focus,this))];if(!a){this._uiHandles.push(b.one("win").on("scroll",b.bind(function(z){var y=this._maskNode;y.setStyle("top",y.get("docScrollY"));},this)));}},_detachUIHandles:function(){b.each(this._uiHandles,function(v){v.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(v){this._uiSetHostVisible(v.newVal);},_afterHostZIndexChange:function(v){this._uiSetHostZIndex(v.newVal);}},{NS:t,ATTRS:{maskNode:{getter:"_getMaskNode",readOnly:true},node:{value:undefined}},CLASSES:r});b.namespace("Plugin").Modal=d;}());},"@VERSION@",{requires:["widget","plugin","gallery-outside-events"]});