frame-min.js revision a9877c9114840d695f43d6fd96f07f905de0d968
YUI.add("frame",function(A){YUI.add("frame",function(C){var B=function(){B.superclass.constructor.apply(this,arguments);};C.extend(B,C.Base,{_ready:null,_rendered:null,_iframe:null,_instance:null,_create:function(D){var J,I,F,H;this._iframe=C.Node.create(B.HTML);this._iframe.setStyle("visibility","hidden");this._iframe.set("src",this.get("src"));this.get("container").append(this._iframe);var E="",G=((this.get("extracss"))?'<style id="extra_css">'+this.get("extracss")+"</style>":"");E=C.substitute(B.PAGE_HTML,{DIR:this.get("dir"),LANG:this.get("lang"),TITLE:this.get("title"),META:B.META,CONTENT:this.get("content"),BASE_HREF:this.get("basehref"),DEFAULT_CSS:B.DEFAULT_CSS,EXTRA_CSS:G});if(C.config.doc.compatMode!="BackCompat"){E=B.DOC_TYPE+"\n"+E;}else{}F=this._resolveWinDoc();F.doc.open();F.doc.write(E);F.doc.close();if(this.get("designMode")){F.doc.designMode="on";}if(!F.doc.documentElement){var K=C.later(1,this,function(){if(F.doc&&F.doc.documentElement){D(F);K.cancel();}},null,true);}else{D(F);}},_resolveWinDoc:function(E){var D=(E)?E:{};D.win=C.Node.getDOMNode(this._iframe.get("contentWindow"));D.doc=C.Node.getDOMNode(this._iframe.get("contentWindow.document"));if(!D.doc){D.doc=C.config.doc;}if(!D.win){D.win=C.config.win;}return D;},_onDomEvent:function(F){var E,D;F.frameX=F.frameY=0;if(F.pageX>0||F.pageY>0){if(F.type.substring(0,3)!=="key"){D=this._instance.one("win");E=this._iframe.getXY();F.frameX=E[0]+F.pageX-D.get("scrollLeft");F.frameY=E[1]+F.pageY-D.get("scrollTop");}}F.frameTarget=F.target;F.frameCurrentTarget=F.currentTarget;F.frameEvent=F;C.later(1,this,function(G){this.fire("dom:"+G.type,G);},F);},initializer:function(){this.publish("ready",{emitFacade:true,defaultFn:this._defReadyFn});},destructor:function(){var D=this.getInstance();D.one("doc").detachAll();D=null;this._iframe.remove();},_DOMPaste:function(G){var E=this.getInstance(),D="",F=E.config.win;if(G._event.originalTarget){D=G._event.originalTarget;}if(G._event.clipboardData){D=G._event.clipboardData.getData("Text");}if(F.clipboardData){D=F.clipboardData.getData("Text");if(D==""){if(!F.clipboardData.setData("Text",D)){D=null;}}}G.frameTarget=G.target;G.frameCurrentTarget=G.currentTarget;G.frameEvent=G;if(D){G.clipboardData={data:D,getData:function(){return D;}};}else{G.clipboardData=null;}this.fire("dom:paste",G);},_defReadyFn:function(){var E=this.getInstance(),D=C.bind(this._onDomEvent,this);E.Node.DOM_EVENTS.paste=1;C.each(B.DOM_EVENTS,function(G,F){if(G===1){if(F!=="focus"&&F!=="blur"&&F!=="paste"){if(F.substring(0,3)==="key"){E.on(F,C.throttle(D,200),E.config.doc);}else{E.on(F,D,E.config.doc);}}}},this);E.on("paste",C.bind(this._DOMPaste,this),E.one("body"));E.on("focus",D,E.config.win);E.on("blur",D,E.config.win);E._use=E.use;E.use=C.bind(this.use,this);this._iframe.setStyles({visibility:"inherit"});E.one("body").setStyle("display","block");},_onContentReady:function(F){if(!this._ready){this._ready=true;var E=this.getInstance(),D=C.clone(this.get("use"));this.fire("contentready");if(F){E.config.doc=C.Node.getDOMNode(F.target);}D.push(C.bind(function(){this.fire("ready");},this));E.use.apply(E,D);E.one("doc").get("documentElement").addClass("yui-js-enabled");}},_resolveBaseHref:function(D){if(!D||D===""){D=C.config.doc.location.href;if(D.indexOf("?")!==-1){D=D.substring(0,D.indexOf("?"));}D=D.substring(0,D.lastIndexOf("/"))+"/";}return D;},_getHTML:function(D){if(this._ready){var E=this.getInstance();D=E.one("body").get("innerHTML");}return D;},_setHTML:function(D){if(this._ready){var E=this.getInstance();E.one("body").set("innerHTML",D);}else{this.on("contentready",C.bind(function(F,H){var G=this.getInstance();G.one("body").set("innerHTML",F);},this,D));}return D;},_setExtraCSS:function(D){if(this._ready){var F=this.getInstance(),E=F.get("#extra_css");E.remove();F.one("head").append('<style id="extra_css">'+D+"</style>");}return D;},_instanceLoaded:function(D){this._instance=D;this._onContentReady();var E=this._instance.config.doc;if(this.get("designMode")){if(!C.UA.ie){this._instance.on("domready",function(G){try{E.execCommand("styleWithCSS",false,false);E.execCommand("insertbronreturn",false,false);}catch(F){}});}}},use:function(){var F=this.getInstance(),E=C.Array(arguments),D=false;if(C.Lang.isFunction(E[E.length-1])){D=E.pop();}if(D){E.push(function(){D.apply(F,arguments);});}F._use.apply(F,E);},delegate:function(F,E,D,H){var G=this.getInstance();if(!G){return false;}if(!H){H=D;D="body";}return G.delegate(F,E,D,H);},getInstance:function(){return this._instance;},render:function(D){if(this._rendered){return this;}this._rendered=true;if(D){this.set("container",D);}this._create(C.bind(function(H){var J,K,E=C.bind(function(L){this._instanceLoaded(L);},this),G=C.clone(this.get("use")),F={debug:false,win:H.win,doc:H.doc},I=C.bind(function(){F=this._resolveWinDoc(F);J=YUI(F);try{J.use("node-base",E);if(K){clearInterval(K);}}catch(L){K=setInterval(function(){I();},350);}},this);G.push(I);C.use.apply(C,G);},this));return this;},focus:function(D){try{C.one("win").focus();C.later(100,this,function(){this.getInstance().one("win").focus();if(C.Lang.isFunction(D)){D();}});}catch(E){}return this;},show:function(){this._iframe.setStyles({position:"static",left:""});if(C.UA.gecko){try{this._instance.config.doc.designMode="on";}catch(D){}this.focus();}return this;},hide:function(){this._iframe.setStyles({position:"absolute",left:"-999999px"});return this;}},{DOM_EVENTS:{paste:1,mouseup:1,mousedown:1,keyup:1,keydown:1,keypress:1},DEFAULT_CSS:"html { height: 95%; } body { padding: 7px; background-color: #fff; font: 13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a, a:visited, a:hover { color: blue !important; text-decoration: underline !important; cursor: text !important; } img { cursor: pointer !important; border: none; }",HTML:'<iframe border="0" frameBorder="0" marginWidth="0" marginHeight="0" leftMargin="0" topMargin="0" allowTransparency="true" width="100%" height="99%"></iframe>',PAGE_HTML:'<html dir="{DIR}" lang="{LANG}"><head><title>{TITLE}</title>{META}<base href="{BASE_HREF}"/><style id="editor_css">{DEFAULT_CSS}</style>{EXTRA_CSS}</head><body>{CONTENT}</body></html>',DOC_TYPE:'<!DOCTYPE HTML PUBLIC "-/'+"/W3C/"+"/DTD HTML 4.01/"+'/EN" "http:/'+'/www.w3.org/TR/html4/strict.dtd">',META:'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">',NAME:"frame",ATTRS:{title:{value:"Blank Page"},dir:{value:"ltr"},lang:{value:"en-US"},src:{value:"javascript"+((C.UA.ie)?":false":":")+";"},designMode:{writeOnce:true,value:false},content:{value:"<br>",setter:"_setHTML",getter:"_getHTML"},basehref:{value:false,getter:"_resolveBaseHref"},use:{writeOnce:true,value:["substitute","node","node-style","selector-css3"]},container:{value:"body",setter:function(D){return C.one(D);
}},id:{writeOnce:true,getter:function(D){if(!D){D="iframe-"+C.guid();}return D;}},extracss:{value:"",setter:"_setExtraCSS"},host:{value:false}}});C.Frame=B;},"@VERSION@",{requires:["base","node","selector-css3","substitute"],skinnable:false});},"@VERSION@",{requires:["base","node","selector-css3","substitute"],skinnable:false});