Blame view

framework/thirdparty/tinymce/tiny_mce_gzip.js 3.02 KB
0084d336   Administrator   Importers CRUD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  var tinyMCE_GZ = {
  	settings : {
  		themes : '',
  		plugins : '',
  		languages : '',
  		disk_cache : true,
  		page_name : 'tiny_mce_gzip.php',
  		debug : false,
  		suffix : ''
  	},
  
  	init : function(s, cb, sc) {
  		var t = this, n, i, nl = document.getElementsByTagName('script');
  
  		for (n in s)
  			t.settings[n] = s[n];
  
  		s = t.settings;
  
  		if (window.tinyMCEPreInit) {
  			t.baseURL = tinyMCEPreInit.base;
  		} else {
  			for (i=0; i<nl.length; i++) {
  				n = nl[i];
  
  				if (n.src && n.src.indexOf('tiny_mce') != -1)
  					t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
  			}
  		}
  
  		if (!t.coreLoaded)
  			t.loadScripts(1, s.themes, s.plugins, s.languages, cb, sc);
  	},
  
  	loadScripts : function(co, th, pl, la, cb, sc) {
  		var t = this, x, w = window, q, c = 0, ti, s = t.settings;
  
  		function get(s) {
  			x = 0;
  
  			try {
  				x = new ActiveXObject(s);
  			} catch (s) {
  			}
  
  			return x;
  		};
  
  		// Build query string
  		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);
  
  		if (co)
  			t.coreLoaded = 1;
  
  		// Send request
  		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
  		x.overrideMimeType && x.overrideMimeType('text/javascript');
  		x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
  //		x.setRequestHeader('Content-Type', 'text/javascript');
  		x.send('');
  
  		// Handle asyncronous loading
  		if (cb) {
  			// Wait for response
  			ti = w.setInterval(function() {
  				if (x.readyState == 4 || c++ > 10000) {
  					w.clearInterval(ti);
  
  					if (c < 10000 && x.status == 200) {
  						t.loaded = 1;
  						t.eval(x.responseText);
  						tinymce.dom.Event.domLoaded = true;
  						cb.call(sc || t, x);
  					}
  
  					ti = x = null;
  				}
  			}, 10);
  		} else
  			t.eval(x.responseText);
  	},
  
  	start : function() {
  		var t = this, each = tinymce.each, s = t.settings, ln = s.languages.split(',');
  
  		tinymce.suffix = s.suffix;
  
  		function load(u) {
  			tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(u));
  		};
  
  		// Add core languages
  		each(ln, function(c) {
  			if (c)
  				load('langs/' + c + '.js');
  		});
  
  		// Add themes with languages
  		each(s.themes.split(','), function(n) {
  			if (n) {
  				load('themes/' + n + '/editor_template' + s.suffix + '.js');
  
  				each (ln, function(c) {
  					if (c)
  						load('themes/' + n + '/langs/' + c + '.js');
  				});
  			}
  		});
  
  		// Add plugins with languages
  		each(s.plugins.split(','), function(n) {
  			if (n) {
  				load('plugins/' + n + '/editor_plugin' + s.suffix + '.js');
  
  				each(ln, function(c) {
  					if (c)
  						load('plugins/' + n + '/langs/' + c + '.js');
  				});
  			}
  		});
  	},
  
  	end : function() {
  	},
  
  	eval : function(co) {
  		var se = document.createElement('script');
  
  		// Create script
  		se.type = 'text/javascript';
  		se.text = co;
  
  		// Add it to evaluate it and remove it
  		(document.getElementsByTagName('head')[0] || document.documentElement).appendChild(se);
  		se.parentNode.removeChild(se);
  	}
  };