1 // init TinyMCE |
1 // |
2 var head = document.getElementsByTagName('head')[0]; |
2 // TinyMCE support |
|
3 // |
3 |
4 |
|
5 // Check tinyMCE to make sure its init is finished |
|
6 var initTinyMCE = function(e) |
|
7 { |
|
8 if ( typeof(tinyMCE_GZ) == 'object' ) |
|
9 { |
|
10 if ( !KILL_SWITCH && !DISABLE_MCE ) |
|
11 { |
|
12 tinyMCE_GZ.init(enano_tinymce_gz_options, function() |
|
13 { |
|
14 tinyMCE.init(enano_tinymce_options); |
|
15 }); |
|
16 tinymce_initted = true; |
|
17 } |
|
18 } |
|
19 }; |
|
20 |
|
21 // editor options |
4 if ( document.getElementById('mdgCss') ) |
22 if ( document.getElementById('mdgCss') ) |
5 { |
23 { |
6 var css_url = document.getElementById('mdgCss').href; |
24 var css_url = document.getElementById('mdgCss').href; |
7 } |
25 } |
8 else |
26 else |
37 languages : 'en', |
55 languages : 'en', |
38 disk_cache : true, |
56 disk_cache : true, |
39 debug : false |
57 debug : false |
40 }; |
58 }; |
41 |
59 |
|
60 // load the script |
|
61 |
42 if ( !KILL_SWITCH && !DISABLE_MCE ) |
62 if ( !KILL_SWITCH && !DISABLE_MCE ) |
43 { |
63 { |
44 // load MCE with XHR |
|
45 var ajax = ajaxMakeXHR(); |
|
46 var uri = scriptPath + '/includes/clientside/tinymce/tiny_mce_gzip.js'; |
64 var uri = scriptPath + '/includes/clientside/tinymce/tiny_mce_gzip.js'; |
47 ajax.open('GET', uri, false); |
65 var sc = document.createElement('script'); |
48 ajax.send(null); |
66 sc.src = uri; |
49 if ( ajax.readyState == 4 && ajax.status == 200 ) |
67 sc.type = 'text/javascript'; |
50 { |
68 var head = document.getElementsByTagName('head')[0]; |
51 eval_global(ajax.responseText); |
69 head.appendChild(sc); |
52 tinyMCE_GZ.init(enano_tinymce_gz_options); |
|
53 } |
|
54 else |
|
55 { |
|
56 console.error('TinyMCE load failed'); |
|
57 } |
|
58 } |
70 } |
59 |
|
60 // Check tinyMCE to make sure its init is finished |
|
61 window.tinymce_preinit_check = function() |
|
62 { |
|
63 if ( typeof(tinyMCE.init) != 'function' ) |
|
64 return false; |
|
65 if ( typeof(tinymce.DOM) != 'object' ) |
|
66 return false; |
|
67 if ( typeof(tinymce.DOM.get) != 'function' ) |
|
68 return false; |
|
69 if ( typeof(enano_tinymce_gz_options) != 'object' ) |
|
70 return false; |
|
71 return true; |
|
72 } |
|
73 |
|
74 var initTinyMCE = function(e) |
|
75 { |
|
76 if ( typeof(tinyMCE) == 'object' ) |
|
77 { |
|
78 if ( !KILL_SWITCH && !DISABLE_MCE ) |
|
79 { |
|
80 if ( !tinymce_preinit_check() ) |
|
81 { |
|
82 setTimeout('initTinyMCE(false);', 200); |
|
83 return false; |
|
84 } |
|
85 tinyMCE.init(enano_tinymce_options); |
|
86 tinymce_initted = true; |
|
87 } |
|
88 } |
|
89 }; |
|