namibia
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
/* Copyright (c) 2003-2011, 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 = {}, paths = {}; var loadPart = function( editor, skinName, part, callback ) { // Get the skin definition. var skinDefinition = loaded[ skinName ]; if ( !editor.skin ) { editor.skin = skinDefinition; // Trigger init function if any. if ( skinDefinition.init ) skinDefinition.init( editor ); } var appendSkinPath = function( fileNames ) { for ( var n = 0 ; n < fileNames.length ; n++ ) { fileNames[ n ] = CKEDITOR.getUrl( paths[ skinName ] + fileNames[ n ] ); } }; function fixCSSTextRelativePath( cssStyleText, baseUrl ) { return cssStyleText.replace( /url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g, function( match, opener, path, closer ) { if ( /^\/|^\w?:/.test( path ) ) return match; else return 'url(' + baseUrl + opener + path + closer + ')'; } ); } // Get the part definition. part = skinDefinition[ part ]; 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.push( callback ); // We may have more than one skin part load request. Just the first // one must do the loading job. if ( pending.length > 1 ) return; // Check whether the "css" and "js" properties have been defined // for that part. var cssIsLoaded = !part.css || !part.css.length, 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 i = 0 ; i < pending.length ; i++ ) { if ( pending[ i ] ) pending[ i ](); } } }; // Load the "css" pieces. if ( !cssIsLoaded ) { var cssPart = part.css; if ( CKEDITOR.tools.isArray( cssPart ) ) { appendSkinPath( cssPart ); for ( var c = 0 ; c < cssPart.length ; c++ ) CKEDITOR.document.appendStyleSheet( cssPart[ c ] ); } else { cssPart = fixCSSTextRelativePath( cssPart, CKEDITOR.getUrl( paths[ skinName ] ) ); // Processing Inline CSS part. CKEDITOR.document.appendStyleText( cssPart ); } part.css = cssPart; cssIsLoaded = 1; } // Load the "js" pieces. if ( !jsIsLoaded ) { appendSkinPath( part.js ); CKEDITOR.scriptLoader.load( part.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( skinName, skinDefinition ) { loaded[ skinName ] = skinDefinition; skinDefinition.skinPath = paths[ skinName ] || ( paths[ skinName ] = 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( editor, skinPart, callback ) { var skinName = editor.skinName, skinPath = editor.skinPath; if ( loaded[ skinName ] ) loadPart( editor, skinName, skinPart, callback ); else { paths[ skinName ] = skinPath; CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( skinPath + 'skin.js' ), function() { loadPart( editor, skinName, skinPart, callback ); }); } } }; })(); |
Commits for namibiapublic/scripts/ckeditor/_source/core/skins.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |