CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/core/skins.js



/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
 * @fileOverview Defines the {@link CKEDITOR.skins} object, which is used to
 *        manage skins loading.
 */
/**
 * Manages skins loading.
 * @namespace
 * @example
 */
CKEDITOR.skins = (function()
{
	    // Holds the list of loaded skins.
	    var loaded {};
	    var preloaded {};
	    var paths {};
	    var loadPart = function( editorskinNamepartcallback )
	    {
		        // Get the skin definition.
		        var skinDefinition loadedskinName ];
		        if ( !editor.skin )
		        {
			            editor.skin skinDefinition;
			            // Trigger init function if any.
			            if ( skinDefinition.init )
			                skinDefinition.initeditor );
			        }
		        var appendSkinPath = function( fileNames )
		        {
			            for ( var ;
			 fileNames.length ;
			 n++ )
			            {
				                fileNames] = CKEDITOR.getUrlpathsskinName ] + fileNames] );
				            }
			        };
		        function fixCSSTextRelativePathcssStyleTextbaseUrl )
		        {
			            return cssStyleText.replace( /url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,
			                    function( matchopenerpathcloser )
			                    {
				                        if ( /^\/|^\w?:/.testpath ) )
				                            return match;
				                        else
				                            return 'url(' baseUrl opener +  path closer ')';
				                    } );
			        }
		        // Check if we need to preload images from it.
		        if ( !preloadedskinName ] )
		        {
			            var preload skinDefinition.preload;
			            if ( preload && preload.length )
			            {
				                appendSkinPathpreload );
				                CKEDITOR.imageCacher.loadpreload, function()
				                    {
					                        preloadedskinName ] = 1;
					                        loadParteditorskinNamepartcallback );
					                    } );
				                return;
				            }
			            // Mark it as preloaded.
			            preloadedskinName ] = 1;
			        }
		        // Get the part definition.
		        part skinDefinitionpart ];
		        var partIsLoaded = !part || !!part._isLoaded;
		        // Call the callback immediately if already loaded.
		        if ( partIsLoaded )
		            callback && callback();
		        else
		        {
			            // Put the callback in a queue.
			            var pending part._pending || ( part._pending [] );
			            pending.pushcallback );
			            // We may have more than one skin part load request. Just the first
			            // one must do the loading job.
			            if ( pending.length )
			                return;
			            // Check whether the "css" and "js" properties have been defined
			            // for that part.
			            var cssIsLoaded = !part.css || !part.css.length;
			            var jsIsLoaded = !part.js || !part.js.length;
			            // This is the function that will trigger the callback calls on
			            // load.
			            var checkIsLoaded = function()
			            {
				                if ( cssIsLoaded && jsIsLoaded )
				                {
					                    // Mark the part as loaded.
					                    part._isLoaded 1;
					                    // Call all pending callbacks.
					                    for ( var ;
					 pending.length ;
					 i++ )
					                    {
						                        if ( pending] )
						                            pending]();
						                    }
					                }
				            };
			            // Load the "css" pieces.
			            if ( !cssIsLoaded )
			            {
				                var cssPart part.css;
				                if ( CKEDITOR.tools.isArraycssPart ) )
				                {
					                    appendSkinPathcssPart );
					                    for ( var ;
					 cssPart.length ;
					 c++ )
					                        CKEDITOR.document.appendStyleSheetcssPart] );
					                }
				                else
				                {
					                    cssPart fixCSSTextRelativePath(
					                                cssPartCKEDITOR.getUrlpathsskinName ] ) );
					                    // Processing Inline CSS part.
					                    CKEDITOR.document.appendStyleTextcssPart );
					                }
				                part.css cssPart;
				                cssIsLoaded 1;
				            }
			            // Load the "js" pieces.
			            if ( !jsIsLoaded )
			            {
				                appendSkinPathpart.js );
				                CKEDITOR.scriptLoader.loadpart.js, function()
				                    {
					                        jsIsLoaded 1;
					                        checkIsLoaded();
					                    });
				            }
			            // We may have nothing to load, so check it immediately.
			            checkIsLoaded();
			        }
		    };
	    return /** @lends CKEDITOR.skins */ {
		        /**
		         * Registers a skin definition.
		         * @param {String} skinName The skin name.
		         * @param {Object} skinDefinition The skin definition.
		         * @example
		         */
		        add : function( skinNameskinDefinition )
		        {
			            loadedskinName ] = skinDefinition;
			            skinDefinition.skinPath pathsskinName ]
			                || ( pathsskinName ] =
			                        CKEDITOR.getUrl(
			                            '_source/' +    // @Packager.RemoveLine
			                            'skins/' skinName '/' ) );
			        },
		        /**
		         * Loads a skin part. Skins are defined in parts, which are basically
		         * separated CSS files. This function is mainly used by the core code and
		         * should not have much use out of it.
		         * @param {String} skinName The name of the skin to be loaded.
		         * @param {String} skinPart The skin part to be loaded. Common skin parts
		         *        are "editor" and "dialog".
		         * @param {Function} [callback] A function to be called once the skin
		         *        part files are loaded.
		         * @example
		         */
		        load : function( editorskinPartcallback )
		        {
			            var skinName editor.skinName,
			                skinPath editor.skinPath;
			            if ( loadedskinName ] )
			                loadParteditorskinNameskinPartcallback );
			            else
			            {
				                pathsskinName ] = skinPath;
				                CKEDITOR.scriptLoader.loadCKEDITOR.getUrlskinPath 'skin.js' ), function()
				                        {
					                             loadParteditorskinNameskinPartcallback );
					                        });
				            }
			        }
		    };
	})();





PHP Demo Source Code Index