LBF custom template (nation notes) fancybox replace.
[openemr.git] / library / custom_template / ckeditor / _source / core / ckeditor_base.js
blobe52fedfb73164cdb065368ec27ba942a4f2ba4d6
1 /*
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
4 */
6 /**
7  * @fileOverview Contains the first and essential part of the {@link CKEDITOR}
8  *              object definition.
9  */
11 // #### Compressed Code
12 // Must be updated on changes in the script, as well as updated in the
13 // ckeditor_source.js and ckeditor_basic_source.js files.
15 // if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.5.2',rev:'6450',_:{},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;})();
17 // #### Raw code
18 // ATTENTION: read the above "Compressed Code" notes when changing this code.
20 if ( !window.CKEDITOR )
22         /**
23          * @name CKEDITOR
24          * @namespace This is the API entry point. The entire CKEditor code runs under this object.
25          * @example
26          */
27         window.CKEDITOR = (function()
28         {
29                 var CKEDITOR =
30                 /** @lends CKEDITOR */
31                 {
33                         /**
34                          * A constant string unique for each release of CKEditor. Its value
35                          * is used, by default, to build the URL for all resources loaded
36                          * by the editor code, guaranteing clean cache results when
37                          * upgrading.
38                          * @type String
39                          * @example
40                          * alert( CKEDITOR.timestamp );  // e.g. '87dm'
41                          */
42                         // The production implementation contains a fixed timestamp, unique
43                         // for each release, generated by the releaser.
44                         // (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
45                         timestamp : 'B1GG4Z6',
47                         /**
48                          * Contains the CKEditor version number.
49                          * @type String
50                          * @example
51                          * alert( CKEDITOR.version );  // e.g. 'CKEditor 3.4.1'
52                          */
53                         version : '3.5.2',
55                         /**
56                          * Contains the CKEditor revision number.
57                          * The revision number is incremented automatically, following each
58                          * modification to the CKEditor source code.
59                          * @type String
60                          * @example
61                          * alert( CKEDITOR.revision );  // e.g. '3975'
62                          */
63                         revision : '6450',
65                         /**
66                          * Private object used to hold core stuff. It should not be used out of
67                          * the API code as properties defined here may change at any time
68                          * without notice.
69                          * @private
70                          */
71                         _ : {},
73                         /**
74                          * Indicates the API loading status. The following status are available:
75                          *              <ul>
76                          *                      <li><b>unloaded</b>: the API is not yet loaded.</li>
77                          *                      <li><b>basic_loaded</b>: the basic API features are available.</li>
78                          *                      <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
79                          *                      <li><b>loading</b>: the full API is being loaded.</li>
80                          *                      <li><b>loaded</b>: the API can be fully used.</li>
81                          *              </ul>
82                          * @type String
83                          * @example
84                          * if ( <b>CKEDITOR.status</b> == 'loaded' )
85                          * {
86                          *     // The API can now be fully used.
87                          * }
88                          */
89                         status : 'unloaded',
91                         /**
92                          * Contains the full URL for the CKEditor installation directory.
93                          * It's possible to manually provide the base path by setting a
94                          * global variable named CKEDITOR_BASEPATH. This global variable
95                          * must be set "before" the editor script loading.
96                          * @type String
97                          * @example
98                          * alert( <b>CKEDITOR.basePath</b> );  // "http://www.example.com/ckeditor/" (e.g.)
99                          */
100                         basePath : (function()
101                         {
102                                 // ATTENTION: fixes on this code must be ported to
103                                 // var basePath in "core/loader.js".
105                                 // Find out the editor directory path, based on its <script> tag.
106                                 var path = window.CKEDITOR_BASEPATH || '';
108                                 if ( !path )
109                                 {
110                                         var scripts = document.getElementsByTagName( 'script' );
112                                         for ( var i = 0 ; i < scripts.length ; i++ )
113                                         {
114                                                 var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
116                                                 if ( match )
117                                                 {
118                                                         path = match[1];
119                                                         break;
120                                                 }
121                                         }
122                                 }
124                                 // In IE (only) the script.src string is the raw valued entered in the
125                                 // HTML. Other browsers return the full resolved URL instead.
126                                 if ( path.indexOf(':/') == -1 )
127                                 {
128                                         // Absolute path.
129                                         if ( path.indexOf( '/' ) === 0 )
130                                                 path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
131                                         // Relative path.
132                                         else
133                                                 path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
134                                 }
136                                 if ( !path )
137                                                 throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
139                                 return path;
140                         })(),
142                         /**
143                          * Gets the full URL for CKEditor resources. By default, URLs
144                          * returned by this function contains a querystring parameter ("t")
145                          * set to the {@link CKEDITOR.timestamp} value.<br />
146                          * <br />
147                          * It's possible to provide a custom implementation to this
148                          * function by setting a global variable named CKEDITOR_GETURL.
149                          * This global variable must be set "before" the editor script
150                          * loading. If the custom implementation returns nothing (==null), the
151                          * default implementation is used.
152                          * @param {String} resource The resource to which get the full URL.
153                          *              It may be a full, absolute or relative URL.
154                          * @returns {String} The full URL.
155                          * @example
156                          * // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
157                          * alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
158                          * @example
159                          * // e.g. http://www.example.com/skins/default/editor.css?t=87dm
160                          * alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
161                          * @example
162                          * // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
163                          * alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
164                          */
165                         getUrl : function( resource )
166                         {
167                                 // If this is not a full or absolute path.
168                                 if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
169                                         resource = this.basePath + resource;
171                                 // Add the timestamp, except for directories.
172                                 if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' && !(/[&?]t=/).test( resource ) )
173                                         resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
175                                 return resource;
176                         }
177                 };
179                 // Make it possible to override the getUrl function with a custom
180                 // implementation pointing to a global named CKEDITOR_GETURL.
181                 var newGetUrl = window.CKEDITOR_GETURL;
182                 if ( newGetUrl )
183                 {
184                         var originalGetUrl = CKEDITOR.getUrl;
185                         CKEDITOR.getUrl = function ( resource )
186                         {
187                                 return newGetUrl.call( CKEDITOR, resource ) ||
188                                         originalGetUrl.call( CKEDITOR, resource );
189                         };
190                 }
192                 return CKEDITOR;
193         })();
196 // PACKAGER_RENAME( CKEDITOR )