File: fullscreen.html

package info (click to toggle)
horde3 3.1.3-4etch7
  • links: PTS
  • area: main
  • in suites: etch
  • size: 22,876 kB
  • ctags: 18,071
  • sloc: php: 75,151; xml: 2,979; sql: 1,069; makefile: 79; sh: 64
file content (153 lines) | stat: -rw-r--r-- 5,616 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
    <title>Fullscreen HTMLArea</title>
    <script type="text/javascript">
      _editor_url = window.opener._editor_url || '../';
      _editor_lang = window.opener._editor_lang;
      _editor_css = window.opener._editor_css;
      var BASE = window.opener.document.baseURI || window.opener.document.URL;
      var head = document.getElementsByTagName("head")[0];
      var base = document.createElement("base");
      base.href = BASE;
      head.appendChild(base);
    </script>

    <script type="text/javascript">
        document.write('<scr' + 'ipt type="text/javascript" src="' + _editor_url + 'htmlarea.js"></scr' + 'ipt>');
    </script>
    <script type="text/javascript">
	// load HTMLArea scripts that are present in the opener frame
	var scripts = window.opener.HTMLArea._scripts;
	for (var i = 3; i < scripts.length; ++i) {
           //document.write("<scr" + "ipt type='text/javascript' src='" + scripts[i] + "'></scr" + "ipt>");
           HTMLArea.loadScript(scripts[i]);
        }
    </script>

    <!-- browser takes a coffee break here -->
    <script type="text/javascript">
var parent_object  = null;
var editor	   = null;	// to be initialized later [ function init() ]

/* ---------------------------------------------------------------------- *\
   Function    :
   Description :
\* ---------------------------------------------------------------------- */

function _CloseOnEsc(ev) {
	ev || (ev = window.event) || (ev = editor._iframe.contentWindow.event);
	if (ev.keyCode == 27) {
		// update_parent();
		window.close();
		return;
	}
}

/* ---------------------------------------------------------------------- *\
   Function    : resize_editor
   Description : resize the editor when the user resizes the popup
\* ---------------------------------------------------------------------- */

function resize_editor() {  // resize editor to fix window

  var newHeight;
  if (document.all) { // IE
    newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;
    if (newHeight < 0) { newHeight = 0; }
  } else { // Gecko
    newHeight = window.innerHeight - editor._toolbar.offsetHeight;
  }
  if (editor.config.statusBar) {
    newHeight -= editor._statusBar.offsetHeight;
  }

  // TODO: I'm not sure exactly what these are adjusting for, but if
  // you don't adjust the height for IE then document.body.offsetHeight
  // will get larger every time and the (popup) editor will get stuck
  // in a tight loop and the browser won't be responsive.  In future we'll
  // want to get these measurements dynamically in case elements change size
  // in the future.

  if (HTMLArea.is_gecko) { newHeight -= 8; }
  else                   { newHeight -= 10; }

  // adjust element height
  var newHeightWithPx = newHeight + "px";
  editor._textArea.style.height = newHeightWithPx;
  editor._iframe.style.height   = newHeightWithPx;
}

/* ---------------------------------------------------------------------- *\
   Function    : init
   Description : run this code on page load
\* ---------------------------------------------------------------------- */

function init() {
	parent_object	   = opener.HTMLArea._object;
	var config	   = HTMLArea.cloneObject( parent_object.config );
	config.width	   = "100%";
	config.height	   = "auto";

	// change maximize button to minimize button
	config.btnList["popupeditor"] = [ 'Minimize Editor', _editor_url + 'images/fullscreen_minimize.gif', true,
					  function() { window.close(); } ];

	// generate editor and resize it
	editor = new HTMLArea("editor", config);

	// register the plugins, if any
	for (var i in parent_object.plugins) {
		var plugin = parent_object.plugins[i];
		try {
			eval(plugin.name);
			editor.registerPlugin2(plugin.name, plugin.args);
		} catch(e) {};
	}
	// and restore the original toolbar
        config.toolbar = parent_object.config.toolbar;
	editor.generate();
	editor._iframe.style.width = "100%";
	editor._textArea.style.width = "100%";
	resize_editor();

	editor.doctype = parent_object.doctype;

	// set child window contents and event handlers, after a small delay
	setTimeout(function() {
			   editor.setHTML(parent_object.getInnerHTML());

			   // switch mode if needed
			   if (parent_object._mode == "textmode") { editor.setMode("textmode"); }

			   // 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
   Description : update parent window editor field with contents from child window
   \* ---------------------------------------------------------------------- */

function update_parent() {

	// use the fast version
	parent_object.setHTML(editor.getInnerHTML());
}

    </script>
    <style type="text/css"> html, body { height: 100%; margin: 0px; border: 0px; background-color: buttonface; } </style>
  </head>
  <body scroll="no" onload="HTMLArea.onload = init; HTMLArea.init();" onunload="update_parent()">
    <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>
    </form>
  </body>
</html>