source: trunk/popups/fullscreen.html @ 19

Last change on this file since 19 was 19, checked in by gogo, 15 years ago

Adding subversion properties.

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 5.1 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2<html>
3  <head>
4    <title>Fullscreen HTMLArea</title>
5    <script type="text/javascript">
6      _editor_url = window.opener._editor_url || '../';
7      _editor_lang = window.opener._editor_lang;
8      _editor_css = window.opener._editor_css;
9      var BASE = window.opener.document.baseURI || window.opener.document.URL;
10      var head = document.getElementsByTagName("head")[0];
11      var base = document.createElement("base");
12      base.href = BASE;
13      head.appendChild(base);
14    </script>
15
16    <script type="text/javascript">
17        document.write('<scr' + 'ipt type="text/javascript" src="' + _editor_url + 'htmlarea.js"></scr' + 'ipt>');
18    </script>
19    <script type="text/javascript">
20        // load HTMLArea scripts that are present in the opener frame
21        var scripts = window.opener.HTMLArea._scripts;
22        for (var i = 3; i < scripts.length; ++i) {
23           //document.write("<scr" + "ipt type='text/javascript' src='" + scripts[i] + "'></scr" + "ipt>");
24           HTMLArea.loadScript(scripts[i]);
25        }
26    </script>
27
28    <!-- browser takes a coffee break here -->
29    <script type="text/javascript">
30var parent_object  = null;
31var editor         = null;      // to be initialized later [ function init() ]
32
33/* ---------------------------------------------------------------------- *\
34   Function    :
35   Description :
36\* ---------------------------------------------------------------------- */
37
38function _CloseOnEsc(ev) {
39        ev || (ev = window.event) || (ev = editor._iframe.contentWindow.event);
40        if (ev.keyCode == 27) {
41                // update_parent();
42                window.close();
43                return;
44        }
45}
46
47/* ---------------------------------------------------------------------- *\
48   Function    : resize_editor
49   Description : resize the editor when the user resizes the popup
50\* ---------------------------------------------------------------------- */
51
52function resize_editor() {  // resize editor to fix window
53        var newHeight;
54        if (document.all) {
55                // IE
56                newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;
57                if (newHeight < 0) { newHeight = 0; }
58        } else {
59                // Gecko
60                newHeight = window.innerHeight - editor._toolbar.offsetHeight;
61        }
62        if (editor.config.statusBar) {
63                newHeight -= editor._statusBar.offsetHeight;
64        }
65        editor._textArea.style.height = editor._iframe.style.height = newHeight - (HTMLArea.is_gecko ? 8 : 0) + "px";
66}
67
68/* ---------------------------------------------------------------------- *\
69   Function    : init
70   Description : run this code on page load
71\* ---------------------------------------------------------------------- */
72
73function init() {
74        parent_object      = opener.HTMLArea._object;
75        var config         = HTMLArea.cloneObject( parent_object.config );
76        config.width       = "100%";
77        config.height      = "auto";
78
79        // change maximize button to minimize button
80        config.btnList["popupeditor"] = [ 'Minimize Editor', _editor_url + 'images/fullscreen_minimize.gif', true,
81                                          function() { window.close(); } ];
82
83        // generate editor and resize it
84        editor = new HTMLArea("editor", config);
85
86        // register the plugins, if any
87        for (var i in parent_object.plugins) {
88                var plugin = parent_object.plugins[i];
89                try {
90                        eval(plugin.name);
91                        editor.registerPlugin2(plugin.name, plugin.args);
92                } catch(e) {};
93        }
94        // and restore the original toolbar
95        config.toolbar = parent_object.config.toolbar;
96        editor.generate();
97        editor._iframe.style.width = "100%";
98        editor._textArea.style.width = "100%";
99        resize_editor();
100
101        editor.doctype = parent_object.doctype;
102
103        // set child window contents and event handlers, after a small delay
104        setTimeout(function() {
105                           editor.setHTML(parent_object.getInnerHTML());
106
107                           // switch mode if needed
108                           if (parent_object._mode == "textmode") { editor.setMode("textmode"); }
109
110                           // continuously update parent editor window
111                           setInterval(update_parent, 500);
112
113                           // setup event handlers
114                           document.body.onkeypress = _CloseOnEsc;
115                           editor._doc.body.onkeypress = _CloseOnEsc;
116                           editor._textArea.onkeypress = _CloseOnEsc;
117                           window.onresize = resize_editor;
118                   }, 333);                      // give it some time to meet the new frame
119}
120
121/* ---------------------------------------------------------------------- *\
122   Function    : update_parent
123   Description : update parent window editor field with contents from child window
124   \* ---------------------------------------------------------------------- */
125
126function update_parent() {
127        // use the fast version
128        parent_object.setHTML(editor.getInnerHTML());
129}
130
131    </script>
132    <style type="text/css"> html, body { height: 100%; margin: 0px; border: 0px; background-color: buttonface; } </style>
133  </head>
134  <body scroll="no" onload="HTMLArea.onload = init; HTMLArea.init();" onunload="update_parent()">
135    <form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">
136      <textarea name="editor" id="editor" style="width:100%; height:300px">&nbsp;</textarea>
137    </form>
138  </body>
139</html>
Note: See TracBrowser for help on using the repository browser.