Diff for /loncom/html/htmlarea/popups/Attic/fullscreen.html between versions 1.1 and 1.2

version 1.1, 2004/02/18 08:07:16 version 1.2, 2004/06/01 23:46:11
Line 1 Line 1
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>  <html>
 <head><title>Fullscreen Editor</title>    <head>
 <style type="text/css">      <title>Fullscreen HTMLArea</title>
 @import url(../htmlarea.css);      <script type="text/javascript">
 html, body { margin: 0px; border: 0px; background-color: buttonface; } </style>        _editor_url = window.opener._editor_url;
         _editor_lang = window.opener._editor_lang;
 <!--        var BASE = window.opener.document.baseURI || window.opener.document.URL;
 <script type="text/javascript" src="../htmlarea.js"></script>        var head = document.getElementsByTagName("head")[0];
 <script type="text/javascript" src="../htmlarea-lang-en.js"></script>        var base = document.createElement("base");
 <script type="text/javascript" src="../dialog.js"></script>        base.href = BASE;
 -->        head.appendChild(base);
       </script>
 <script type="text/javascript">  
 // load same scripts that were present in the opener page      <script type="text/javascript" src="../htmlarea.js"></script>
 var scripts = opener.document.getElementsByTagName("script");  
 var head = document.getElementsByTagName("head")[0];      <script type="text/javascript">
 for (var i = 0; i < scripts.length; ++i) {   // load HTMLArea scripts that are present in the opener frame
   var script = scripts[i];   var scripts = window.opener.HTMLArea._scripts;
   if (typeof script.src != "undefined" && /\S/.test(script.src)) {   for (var i = 4; i < scripts.length; ++i) {
     // document.write("<scr" + "ipt type=" + "\"script/javascript\"");             document.write("<scr" + "ipt type='text/javascript' src='" + scripts[i] + "'></scr" + "ipt>");
     // document.write(" src=\"../" + script.src + "\"></scr" + "ipt>");          }
     var new_script = document.createElement("script");      </script>
     if (/^http:/i.test(script.src)) {  
       new_script.src = script.src;  
     } else {  
       new_script.src = "../" + script.src;  
     }  
     head.appendChild(new_script);  
   }  
 }  
 </script>  
   
 <script type="text/javascript">  
   
       <!-- browser takes a coffee break here -->
       <script type="text/javascript">
 var parent_object  = null;  var parent_object  = null;
 var editor         = null;      // to be initialized later [ function init() ]  var editor   = null; // to be initialized later [ function init() ]
   
 /* ---------------------------------------------------------------------- *\  /* ---------------------------------------------------------------------- *\
   Function    :     Function    :
   Description :     Description :
 \* ---------------------------------------------------------------------- */  \* ---------------------------------------------------------------------- */
   
 function _CloseOnEsc(ev) {  function _CloseOnEsc(ev) {
   if (document.all) {   ev || (ev = window.event);
     // IE   if (ev.keyCode == 27) {
     ev = window.event;   // update_parent();
   }   window.close();
   if (ev.keyCode == 27) {   return;
     // update_parent();   }
     window.close();  
     return;  
   }  
 }  }
   
 /* ---------------------------------------------------------------------- *\  /* ---------------------------------------------------------------------- *\
   Function    : cloneObject     Function    : resize_editor
   Description : copy an object by value instead of by reference     Description : resize the editor when the user resizes the popup
   Usage       : var newObj = cloneObject(oldObj);  
 \* ---------------------------------------------------------------------- */  
   
 function cloneObject(obj) {  
   var newObj          = new Object;  
   
   // check for array objects  
   if (obj.constructor.toString().indexOf("function Array(") == 1) {  
     newObj = obj.constructor();  
   }  
   
   // check for function objects (as usual, IE is fucked up)  
   if (obj.constructor.toString().indexOf("function Function(") == 1) {  
     newObj = obj; // just copy reference to it  
   } else for (var n in obj) {  
     var node = obj[n];  
     if (typeof node == 'object') { newObj[n] = cloneObject(node); }  
     else                         { newObj[n] = node; }  
   }  
    
   return newObj;  
 }  
   
 /* ---------------------------------------------------------------------- *\  
   Function    : resize_editor  
   Description : resize the editor when the user resizes the popup  
 \* ---------------------------------------------------------------------- */  \* ---------------------------------------------------------------------- */
   
 function resize_editor() {  // resize editor to fix window  function resize_editor() {  // resize editor to fix window
   var newHeight;   var newHeight;
   if (document.all) {   if (document.all) {
     // IE   // IE
     newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;   newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;
     if (newHeight < 0) { newHeight = 0; }   if (newHeight < 0) { newHeight = 0; }
   } else {   } else {
     // Gecko   // Gecko
     newHeight = window.innerHeight - editor._toolbar.offsetHeight;   newHeight = window.innerHeight - editor._toolbar.offsetHeight;
   }   }
   if (editor.config.statusBar) {   if (editor.config.statusBar) {
     newHeight -= editor._statusBar.offsetHeight;   newHeight -= editor._statusBar.offsetHeight;
   }   }
   editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";   editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";
 }  }
   
 /* ---------------------------------------------------------------------- *\  /* ---------------------------------------------------------------------- *\
   Function    : init     Function    : init
   Description : run this code on page load     Description : run this code on page load
 \* ---------------------------------------------------------------------- */  \* ---------------------------------------------------------------------- */
   
 function init() {  function init() {
   parent_object      = opener.HTMLArea._object;   parent_object   = opener.HTMLArea._object;
   var config         = cloneObject( parent_object.config );   var config   = HTMLArea.cloneObject( parent_object.config );
   config.editorURL   = "../";   config.width   = "100%";
   config.width       = "100%";   config.height   = "auto";
   config.height      = "auto";  
    // change maximize button to minimize button
   // change maximize button to minimize button   config.btnList["popupeditor"] = [ 'Minimize Editor', _editor_url + 'images/fullscreen_minimize.gif', true,
   config.btnList["popupeditor"] = [ 'Minimize Editor', 'images/fullscreen_minimize.gif', true,    function() { window.close(); } ];
                                     function() { window.close(); } ];  
    // generate editor and resize it
   // generate editor and resize it   editor = new HTMLArea("editor", config);
   editor = new HTMLArea("editor", config);  
   editor.generate();   // register the plugins, if any
   editor._iframe.style.width = "100%";   for (var i in parent_object.plugins) {
   editor._textArea.style.width = "100%";   var plugin = parent_object.plugins[i];
   resize_editor();   editor.registerPlugin2(plugin.name, plugin.args);
    }
   // set child window contents and event handlers, after a small delay   // and restore the original toolbar
   setTimeout(function() {          config.toolbar = parent_object.config.toolbar;
     editor.setHTML(parent_object.getInnerHTML());   editor.generate();
    editor._iframe.style.width = "100%";
     // switch mode if needed   editor._textArea.style.width = "100%";
     if (parent_object._mode == "textmode") { editor.setMode("textmode"); }   resize_editor();
   
     // continuously update parent editor window   editor.doctype = parent_object.doctype;
     setInterval(update_parent, 500);  
    // set child window contents and event handlers, after a small delay
     // setup event handlers   setTimeout(function() {
     document.body.onkeypress = _CloseOnEsc;     editor.setHTML(parent_object.getInnerHTML());
     editor._doc.body.onkeypress = _CloseOnEsc;  
     editor._textArea.onkeypress = _CloseOnEsc;     // switch mode if needed
     window.onresize = resize_editor;     if (parent_object._mode == "textmode") { editor.setMode("textmode"); }
   }, 333);                      // give it some time to meet the new frame  
      // continuously update parent editor window
      setInterval(update_parent, 500);
   
      // setup event handlers
      document.body.onkeypress = _CloseOnEsc;
      editor._doc.body.onkeypress = _CloseOnEsc;
      editor._textArea.onkeypress = _CloseOnEsc;
      window.onresize = resize_editor;
      }, 333); // give it some time to meet the new frame
 }  }
   
 /* ---------------------------------------------------------------------- *\  /* ---------------------------------------------------------------------- *\
   Function    : update_parent     Function    : update_parent
   Description : update parent window editor field with contents from child window     Description : update parent window editor field with contents from child window
 \* ---------------------------------------------------------------------- */     \* ---------------------------------------------------------------------- */
   
 function update_parent() {  function update_parent() {
   // use the fast version   // use the fast version
   parent_object.setHTML(editor.getInnerHTML());   parent_object.setHTML(editor.getInnerHTML());
 }  }
   
       </script>
 </script>      <style type="text/css"> html, body { height: 100%; margin: 0px; border: 0px; background-color: buttonface; } </style>
 </head>    </head>
 <body scroll="no" onload="init()" onunload="update_parent()">    <body scroll="no" onload="setTimeout(function(){init();}, 500)" onunload="update_parent()">
       <form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">
 <form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">        <textarea name="editor" id="editor" style="width:100%; height:300px">&nbsp;</textarea>
 <textarea name="editor" id="editor" style="width:100%; height:300px">&nbsp;</textarea>      </form>
 </form>    </body>
   </html>
 </body></html>  

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>