widget-modality-min.js revision d0546aecb66110c4b0bc1d8336b7621ed3dd9993
YUI.add("widget-modality",function(b){var i="widget",o="host",n="renderUI",j="bindUI",p="syncUI",l="rendered",m="boundingBox",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 r=null,s,q;if(document.createElement){s=document.createElement("div");if(s&&s.style){s.style.position="fixed";s.style.top="10px";q=document.body;if(q&&q.appendChild&&q.removeChild){q.appendChild(s);r=(s.offsetTop===10);q.removeChild(s);}}}return r;}()),d;(function(){var t="widgetModal",s="modal",r="mask",q={modal:e(i,s),mask:e(i,r)};d=b.Base.create(t,b.Plugin.Base,[],{_maskNode:null,_uiHandles:null,initializer:function(u){this.afterHostMethod(n,this.renderUI);this.afterHostMethod(j,this.bindUI);this.afterHostMethod(p,this.syncUI);if(this.get(o).get(l)){this.renderUI();this.bindUI();this.syncUI();}this.get(o).on("visibleChange",this._increaseZIndex);},destructor:function(){if(this._maskNode){this._maskNode.remove(true);}this._detachUIHandles();this.get(o).get(m).removeClass(q.modal);},renderUI:function(){var w=this.get(o).get(m),u=w.get("parentNode")||b.one("body");var v=b.one(this.get("node"));v.addClass(q.mask);w.setStyle("zIndex",v.get("zIndex")+1);},bindUI:function(){this.afterHostEvent(k+h,this._afterHostVisibleChange);this.afterHostEvent(f+h,this._afterHostZIndexChange);},syncUI:function(){var u=this.get(o);this._uiSetHostVisible(u.get(k));this._uiSetHostZIndex(u.get(f));},_allowFocus:function(){var u=["#special"];for(var v=0;v<u.length;v++){console.log(b.one(u[v]));b.one(u[v]).setStyle("zIndex",5000);}},_focus:function(w){if(w){console.log(w.currentTarget.getDOMNode().activeElement);}var v=this.get(o),x=v.get(m),u=x.get("tabIndex");x.set("tabIndex",u>=0?u:0);v.focus();x.set("tabIndex",u);},_blur:function(){this.get(o).blur();},_getMaskNode:function(){return this._maskNode;},_uiSetHostVisible:function(u){if(u){b.later(1,this,"_attachUIHandles");this._focus();}else{this._detachUIHandles();this._blur();}},_uiSetHostZIndex:function(u){},_attachUIHandles:function(v){if(this._uiHandles){return;}var u=this.get(o),w=u.get(m);this._uiHandles=[w.on("clickoutside",b.bind(this._focus,this)),w.on("focusoutside",b.bind(this._focus,this)),w.on("selectoutside",b.bind(this._focus,this))];if(!a){this._uiHandles.push(b.one("win").on("scroll",b.bind(function(y){var x=this._maskNode;},this)));}},_detachUIHandles:function(){b.each(this._uiHandles,function(u){u.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(u){this._uiSetHostVisible(u.newVal);},_afterHostZIndexChange:function(u){this._uiSetHostZIndex(u.newVal);}},{NS:s,ATTRS:{maskNode:{getter:"_getMaskNode",readOnly:true},node:{value:undefined}},CLASSES:q});b.namespace("Plugin").Modal=d;}());},"@VERSION@",{requires:["widget","plugin","gallery-outside-events"]});