X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fscriptloader.js;h=3640fcd5df4c92c9a3798d05674d6e3874456933;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=6e7884b514dcde1bbd67d23081f836f0d77f6662;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/core/scriptloader.js b/_source/core/scriptloader.js index 6e7884b..3640fcd 100644 --- a/_source/core/scriptloader.js +++ b/_source/core/scriptloader.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -15,8 +15,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.scriptLoader = (function() { - var uniqueScripts = {}; - var waitingList = {}; + var uniqueScripts = {}, + waitingList = {}; return /** @lends CKEDITOR.scriptLoader */ { /** @@ -33,8 +33,8 @@ CKEDITOR.scriptLoader = (function() * ones. * @param {Object} [scope] The scope ("this" reference) to be used for * the callback call. Default to {@link CKEDITOR}. - * @param {Boolean} [noCheck] Indicates that the script must be loaded - * anyway, not checking if it has already loaded. + * @param {Boolean} [showBusy] Changes the cursor of the document while ++ * the script is loaded. * @example * CKEDITOR.scriptLoader.load( '/myscript.js' ); * @example @@ -51,7 +51,7 @@ CKEDITOR.scriptLoader = (function() * alert( 'Number of failures: ' + failed.length ); * }); */ - load : function( scriptUrl, callback, scope, noCheck ) + load : function( scriptUrl, callback, scope, showBusy ) { var isString = ( typeof scriptUrl == 'string' ); @@ -87,7 +87,10 @@ CKEDITOR.scriptLoader = (function() ( success ? completed : failed ).push( url ); if ( --scriptCount <= 0 ) + { + showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' ); doCallback( success ); + } }; var onLoad = function( url, success ) @@ -106,7 +109,7 @@ CKEDITOR.scriptLoader = (function() var loadScript = function( url ) { - if ( noCheck !== true && uniqueScripts[ url ] ) + if ( uniqueScripts[ url ] ) { checkLoaded( url, true ); return; @@ -167,28 +170,11 @@ CKEDITOR.scriptLoader = (function() CKEDITOR.fire( 'download', url ); // @Packager.RemoveLine }; + showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' ); for ( var i = 0 ; i < scriptCount ; i++ ) { loadScript( scriptUrl[ i ] ); } - }, - - /** - * Executes a JavaScript code into the current document. - * @param {String} code The code to be executed. - * @example - * CKEDITOR.scriptLoader.loadCode( 'var x = 10;' ); - * alert( x ); // "10" - */ - loadCode : function( code ) - { - // Create the