source: trunk/admin/inc/ckeditor/_source/core/imagecacher.js@ 239

Last change on this file since 239 was 239, checked in by luc, 9 years ago

Admin: correzione visulaizzazione immissione dati spoglio per Chrome e Safari - Aggiornamento dell'editor da FCKeditor a CKeditor , accessibili anche a Chrome e Safari.

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1/*
2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
3For licensing, see LICENSE.html or http://ckeditor.com/license
4*/
5
6(function()
7{
8 var loaded = {};
9
10 var loadImage = function( image, callback )
11 {
12 var doCallback = function()
13 {
14 img.removeAllListeners();
15 loaded[ image ] = 1;
16 callback();
17 };
18
19 var img = new CKEDITOR.dom.element( 'img' );
20 img.on( 'load', doCallback );
21 img.on( 'error', doCallback );
22 img.setAttribute( 'src', image );
23 };
24
25 /**
26 * Load images into the browser cache.
27 * @namespace
28 * @example
29 */
30 CKEDITOR.imageCacher =
31 {
32 /**
33 * Loads one or more images.
34 * @param {Array} images The URLs for the images to be loaded.
35 * @param {Function} callback The function to be called once all images
36 * are loaded.
37 */
38 load : function( images, callback )
39 {
40 var pendingCount = images.length;
41
42 var checkPending = function()
43 {
44 if ( --pendingCount === 0 )
45 callback();
46 };
47
48 for ( var i = 0 ; i < images.length ; i++ )
49 {
50 var image = images[ i ];
51
52 if ( loaded[ image ] )
53 checkPending();
54 else
55 loadImage( image, checkPending );
56 }
57 }
58 };
59})();
Note: See TracBrowser for help on using the repository browser.