Sha256: 47d90fa0bdf8162bd087a4108430c8265757ba2f69b8c6131d4c2bb9a42e3127

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

(function()
{
	var loaded = {};

	var loadImage = function( image, callback )
	{
		var doCallback = function()
			{
				loaded[ image ] = 1;
				callback();
			};

		var img = new CKEDITOR.dom.element( 'img' );
		img.on( 'load', doCallback );
		img.on( 'error', doCallback );
		img.setAttribute( 'src', image );
	};

	/**
	 * Load images into the browser cache.
	 * @namespace
	 * @example
	 */
 	CKEDITOR.imageCacher =
	{
		/**
		 * Loads one or more images.
		 * @param {Array} images The URLs for the images to be loaded.
		 * @param {Function} callback The function to be called once all images
		 *		are loaded.
		 */
		load : function( images, callback )
		{
			var pendingCount = images.length;

			var checkPending = function()
			{
				if ( --pendingCount === 0 )
					callback();
			};

			for ( var i = 0 ; i < images.length ; i++ )
			{
				var image = images[ i ];

				if ( loaded[ image ] )
					checkPending();
				else
					loadImage( image, checkPending );
			}
		}
	};
})();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-ck_editor_filter-extension-0.2.0 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/core/imagecacher.js
radiant-ck_editor_filter-extension-0.1.1 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/core/imagecacher.js