140 | | loadPending : function() |
141 | | { |
142 | | var scriptName = pendingLoad.shift(); |
143 | | |
144 | | if ( !scriptName ) |
145 | | return; |
146 | | |
147 | | var scriptSrc = getUrl( '_source/' + scriptName + '.js' ); |
148 | | |
149 | | var script = document.createElement( 'script' ); |
150 | | script.type = 'text/javascript'; |
151 | | script.src = scriptSrc; |
152 | | |
153 | | function onScriptLoaded() |
154 | | { |
155 | | // Append this script to the list of loaded scripts. |
156 | | CKEDITOR.loader.loadedScripts.push( scriptName ); |
157 | | |
158 | | // Load the next. |
159 | | CKEDITOR.loader.loadPending(); |
160 | | } |
161 | | |
162 | | // We must guarantee the execution order of the scripts, so we |
163 | | // need to load them one by one. (#4145) |
164 | | // The followin if/else block has been taken from the scriptloader core code. |
165 | | if ( CKEDITOR.env.ie ) |
166 | | { |
167 | | /** @ignore */ |
168 | | script.onreadystatechange = function() |
169 | | { |
170 | | if ( script.readyState == 'loaded' || script.readyState == 'complete' ) |
171 | | { |
172 | | script.onreadystatechange = null; |
173 | | onScriptLoaded(); |
174 | | } |
175 | | }; |
176 | | } |
177 | | else |
178 | | { |
179 | | /** @ignore */ |
180 | | script.onload = function() |
181 | | { |
182 | | // Some browsers, such as Safari, may call the onLoad function |
183 | | // immediately. Which will break the loading sequence. (#3661) |
184 | | setTimeout( function() { onScriptLoaded( scriptName ); }, 0 ); |
185 | | }; |
186 | | } |
187 | | |
188 | | document.body.appendChild( script ); |
189 | | }, |
190 | | |