Browse code

Re-add TinyMCE 2.0.1 to the site settings list - TinyMCE directoy names changed - installer submission settings layout dirty fix

Clarissa Walker authored on 2026/07/27 11:20:38
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,5 +0,0 @@
1
-
2
-// Uncomment and change this document.domain value if you are loading the script cross subdomains
3
-// document.domain = 'moxiecode.com';
4
-
5
-var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait();
6 0
\ No newline at end of file
Browse code

Actually use TinyMCE 3.4.8 for TinyMCE3 option instead of original 2.0.1; that version is moved to 'tinymce2' directory

Clarissa Walker authored on 2026/07/27 09:02:31
Showing 1 changed files
... ...
@@ -1,275 +1,5 @@
1
-// Some global instances
2
-var tinymce = null, tinyMCEPopup, tinyMCE;
3 1
 
4
-tinyMCEPopup = {
5
-	init : function() {
6
-		var t = this, w, ti, li, q, i, it;
2
+// Uncomment and change this document.domain value if you are loading the script cross subdomains
3
+// document.domain = 'moxiecode.com';
7 4
 
8
-		li = ('' + document.location.search).replace(/^\?/, '').split('&');
9
-		q = {};
10
-		for (i=0; i<li.length; i++) {
11
-			it = li[i].split('=');
12
-			q[unescape(it[0])] = unescape(it[1]);
13
-		}
14
-
15
-		if (q.mce_rdomain)
16
-			document.domain = q.mce_rdomain;
17
-
18
-		// Find window & API
19
-		w = t.getWin();
20
-		tinymce = w.tinymce;
21
-		tinyMCE = w.tinyMCE;
22
-		t.editor = tinymce.EditorManager.activeEditor;
23
-		t.params = t.editor.windowManager.params;
24
-
25
-		// Setup local DOM
26
-		t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
27
-		t.dom.loadCSS(t.editor.settings.popup_css);
28
-
29
-		// Setup on init listeners
30
-		t.listeners = [];
31
-		t.onInit = {
32
-			add : function(f, s) {
33
-				t.listeners.push({func : f, scope : s});
34
-			}
35
-		};
36
-
37
-		t.isWindow = !t.getWindowArg('mce_inline');
38
-		t.id = t.getWindowArg('mce_window_id');
39
-		t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
40
-	},
41
-
42
-	getWin : function() {
43
-		return window.dialogArguments || opener || parent || top;
44
-	},
45
-
46
-	getWindowArg : function(n, dv) {
47
-		var v = this.params[n];
48
-
49
-		return tinymce.is(v) ? v : dv;
50
-	},
51
-
52
-	getParam : function(n, dv) {
53
-		return this.editor.getParam(n, dv);
54
-	},
55
-
56
-	getLang : function(n, dv) {
57
-		return this.editor.getLang(n, dv);
58
-	},
59
-
60
-	execCommand : function(cmd, ui, val, a) {
61
-		a = a || {};
62
-		a.skip_focus = 1;
63
-
64
-		this.restoreSelection();
65
-		return this.editor.execCommand(cmd, ui, val, a);
66
-	},
67
-
68
-	resizeToInnerSize : function() {
69
-		var t = this, n, b = document.body, vp = t.dom.getViewPort(window), dw, dh;
70
-
71
-		dw = t.getWindowArg('mce_width') - vp.w;
72
-		dh = t.getWindowArg('mce_height') - vp.h;
73
-
74
-		if (t.isWindow)
75
-			window.resizeBy(dw, dh);
76
-		else
77
-			t.editor.windowManager.resizeBy(dw, dh, t.id);
78
-	},
79
-
80
-	executeOnLoad : function(s) {
81
-		this.onInit.add(function() {
82
-			eval(s);
83
-		});
84
-	},
85
-
86
-	storeSelection : function() {
87
-		this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
88
-	},
89
-
90
-	restoreSelection : function() {
91
-		var t = tinyMCEPopup;
92
-
93
-		if (!t.isWindow && tinymce.isIE)
94
-			t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
95
-	},
96
-
97
-	requireLangPack : function() {
98
-		var u = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url');
99
-
100
-		if (u && this.editor.settings.language) {
101
-			u += '/langs/' + this.editor.settings.language + '_dlg.js';
102
-
103
-			if (!tinymce.ScriptLoader.isDone(u)) {
104
-				document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
105
-				tinymce.ScriptLoader.markDone(u);
106
-			}
107
-		}
108
-	},
109
-
110
-	pickColor : function(e, element_id) {
111
-		this.execCommand('mceColorPicker', true, {
112
-			color : document.getElementById(element_id).value,
113
-			func : function(c) {
114
-				document.getElementById(element_id).value = c;
115
-
116
-				try {
117
-					document.getElementById(element_id).onchange();
118
-				} catch (ex) {
119
-					// Try fire event, ignore errors
120
-				}
121
-			}
122
-		});
123
-	},
124
-
125
-	openBrowser : function(element_id, type, option) {
126
-		tinyMCEPopup.restoreSelection();
127
-		this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
128
-	},
129
-
130
-	close : function() {
131
-		var t = this;
132
-
133
-		// To avoid domain relaxing issue in Opera
134
-		function close() {
135
-			t.editor.windowManager.close(window);
136
-			tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
137
-		};
138
-
139
-		if (tinymce.isOpera)
140
-			t.getWin().setTimeout(close, 0);
141
-		else
142
-			close();
143
-	},
144
-
145
-	// Internal functions	
146
-
147
-	_restoreSelection : function() {
148
-		var e = window.event.srcElement;
149
-
150
-		if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
151
-			tinyMCEPopup.restoreSelection();
152
-	},
153
-
154
-/*	_restoreSelection : function() {
155
-		var e = window.event.srcElement;
156
-
157
-		// If user focus a non text input or textarea
158
-		if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
159
-			tinyMCEPopup.restoreSelection();
160
-	},*/
161
-
162
-	_onDOMLoaded : function() {
163
-		var t = this, ti = document.title, bm, h;
164
-
165
-		// Translate page
166
-		h = document.body.innerHTML;
167
-
168
-		// Replace a=x with a="x" in IE
169
-		if (tinymce.isIE)
170
-			h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
171
-
172
-		document.dir = t.editor.getParam('directionality','');
173
-		document.body.innerHTML = t.editor.translate(h);
174
-		document.title = ti = t.editor.translate(ti);
175
-		document.body.style.display = '';
176
-
177
-		// Restore selection in IE when focus is placed on a non textarea or input element of the type text
178
-		if (tinymce.isIE)
179
-			document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
180
-
181
-		t.restoreSelection();
182
-		t.resizeToInnerSize();
183
-
184
-		// Set inline title
185
-		if (!t.isWindow)
186
-			t.editor.windowManager.setTitle(window, ti);
187
-		else
188
-			window.focus();
189
-
190
-		if (!tinymce.isIE && !t.isWindow) {
191
-			tinymce.dom.Event._add(document, 'focus', function() {
192
-				t.editor.windowManager.focus(t.id)
193
-			});
194
-		}
195
-
196
-		// Patch for accessibility
197
-		tinymce.each(t.dom.select('select'), function(e) {
198
-			e.onkeydown = tinyMCEPopup._accessHandler;
199
-		});
200
-
201
-		// Call onInit
202
-		// Init must be called before focus so the selection won't get lost by the focus call
203
-		tinymce.each(t.listeners, function(o) {
204
-			o.func.call(o.scope, t.editor);
205
-		});
206
-
207
-		// Move focus to window
208
-		if (t.getWindowArg('mce_auto_focus', true)) {
209
-			window.focus();
210
-
211
-			// Focus element with mceFocus class
212
-			tinymce.each(document.forms, function(f) {
213
-				tinymce.each(f.elements, function(e) {
214
-					if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
215
-						e.focus();
216
-						return false; // Break loop
217
-					}
218
-				});
219
-			});
220
-		}
221
-
222
-		document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
223
-	},
224
-
225
-	_accessHandler : function(e) {
226
-		e = e || window.event;
227
-
228
-		if (e.keyCode == 13 || e.keyCode == 32) {
229
-			e = e.target || e.srcElement;
230
-
231
-			if (e.onchange)
232
-				e.onchange();
233
-
234
-			return tinymce.dom.Event.cancel(e);
235
-		}
236
-	},
237
-
238
-	_closeWinKeyHandler : function(e) {
239
-		e = e || window.event;
240
-
241
-		if (e.keyCode == 27)
242
-			tinyMCEPopup.close();
243
-	},
244
-
245
-	_wait : function() {
246
-		var t = this, ti;
247
-
248
-		if (tinymce.isIE && document.location.protocol != 'https:') {
249
-			// Fake DOMContentLoaded on IE
250
-			document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');
251
-			document.getElementById("__ie_onload").onreadystatechange = function() {
252
-				if (this.readyState == "complete") {
253
-					t._onDOMLoaded();
254
-					document.getElementById("__ie_onload").onreadystatechange = null; // Prevent leak
255
-				}
256
-			};
257
-		} else {
258
-			if (tinymce.isIE || tinymce.isWebKit) {
259
-				ti = setInterval(function() {
260
-					if (/loaded|complete/.test(document.readyState)) {
261
-						clearInterval(ti);
262
-						t._onDOMLoaded();
263
-					}
264
-				}, 10);
265
-			} else {
266
-				window.addEventListener('DOMContentLoaded', function() {
267
-					t._onDOMLoaded();
268
-				}, false);
269
-			}
270
-		}
271
-	}
272
-};
273
-
274
-tinyMCEPopup.init();
275
-tinyMCEPopup._wait(); // Wait for DOM Content Loaded
5
+var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait();
276 6
\ No newline at end of file
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,275 @@
1
+// Some global instances
2
+var tinymce = null, tinyMCEPopup, tinyMCE;
3
+
4
+tinyMCEPopup = {
5
+	init : function() {
6
+		var t = this, w, ti, li, q, i, it;
7
+
8
+		li = ('' + document.location.search).replace(/^\?/, '').split('&');
9
+		q = {};
10
+		for (i=0; i<li.length; i++) {
11
+			it = li[i].split('=');
12
+			q[unescape(it[0])] = unescape(it[1]);
13
+		}
14
+
15
+		if (q.mce_rdomain)
16
+			document.domain = q.mce_rdomain;
17
+
18
+		// Find window & API
19
+		w = t.getWin();
20
+		tinymce = w.tinymce;
21
+		tinyMCE = w.tinyMCE;
22
+		t.editor = tinymce.EditorManager.activeEditor;
23
+		t.params = t.editor.windowManager.params;
24
+
25
+		// Setup local DOM
26
+		t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
27
+		t.dom.loadCSS(t.editor.settings.popup_css);
28
+
29
+		// Setup on init listeners
30
+		t.listeners = [];
31
+		t.onInit = {
32
+			add : function(f, s) {
33
+				t.listeners.push({func : f, scope : s});
34
+			}
35
+		};
36
+
37
+		t.isWindow = !t.getWindowArg('mce_inline');
38
+		t.id = t.getWindowArg('mce_window_id');
39
+		t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
40
+	},
41
+
42
+	getWin : function() {
43
+		return window.dialogArguments || opener || parent || top;
44
+	},
45
+
46
+	getWindowArg : function(n, dv) {
47
+		var v = this.params[n];
48
+
49
+		return tinymce.is(v) ? v : dv;
50
+	},
51
+
52
+	getParam : function(n, dv) {
53
+		return this.editor.getParam(n, dv);
54
+	},
55
+
56
+	getLang : function(n, dv) {
57
+		return this.editor.getLang(n, dv);
58
+	},
59
+
60
+	execCommand : function(cmd, ui, val, a) {
61
+		a = a || {};
62
+		a.skip_focus = 1;
63
+
64
+		this.restoreSelection();
65
+		return this.editor.execCommand(cmd, ui, val, a);
66
+	},
67
+
68
+	resizeToInnerSize : function() {
69
+		var t = this, n, b = document.body, vp = t.dom.getViewPort(window), dw, dh;
70
+
71
+		dw = t.getWindowArg('mce_width') - vp.w;
72
+		dh = t.getWindowArg('mce_height') - vp.h;
73
+
74
+		if (t.isWindow)
75
+			window.resizeBy(dw, dh);
76
+		else
77
+			t.editor.windowManager.resizeBy(dw, dh, t.id);
78
+	},
79
+
80
+	executeOnLoad : function(s) {
81
+		this.onInit.add(function() {
82
+			eval(s);
83
+		});
84
+	},
85
+
86
+	storeSelection : function() {
87
+		this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
88
+	},
89
+
90
+	restoreSelection : function() {
91
+		var t = tinyMCEPopup;
92
+
93
+		if (!t.isWindow && tinymce.isIE)
94
+			t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
95
+	},
96
+
97
+	requireLangPack : function() {
98
+		var u = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url');
99
+
100
+		if (u && this.editor.settings.language) {
101
+			u += '/langs/' + this.editor.settings.language + '_dlg.js';
102
+
103
+			if (!tinymce.ScriptLoader.isDone(u)) {
104
+				document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
105
+				tinymce.ScriptLoader.markDone(u);
106
+			}
107
+		}
108
+	},
109
+
110
+	pickColor : function(e, element_id) {
111
+		this.execCommand('mceColorPicker', true, {
112
+			color : document.getElementById(element_id).value,
113
+			func : function(c) {
114
+				document.getElementById(element_id).value = c;
115
+
116
+				try {
117
+					document.getElementById(element_id).onchange();
118
+				} catch (ex) {
119
+					// Try fire event, ignore errors
120
+				}
121
+			}
122
+		});
123
+	},
124
+
125
+	openBrowser : function(element_id, type, option) {
126
+		tinyMCEPopup.restoreSelection();
127
+		this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
128
+	},
129
+
130
+	close : function() {
131
+		var t = this;
132
+
133
+		// To avoid domain relaxing issue in Opera
134
+		function close() {
135
+			t.editor.windowManager.close(window);
136
+			tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
137
+		};
138
+
139
+		if (tinymce.isOpera)
140
+			t.getWin().setTimeout(close, 0);
141
+		else
142
+			close();
143
+	},
144
+
145
+	// Internal functions	
146
+
147
+	_restoreSelection : function() {
148
+		var e = window.event.srcElement;
149
+
150
+		if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
151
+			tinyMCEPopup.restoreSelection();
152
+	},
153
+
154
+/*	_restoreSelection : function() {
155
+		var e = window.event.srcElement;
156
+
157
+		// If user focus a non text input or textarea
158
+		if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
159
+			tinyMCEPopup.restoreSelection();
160
+	},*/
161
+
162
+	_onDOMLoaded : function() {
163
+		var t = this, ti = document.title, bm, h;
164
+
165
+		// Translate page
166
+		h = document.body.innerHTML;
167
+
168
+		// Replace a=x with a="x" in IE
169
+		if (tinymce.isIE)
170
+			h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
171
+
172
+		document.dir = t.editor.getParam('directionality','');
173
+		document.body.innerHTML = t.editor.translate(h);
174
+		document.title = ti = t.editor.translate(ti);
175
+		document.body.style.display = '';
176
+
177
+		// Restore selection in IE when focus is placed on a non textarea or input element of the type text
178
+		if (tinymce.isIE)
179
+			document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
180
+
181
+		t.restoreSelection();
182
+		t.resizeToInnerSize();
183
+
184
+		// Set inline title
185
+		if (!t.isWindow)
186
+			t.editor.windowManager.setTitle(window, ti);
187
+		else
188
+			window.focus();
189
+
190
+		if (!tinymce.isIE && !t.isWindow) {
191
+			tinymce.dom.Event._add(document, 'focus', function() {
192
+				t.editor.windowManager.focus(t.id)
193
+			});
194
+		}
195
+
196
+		// Patch for accessibility
197
+		tinymce.each(t.dom.select('select'), function(e) {
198
+			e.onkeydown = tinyMCEPopup._accessHandler;
199
+		});
200
+
201
+		// Call onInit
202
+		// Init must be called before focus so the selection won't get lost by the focus call
203
+		tinymce.each(t.listeners, function(o) {
204
+			o.func.call(o.scope, t.editor);
205
+		});
206
+
207
+		// Move focus to window
208
+		if (t.getWindowArg('mce_auto_focus', true)) {
209
+			window.focus();
210
+
211
+			// Focus element with mceFocus class
212
+			tinymce.each(document.forms, function(f) {
213
+				tinymce.each(f.elements, function(e) {
214
+					if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
215
+						e.focus();
216
+						return false; // Break loop
217
+					}
218
+				});
219
+			});
220
+		}
221
+
222
+		document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
223
+	},
224
+
225
+	_accessHandler : function(e) {
226
+		e = e || window.event;
227
+
228
+		if (e.keyCode == 13 || e.keyCode == 32) {
229
+			e = e.target || e.srcElement;
230
+
231
+			if (e.onchange)
232
+				e.onchange();
233
+
234
+			return tinymce.dom.Event.cancel(e);
235
+		}
236
+	},
237
+
238
+	_closeWinKeyHandler : function(e) {
239
+		e = e || window.event;
240
+
241
+		if (e.keyCode == 27)
242
+			tinyMCEPopup.close();
243
+	},
244
+
245
+	_wait : function() {
246
+		var t = this, ti;
247
+
248
+		if (tinymce.isIE && document.location.protocol != 'https:') {
249
+			// Fake DOMContentLoaded on IE
250
+			document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');
251
+			document.getElementById("__ie_onload").onreadystatechange = function() {
252
+				if (this.readyState == "complete") {
253
+					t._onDOMLoaded();
254
+					document.getElementById("__ie_onload").onreadystatechange = null; // Prevent leak
255
+				}
256
+			};
257
+		} else {
258
+			if (tinymce.isIE || tinymce.isWebKit) {
259
+				ti = setInterval(function() {
260
+					if (/loaded|complete/.test(document.readyState)) {
261
+						clearInterval(ti);
262
+						t._onDOMLoaded();
263
+					}
264
+				}, 10);
265
+			} else {
266
+				window.addEventListener('DOMContentLoaded', function() {
267
+					t._onDOMLoaded();
268
+				}, false);
269
+			}
270
+		}
271
+	}
272
+};
273
+
274
+tinyMCEPopup.init();
275
+tinyMCEPopup._wait(); // Wait for DOM Content Loaded