var UPDATE_KEY = "3"; var MANAGED = false; var GZ = false; var cScriptDependencies = [ "../common.js", "script-routing.js", "selection/selection-listener.js", "selection/drag_n_drop.js", "toolbar/yade-toolbar.js", "toolbar/menu.js", "table/table.js", "content/undo.js", "content/commands.js", "content/shortcuts.js", "content/content-drag-n-drop.js", "color/color.js", "properties/properties.js", "properties/page-parameters.js", "tidy/parser.js", "data/xml-provider.js", "yade.js" ]; var cPublicMethods = ["resizeContent", "loadPage", "loadHTML", "onTabClose", "setBOPageMode", "setFormFieldMode", "getContentXml", "getContentText", "enableTemplates"] //Trying to fetch the editor from a parent frame var oFrameCache = null; var o = parent; while( true ) { if( o.__frameCache ) { oFrameCache = o.__frameCache; break; } if( o == o.parent ) break; o = o.parent; } var bFrameMerged = false; if( oFrameCache ) { if( window.frameElement ) { window.bubbleParent = true; if( window.frameElement.id != "__yadeFrame" ) { bFrameMerged = true; var oCache = oFrameCache.document.body.firstChild; while( oCache && oCache.claimed ) oCache = oCache.nextSibling; if( oCache ) { oCache.claimed = true; window.onload = function() { document.body.innerHTML = "
"; document.body.style.margin = "0px"; document.body.firstChild.insertAdjacentElement("BeforeEnd", oCache); //document.body.insertAdjacentElement("AfterBegin", oCache); //document.body.appendChild(oCache); oCache.claimed = false; hookEvents(); __yadeFrame.enableTemplates(true); __yadeFrame.parseHash(document.location.hash); document.body.firstChild.style.display = "none"; document.body.firstChild.style.display = ""; //__yadeFrame.flicker(); /*document.all.__yadeFrame.style.display = "none"; document.all.__yadeFrame.style.display = "";*/ } } else { window.onload = function() { document.body.style.margin = "0px"; document.body.innerHTML = ""; __yadeFrame.navigate(document.location.href); } } window.attachEvent("onbeforeunload", function() { try { if( oFrameCache ) { __yadeFrame.cleanUp(); __yadeFrame.hideContent(true); __yadeFrame.loadPage("content/blank.htm"); oFrameCache.document.body.insertAdjacentElement("BeforeEnd", __yadeFrame.frameElement); } } catch(e) //This will fail if the window is reloaded { } }); } else { } } } function flicker() { document.body.firstChild.style.display = "none"; document.body.firstChild.style.display = ""; } function onEditorInitialized(oEditor) { hookEvents(); } function hookEvents() { for( var i = 0; i < cPublicMethods.length; i++ ) { if( __yadeFrame[cPublicMethods[i]] ) { window[cPublicMethods[i]] = __yadeFrame[cPublicMethods[i]]; } } } function includeScript(i) { if( i < cScriptDependencies.length ) { var oScript = document.createElement("script"); document.body.appendChild(oScript); oScript.onreadystatechange = function() { if( this.readyState == "loaded" ) setTimeout("includeScript(" + (this.__scriptNumber + 1) + ");", 1); } if( MANAGED ) { oScript.src = "gz/default.aspx?f=../" + cScriptDependencies[i] + "&exp=500" + "&update-key=" + UPDATE_KEY + (!GZ ? "&gz=false" : ""); } else oScript.src = cScriptDependencies[i]; oScript.__scriptNumber = i; } } var bScriptsLoaded = false; function includeScripts() { if( !bScriptsLoaded ) { bScriptsLoaded = true; includeScript(0); } var oHead = document.all.tags("head")[0]; var oLink = document.createElement("link"); oLink.rel = "stylesheet"; oLink.href = "style.css"; oHead.insertAdjacentElement("BeforeEnd", oLink); } if( !bFrameMerged ) { window.attachEvent("onload", includeScripts); }