frame-min.js revision 9a68201f57ed1257e4735227620d7ec556fe99e5
YUI.add("frame",function(B){var A=function(){A.superclass.constructor.apply(this,arguments);};B.extend(A,B.Base,{_ready:null,_rendered:null,_iframe:null,_instance:null,_create:function(){var E,D,C;this._iframe=B.Node.create(A.HTML);this._iframe.setStyle("visibility","hidden");this._iframe.set("src",this.get("src"));this.get("container").append(this._iframe);C=this._resolveWinDoc();E=C.win;D=C.doc;return{win:E,doc:D};},_resolveWinDoc:function(D){var C=(D)?D:{};C.win=B.Node.getDOMNode(this._iframe.get("contentWindow"));C.doc=B.Node.getDOMNode(this._iframe.get("contentWindow.document"));if(!C.doc){C.doc=B.config.doc;}if(!C.win){C.win=B.config.win;}return C;},_onDomEvent:function(E){var D=this._iframe.getXY(),C=this._instance.one("win");E.frameX=D[0]+E.pageX-C.get("scrollLeft");E.frameY=D[1]+E.pageY-C.get("scrollTop");E.frameTarget=E.target;E.frameCurrentTarget=E.currentTarget;E.frameEvent=E;this.publish(E.type,{emitFacade:true,stoppedFn:B.bind(function(G,F){G.halt();},this,E),preventedFn:B.bind(function(G,F){G.preventDefault();},this,E)});this.fire(E.type,E);},initializer:function(){this.publish("ready",{emitFacade:true,defaultFn:this._defReadyFn});},destructor:function(){var C=this.getInstance();C.one("doc").detachAll();C=null;this._iframe.remove();},_defReadyFn:function(){var D=this.getInstance(),C=B.bind(this._onDomEvent,this);B.each(B.Node.DOM_EVENTS,function(F,E){if(F===1){if(E!=="focus"&&E!=="blur"){D.on(E,C,D.config.doc);}}});D.on("focus",C,D.config.win);D.on("blur",C,D.config.win);D._use=D.use;D.use=B.bind(this.use,this);this._iframe.setStyles({visibility:"inherit"});D.one("body").setStyle("display","block");},_onContentReady:function(E){if(!this._ready){this._ready=true;var D=this.getInstance(),C=B.clone(this.get("use"));this.fire("contentready");if(E){D.config.doc=B.Node.getDOMNode(E.target);}C.push(B.bind(function(){this.fire("ready");},this));D.use.apply(D,C);D.one("doc").get("documentElement").addClass("yui-js-enabled");}},_resolveBaseHref:function(C){if(!C||C===""){C=B.config.doc.location.href;if(C.indexOf("?")!==-1){C=C.substring(0,C.indexOf("?"));}C=C.substring(0,C.lastIndexOf("/"))+"/";}return C;},_getHTML:function(C){if(this._ready){var D=this.getInstance();C=D.one("body").get("innerHTML");}return C;},_setHTML:function(C){if(this._ready){var D=this.getInstance();D.one("body").set("innerHTML",C);}else{this.on("contentready",B.bind(function(E,G){var F=this.getInstance();F.one("body").set("innerHTML",E);},this,C));}return C;},_setExtraCSS:function(C){if(this._ready){var E=this.getInstance(),D=E.get("#extra_css");D.remove();E.one("head").append('<style id="extra_css">'+C+"</style>");}return C;},_instanceLoaded:function(E){this._instance=E;this._instance.on("contentready",B.bind(this._onContentReady,this),"body");var C="",D=((this.get("extracss"))?'<style id="extra_css">'+this.get("extracss")+"</style>":""),F=this._instance.config.doc;C=B.substitute(A.PAGE_HTML,{DIR:this.get("dir"),LANG:this.get("lang"),TITLE:this.get("title"),META:A.META,CONTENT:this.get("content"),BASE_HREF:this.get("basehref"),DEFAULT_CSS:A.DEFAULT_CSS,EXTRA_CSS:D});if(B.config.doc.compatMode!="BackCompat"){C=A.DOC_TYPE+"\n"+C;}else{}F.open();F.write(C);F.close();if(this.get("designMode")){F.designMode="on";if(!B.UA.ie){this._instance.on("domready",function(H){try{F.execCommand("styleWithCSS",false,false);F.execCommand("insertbronreturn",false,false);}catch(G){}});}}},use:function(){var E=this.getInstance(),D=B.Array(arguments),C=false;if(B.Lang.isFunction(D[D.length-1])){C=D.pop();}if(C){D.push(function(){C.apply(E,arguments);});}E._use.apply(E,D);},delegate:function(E,D,C,G){var F=this.getInstance();if(!F){return false;}if(!G){G=C;C="body";}return F.delegate(E,D,C,G);},getInstance:function(){return this._instance;},render:function(H){if(this._rendered){return this;}this._rendered=true;if(H){this.set("container",H);}var I,J,F=this._create(),C=B.bind(function(K){this._instanceLoaded(K);},this),E=B.clone(this.get("use")),D={debug:false,bootstrap:false,win:F.win,doc:F.doc},G=B.bind(function(){D=this._resolveWinDoc(D);I=YUI(D);try{I.use("node-base",C);if(J){clearInterval(J);}}catch(K){J=setInterval(function(){G();},350);}},this);E.push(G);B.use.apply(B,E);return this;},focus:function(){if(B.UA.ie||B.UA.gecko){this.getInstance().one("win").focus();}else{try{B.one("win").focus();B.later(100,this,function(){this.getInstance().one("win").focus();});}catch(C){}}return this;},show:function(){this._iframe.setStyles({position:"static",left:""});if(B.UA.gecko){try{this._instance.config.doc.designMode="on";}catch(C){}this.focus();}return this;},hide:function(){this._iframe.setStyles({position:"absolute",left:"-999999px"});return this;}},{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"+((B.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(C){return B.one(C);
}},id:{writeOnce:true,getter:function(C){if(!C){C="iframe-"+B.guid();}return C;}},extracss:{value:"",setter:"_setExtraCSS"},host:{value:false}}});B.Frame=A;},"@VERSION@",{requires:["base","node","selector-css3","substitute"],skinnable:false});