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