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