2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
7 * @fileOverview Contains the first and essential part of the {@link CKEDITOR}
\r
11 // #### Compressed Code
\r
12 // Must be updated on changes in the script, as well as updated in the
\r
13 // ckeditor_source.js and ckeditor_basic_source.js files.
\r
15 // if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.0.1',rev:'4391',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf('://')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf('://')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
\r
18 // ATTENTION: read the above "Compressed Code" notes when changing this code.
\r
20 if ( !window.CKEDITOR )
\r
23 * This is the API entry point. The entire CKEditor code runs under this object.
\r
28 window.CKEDITOR = (function()
\r
31 /** @lends CKEDITOR */
\r
35 * A constant string unique for each release of CKEditor. Its value
\r
36 * is used, by default, to build the URL for all resources loaded
\r
37 * by the editor code, guaranteing clean cache results when
\r
41 * alert( CKEDITOR.timestamp ); // e.g. '87dm'
\r
43 // The production implementation contains a fixed timestamp, unique
\r
44 // for each release, generated by the releaser.
\r
45 // (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
\r
49 * Contains the CKEditor version number.
\r
52 * alert( CKEDITOR.version ); // e.g. 'CKEditor 3.0 Beta'
\r
57 * Contains the CKEditor revision number.
\r
58 * Revision number is incremented automatically after each modification of CKEditor source code.
\r
61 * alert( CKEDITOR.revision ); // e.g. '3975'
\r
66 * Private object used to hold core stuff. It should not be used out of
\r
67 * the API code as properties defined here may change at any time
\r
74 * Indicates the API loading status. The following status are available:
\r
76 * <li><b>unloaded</b>: the API is not yet loaded.</li>
\r
77 * <li><b>basic_loaded</b>: the basic API features are available.</li>
\r
78 * <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
\r
79 * <li><b>loading</b>: the full API is being loaded.</li>
\r
80 * <li><b>ready</b>: the API can be fully used.</li>
\r
84 * if ( <b>CKEDITOR.status</b> == 'ready' )
\r
86 * // The API can now be fully used.
\r
89 status : 'unloaded',
\r
92 * Contains the full URL for the CKEditor installation directory.
\r
93 * It's possible to manually provide the base path by setting a
\r
94 * global variable named CKEDITOR_BASEPATH. This global variable
\r
95 * must be set "before" the editor script loading.
\r
98 * alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
\r
100 basePath : (function()
\r
102 // ATTENTION: fixes on this code must be ported to
\r
103 // var basePath in "core/loader.js".
\r
105 // Find out the editor directory path, based on its <script> tag.
\r
106 var path = window.CKEDITOR_BASEPATH || '';
\r
110 var scripts = document.getElementsByTagName( 'script' );
\r
112 for ( var i = 0 ; i < scripts.length ; i++ )
\r
114 var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
\r
124 // In IE (only) the script.src string is the raw valued entered in the
\r
125 // HTML. Other browsers return the full resolved URL instead.
\r
126 if ( path.indexOf('://') == -1 )
\r
129 if ( path.indexOf( '/' ) === 0 )
\r
130 path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
\r
133 path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
\r
140 * Gets the full URL for CKEditor resources. By default, URLs
\r
141 * returned by this function contains a querystring parameter ("t")
\r
142 * set to the {@link CKEDITOR.timestamp} value.
\r
143 * It's possible to provide a custom implementation to this
\r
144 * function by setting a global variable named CKEDITOR_GETURL.
\r
145 * This global variable must be set "before" the editor script
\r
146 * loading. If the custom implementation returns nothing, the
\r
147 * default implementation is used.
\r
148 * @returns {String} The full URL.
\r
150 * // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
\r
151 * alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
\r
153 * // e.g. http://www.example.com/skins/default/editor.css?t=87dm
\r
154 * alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
\r
156 * // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
\r
157 * alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
\r
159 getUrl : function( resource )
\r
161 // If this is not a full or absolute path.
\r
162 if ( resource.indexOf('://') == -1 && resource.indexOf( '/' ) !== 0 )
\r
163 resource = this.basePath + resource;
\r
165 // Add the timestamp, except for directories.
\r
166 if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' )
\r
167 resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
\r
173 // Make it possible to override the getUrl function with a custom
\r
174 // implementation pointing to a global named CKEDITOR_GETURL.
\r
175 var newGetUrl = window.CKEDITOR_GETURL;
\r
178 var originalGetUrl = CKEDITOR.getUrl;
\r
179 CKEDITOR.getUrl = function ( resource )
\r
181 return newGetUrl.call( CKEDITOR, resource ) ||
\r
182 originalGetUrl.call( CKEDITOR, resource );
\r
190 // PACKAGER_RENAME( CKEDITOR )
\r