Ticket #6504: 6504.patch
File 6504.patch, 3.4 KB (added by , 13 years ago) |
---|
-
_source/core/editor.js
52 52 else 53 53 { 54 54 // Load the custom configuration file. 55 CKEDITOR.scriptLoader. load( customConfig, function()55 CKEDITOR.scriptLoader.queue( customConfig, function() 56 56 { 57 57 // If the CKEDITOR.editorConfig function has been properly 58 58 // defined in the custom configuration file, cache it. -
_source/core/scriptloader.js
15 15 */ 16 16 CKEDITOR.scriptLoader = (function() 17 17 { 18 var uniqueScripts = {}; 19 var waitingList = {}; 18 var uniqueScripts = {}, 19 waitingList = {}, 20 pendingQueue = []; 20 21 21 22 return /** @lends CKEDITOR.scriptLoader */ { 22 23 /** … … 35 36 * the callback call. Default to {@link CKEDITOR}. 36 37 * @param {Boolean} [noCheck] Indicates that the script must be loaded 37 38 * anyway, not checking if it has already loaded. 39 * @param {Boolean} [showBusy] Changes the cursor of the document while 40 * the script is loaded 41 * @param {Boolean} [ordered] Signals that the script is part of a queue. 38 42 * @example 39 43 * CKEDITOR.scriptLoader.load( '/myscript.js' ); 40 44 * @example … … 51 55 * alert( 'Number of failures: ' + failed.length ); 52 56 * }); 53 57 */ 54 load : function( scriptUrl, callback, scope, noCheck, showBusy )58 load : function( scriptUrl, callback, scope, noCheck, showBusy, ordered ) 55 59 { 56 60 var isString = ( typeof scriptUrl == 'string' ); 57 61 … … 91 95 showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' ); 92 96 doCallback( success ); 93 97 } 98 99 if ( ordered ) 100 CKEDITOR.scriptLoader.advanceQueue(); 94 101 }; 95 102 96 103 var onLoad = function( url, success ) … … 178 185 }, 179 186 180 187 /** 188 * Loads a script in a queue, so only one of the scripts in the queue is 189 * to be loaded at the same time. 190 * @param {String|Array} scriptUrl One or more URLs pointing to the 191 * scripts to be loaded. 192 * @param {Function} [callback] A function to be called when the script 193 * is loaded and executed. If a string is passed to "scriptUrl", a 194 * boolean parameter is passed to the callback, indicating the 195 * success of the load. If an array is passed instead, two array 196 * parameters are passed to the callback; the first contains the 197 * URLs that have been properly loaded, and the second the failed 198 * ones. 199 * @example 200 * see CKEDITOR.scriptLoader.load 201 * 202 */ 203 queue : function( scriptUrl, callback ) 204 { 205 // Let's add this script to the queue 206 pendingQueue.push( {'url': scriptUrl, 'callback': callback} ); 207 208 // Load it if it's the only one in the queue at the moment 209 if ( pendingQueue.length == 1 ) 210 this.load( scriptUrl, callback, CKEDITOR, 0, 0, 1); 211 }, 212 213 advanceQueue : function() 214 { 215 // Remove the first one 216 pendingQueue.shift(); 217 218 // Load the new one that it's first 219 if ( pendingQueue.length ) 220 this.load( pendingQueue[0].url, pendingQueue[0].callback, CKEDITOR, 0, 0, 1); 221 }, 222 223 /** 181 224 * Executes a JavaScript code into the current document. 182 225 * @param {String} code The code to be executed. 183 226 * @example