1 /* 2 * CKEditor - The text editor for Internet - http://ckeditor.com 3 * Copyright (C) 2003-2008 Frederico Caldeira Knabben 4 * 5 * == BEGIN LICENSE == 6 * 7 * Licensed under the terms of any of the following licenses at your 8 * choice: 9 * 10 * - GNU General Public License Version 2 or later (the "GPL") 11 * http://www.gnu.org/licenses/gpl.html 12 * 13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 * http://www.gnu.org/licenses/lgpl.html 15 * 16 * - Mozilla Public License Version 1.1 or later (the "MPL") 17 * http://www.mozilla.org/MPL/MPL-1.1.html 18 * 19 * == END LICENSE == 20 */ 21 22 // #### Compressed Code 23 // Must be updated on changes in the script, as well as updated in the 24 // ckeditor.js and ckeditor_basic.js files. 25 26 // if (!window.CKEDITOR){window.CKEDITOR=(function(){return {_:{},status:'unloaded',basePath:(function(){var A='';var B=document.getElementsByTagName('script');for (var i=0;i<B.length;i++){var C=B[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (C){A=C[1];break;}};if (A.indexOf('://')==-1){if (A.indexOf('/')==0) A=location.href.match(/^.*?:\/\/[^\/]*/)[0]+A;else A=location.href.match(/^[^\?]*\//)[0]+A;};return A;})()};})();}; 27 28 // #### Raw code 29 // ATTENTION: read the above "Compressed Code" notes when changing this code. 30 31 if ( !window.CKEDITOR ) 32 { 33 /** 34 * This is the API entry point. The entire CKEditor code runs under this object. 35 * @name CKEDITOR 36 * @namespace 37 * @example 38 */ 39 window.CKEDITOR = (function() 40 { 41 /** @lends CKEDITOR */ 42 return { 43 /** 44 * Private object used to hold core stuff. It should not be used out of 45 * the API code as properties defined here may change at any time 46 * without notice. 47 * @private 48 */ 49 _ : {}, 50 51 /** 52 * Indicates the API loading status: 53 * <ul> 54 * <li><b>unloaded</b>: the API is not yet loaded.</li> 55 * <li><b>basic_loaded</b>: the basic API features are available.</li> 56 * <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li> 57 * <li><b>loading</b>: the full API is being loaded.</li> 58 * <li><b>ready</b>: the API can be fully used.</li> 59 * </ul> 60 * @type string 61 * @example 62 * if ( <b>CKEDITOR.status</b> == 'ready' ) 63 * { 64 * // The API can now be fully used. 65 * } 66 */ 67 status : 'unloaded', 68 69 /** 70 * Contains the full URL for the CKEditor installation directory. 71 * @type string 72 * @example 73 * // Alerts "http://www.example.com/ckeditor/" (e.g.) 74 * alert( <b>CKEDITOR.basePath</b> ); 75 */ 76 basePath : (function() 77 { 78 // ATTENTION: fixes on this code must be ported to 79 // loader.basePath (core/loader.js). 80 81 // Find out the editor directory path, based on its <script> tag. 82 var path = ''; 83 var scripts = document.getElementsByTagName( 'script' ); 84 85 for ( var i = 0 ; i < scripts.length ; i++ ) 86 { 87 var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i ); 88 89 if ( match ) 90 { 91 path = match[1]; 92 break; 93 } 94 } 95 96 // In IE (only) the script.src string is the raw valued entered in the 97 // HTML. Other browsers return the full resolved URL instead. 98 if ( path.indexOf('://') == -1 ) 99 { 100 // Absolute path. 101 if ( path.indexOf( '/' ) === 0 ) 102 path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path; 103 // Relative path. 104 else 105 path = location.href.match( /^[^\?]*\// )[0] + path; 106 } 107 108 return path; 109 })() 110 }; 111 })(); 112 } 113