includes/clientside/tinymce/tiny_mce_gzip_src.js
author Dan
Fri, 17 Jul 2009 20:23:48 -0400
changeset 1066 bead71f28f63
parent 582 a38876c0793c
permissions -rw-r--r--
Fixed some formatter engine errors that were exposed through the wiki edit notice
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
551
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     1
var tinyMCE_GZ = {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     2
	settings : {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     3
		themes : '',
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     4
		plugins : '',
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     5
		languages : '',
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     6
		disk_cache : true,
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     7
		page_name : 'tiny_mce_gzip.php',
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     8
		debug : false,
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
     9
		suffix : ''
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    10
	},
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 551
diff changeset
    11
  
551
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    12
	init : function(s, cb, sc) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    13
		var t = this, n, i, nl = document.getElementsByTagName('script');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    14
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    15
		for (n in s)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    16
			t.settings[n] = s[n];
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    17
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    18
		s = t.settings;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    19
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 551
diff changeset
    20
		t.baseURL = scriptPath + '/includes/clientside/tinymce';
551
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    21
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    22
		if (!t.coreLoaded)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    23
			t.loadScripts(1, s.themes, s.plugins, s.languages, cb, sc);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    24
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    25
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    26
	loadScripts : function(co, th, pl, la, cb, sc) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    27
		var t = this, x, w = window, q, c = 0, ti, s = t.settings;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    28
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    29
		function get(s) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    30
			x = 0;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    31
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    32
			try {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    33
				x = new ActiveXObject(s);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    34
			} catch (s) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    35
			}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    36
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    37
			return x;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    38
		};
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    39
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    40
		// Build query string
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    41
		q = 'js=true&diskcache=' + (s.disk_cache ? 'true' : 'false') + '&core=' + (co ? 'true' : 'false') + '&suffix=' + escape(s.suffix) + '&themes=' + escape(th) + '&plugins=' + escape(pl) + '&languages=' + escape(la);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    42
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    43
		if (co)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    44
			t.coreLoaded = 1;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    45
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    46
		// Send request
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    47
		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    48
		x.overrideMimeType && x.overrideMimeType('text/javascript');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    49
		x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    50
//		x.setRequestHeader('Content-Type', 'text/javascript');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    51
		x.send('');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    52
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    53
		// Handle asyncronous loading
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    54
		if (cb) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    55
			// Wait for response
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    56
			ti = w.setInterval(function() {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    57
				if (x.readyState == 4 || c++ > 10000) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    58
					w.clearInterval(ti);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    59
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    60
					if (c < 10000 && x.status == 200) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    61
						t.loaded = 1;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    62
						t.eval(x.responseText);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    63
						tinymce.dom.Event.domLoaded = true;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    64
						cb.call(sc || t, x);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    65
					}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    66
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    67
					ti = x = null;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    68
				}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    69
			}, 10);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    70
		} else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    71
			t.eval(x.responseText);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    72
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    73
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    74
	start : function() {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    75
		var t = this, each = tinymce.each, s = t.settings, sl, ln = s.languages.split(',');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    76
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    77
		tinymce.suffix = s.suffix;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    78
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    79
		// Extend script loader
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    80
		tinymce.create('tinymce.compressor.ScriptLoader:tinymce.dom.ScriptLoader', {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    81
			loadScripts : function(sc, cb, s) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    82
				var ti = this, th = [], pl = [], la = [];
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    83
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    84
				each(sc, function(o) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    85
					var u = o.url;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    86
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    87
					if ((!ti.lookup[u] || ti.lookup[u].state != 2) && u.indexOf(t.baseURL) === 0) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    88
						// Collect theme
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    89
						if (u.indexOf('editor_template') != -1) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    90
							th.push(/\/themes\/([^\/]+)/.exec(u)[1]);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    91
							load(u, 1);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    92
						}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    93
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    94
						// Collect plugin
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    95
						if (u.indexOf('editor_plugin') != -1) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    96
							pl.push(/\/plugins\/([^\/]+)/.exec(u)[1]);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    97
							load(u, 1);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    98
						}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    99
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   100
						// Collect language
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   101
						if (u.indexOf('/langs/') != -1) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   102
							la.push(/\/langs\/([^.]+)/.exec(u)[1]);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   103
							load(u, 1);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   104
						}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   105
					}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   106
				});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   107
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   108
				if (th.length + pl.length + la.length > 0) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   109
					if (sl.settings.strict_mode) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   110
						// Async
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   111
						t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   112
						return;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   113
					} else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   114
						t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   115
				}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   116
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   117
				return ti.parent(sc, cb, s);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   118
			}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   119
		});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   120
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   121
		sl = tinymce.ScriptLoader = new tinymce.compressor.ScriptLoader();
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   122
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   123
		function load(u, sp) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   124
			var o;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   125
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   126
			if (!sp)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   127
				u = t.baseURL + u;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   128
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   129
			o = {url : u, state : 2};
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   130
			sl.queue.push(o);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   131
			sl.lookup[o.url] = o;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   132
		};
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   133
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   134
		// Add core languages
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   135
		each (ln, function(c) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   136
			if (c)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   137
				load('/langs/' + c + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   138
		});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   139
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   140
		// Add themes with languages
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   141
		each(s.themes.split(','), function(n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   142
			if (n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   143
				load('/themes/' + n + '/editor_template' + s.suffix + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   144
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   145
				each (ln, function(c) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   146
					if (c)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   147
						load('/themes/' + n + '/langs/' + c + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   148
				});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   149
			}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   150
		});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   151
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   152
		// Add plugins with languages
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   153
		each(s.plugins.split(','), function(n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   154
			if (n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   155
				load('/plugins/' + n + '/editor_plugin' + s.suffix + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   156
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   157
				each (ln, function(c) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   158
					if (c)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   159
						load('/plugins/' + n + '/langs/' + c + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   160
				});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   161
			}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   162
		});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   163
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   164
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   165
	end : function() {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   166
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   167
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   168
	eval : function(co) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   169
		var w = window;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   170
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   171
		// Evaluate script
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   172
		if (!w.execScript) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   173
			if (/Gecko/.test(navigator.userAgent))
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   174
				eval(co, w); // Firefox 3.0
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   175
			else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   176
				eval.call(w, co);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   177
		} else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   178
			w.execScript(co); // IE
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   179
	}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   180
};