includes/clientside/tinymce/tiny_mce_gzip_src.js
author Dan
Sun, 11 May 2008 16:59:21 -0400
changeset 551 3acd624d4f4f
child 582 a38876c0793c
permissions -rw-r--r--
Minified some JS files using YUI compressor
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
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    11
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
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    20
		for (i=0; i<nl.length; i++) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    21
			n = nl[i];
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    22
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    23
			if (n.src && n.src.indexOf('tiny_mce') != -1)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    24
				t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
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
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    27
		if (!t.coreLoaded)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    28
			t.loadScripts(1, s.themes, s.plugins, s.languages, cb, sc);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    29
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    30
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    31
	loadScripts : function(co, th, pl, la, cb, sc) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    32
		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
    33
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    34
		function get(s) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    35
			x = 0;
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
			try {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    38
				x = new ActiveXObject(s);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    39
			} catch (s) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    40
			}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    41
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    42
			return x;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    43
		};
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    44
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    45
		// Build query string
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    46
		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
    47
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    48
		if (co)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    49
			t.coreLoaded = 1;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    50
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    51
		// Send request
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    52
		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    53
		x.overrideMimeType && x.overrideMimeType('text/javascript');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    54
		x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    55
//		x.setRequestHeader('Content-Type', 'text/javascript');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    56
		x.send('');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    57
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    58
		// Handle asyncronous loading
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    59
		if (cb) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    60
			// Wait for response
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    61
			ti = w.setInterval(function() {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    62
				if (x.readyState == 4 || c++ > 10000) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    63
					w.clearInterval(ti);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    64
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    65
					if (c < 10000 && x.status == 200) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    66
						t.loaded = 1;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    67
						t.eval(x.responseText);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    68
						tinymce.dom.Event.domLoaded = true;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    69
						cb.call(sc || t, x);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    70
					}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    71
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    72
					ti = x = null;
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
			}, 10);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    75
		} else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    76
			t.eval(x.responseText);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    77
	},
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
	start : function() {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    80
		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
    81
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    82
		tinymce.suffix = s.suffix;
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
		// Extend script loader
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    85
		tinymce.create('tinymce.compressor.ScriptLoader:tinymce.dom.ScriptLoader', {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    86
			loadScripts : function(sc, cb, s) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    87
				var ti = this, th = [], pl = [], la = [];
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    88
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    89
				each(sc, function(o) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    90
					var u = o.url;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    91
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    92
					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
    93
						// Collect theme
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    94
						if (u.indexOf('editor_template') != -1) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    95
							th.push(/\/themes\/([^\/]+)/.exec(u)[1]);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    96
							load(u, 1);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
    97
						}
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
						// Collect plugin
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   100
						if (u.indexOf('editor_plugin') != -1) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   101
							pl.push(/\/plugins\/([^\/]+)/.exec(u)[1]);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   102
							load(u, 1);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   103
						}
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
						// Collect language
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   106
						if (u.indexOf('/langs/') != -1) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   107
							la.push(/\/langs\/([^.]+)/.exec(u)[1]);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   108
							load(u, 1);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   109
						}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   110
					}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   111
				});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   112
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   113
				if (th.length + pl.length + la.length > 0) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   114
					if (sl.settings.strict_mode) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   115
						// Async
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   116
						t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   117
						return;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   118
					} else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   119
						t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
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
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   122
				return ti.parent(sc, cb, s);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   123
			}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   124
		});
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
		sl = tinymce.ScriptLoader = new tinymce.compressor.ScriptLoader();
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   127
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   128
		function load(u, sp) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   129
			var o;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   130
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   131
			if (!sp)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   132
				u = t.baseURL + u;
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
			o = {url : u, state : 2};
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   135
			sl.queue.push(o);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   136
			sl.lookup[o.url] = o;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   137
		};
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
		// Add core languages
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   140
		each (ln, function(c) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   141
			if (c)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   142
				load('/langs/' + c + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   143
		});
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
		// Add themes with languages
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   146
		each(s.themes.split(','), function(n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   147
			if (n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   148
				load('/themes/' + n + '/editor_template' + s.suffix + '.js');
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
				each (ln, function(c) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   151
					if (c)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   152
						load('/themes/' + n + '/langs/' + c + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   153
				});
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   154
			}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   155
		});
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
		// Add plugins with languages
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   158
		each(s.plugins.split(','), function(n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   159
			if (n) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   160
				load('/plugins/' + n + '/editor_plugin' + s.suffix + '.js');
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
				each (ln, function(c) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   163
					if (c)
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   164
						load('/plugins/' + n + '/langs/' + c + '.js');
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   165
				});
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
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   169
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   170
	end : function() {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   171
	},
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   172
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   173
	eval : function(co) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   174
		var w = window;
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   175
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   176
		// Evaluate script
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   177
		if (!w.execScript) {
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   178
			if (/Gecko/.test(navigator.userAgent))
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   179
				eval(co, w); // Firefox 3.0
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   180
			else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   181
				eval.call(w, co);
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   182
		} else
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   183
			w.execScript(co); // IE
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   184
	}
3acd624d4f4f Minified some JS files using YUI compressor
Dan
parents:
diff changeset
   185
};