| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 /* 2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 /** 7 * @fileOverview Defines the {@link CKEDITOR.env} object, which constains 8 * environment and browser information. 9 */ 10 11 if ( !CKEDITOR.env ) 12 { 13 /** 14 * Environment and browser information. 15 * @namespace 16 * @example 17 */ 18 CKEDITOR.env = (function() 19 { 20 var agent = navigator.userAgent.toLowerCase(); 21 var opera = window.opera; 22 23 var env = 24 /** @lends CKEDITOR.env */ 25 { 26 /** 27 * Indicates that CKEditor is running on Internet Explorer. 28 * @type Boolean 29 * @example 30 * if ( CKEDITOR.env.ie ) 31 * alert( "I'm on IE!" ); 32 */ 33 ie : /*@cc_on!@*/false, 34 35 /** 36 * Indicates that CKEditor is running on Opera. 37 * @type Boolean 38 * @example 39 * if ( CKEDITOR.env.opera ) 40 * alert( "I'm on Opera!" ); 41 */ 42 opera : ( !!opera && opera.version ), 43 44 /** 45 * Indicates that CKEditor is running on a WebKit based browser, like 46 * Safari. 47 * @type Boolean 48 * @example 49 * if ( CKEDITOR.env.webkit ) 50 * alert( "I'm on WebKit!" ); 51 */ 52 webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ), 53 54 /** 55 * Indicates that CKEditor is running on Adobe AIR. 56 * @type Boolean 57 * @example 58 * if ( CKEDITOR.env.air ) 59 * alert( "I'm on AIR!" ); 60 */ 61 air : ( agent.indexOf( ' adobeair/' ) > -1 ), 62 63 /** 64 * Indicates that CKEditor is running on Macintosh. 65 * @type Boolean 66 * @example 67 * if ( CKEDITOR.env.mac ) 68 * alert( "I love apples!" ); 69 */ 70 mac : ( agent.indexOf( 'macintosh' ) > -1 ), 71 72 quirks : ( document.compatMode == 'BackCompat' ), 73 74 mobile : ( agent.indexOf( 'mobile' ) > -1 ), 75 76 isCustomDomain : function() 77 { 78 if ( !this.ie ) 79 return false; 80 81 var domain = document.domain, 82 hostname = window.location.hostname; 83 84 return domain != hostname && 85 domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434) 86 } 87 }; 88 89 /** 90 * Indicates that CKEditor is running on a Gecko based browser, like 91 * Firefox. 92 * @name CKEDITOR.env.gecko 93 * @type Boolean 94 * @example 95 * if ( CKEDITOR.env.gecko ) 96 * alert( "I'm riding a gecko!" ); 97 */ 98 env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera ); 99 100 var version = 0; 101 102 // Internet Explorer 6.0+ 103 if ( env.ie ) 104 { 105 version = parseFloat( agent.match( /msie (\d+)/ )[1] ); 106 107 /** 108 * Indicate IE8 browser. 109 */ 110 env.ie8 = !!document.documentMode; 111 112 /** 113 * Indicte IE8 document mode. 114 */ 115 env.ie8Compat = document.documentMode == 8; 116 117 /** 118 * Indicates that CKEditor is running on an IE7-like environment, which 119 * includes IE7 itself and IE8's IE7 document mode. 120 * @type Boolean 121 */ 122 env.ie7Compat = ( ( version == 7 && !document.documentMode ) 123 || document.documentMode == 7 ); 124 125 /** 126 * Indicates that CKEditor is running on an IE6-like environment, which 127 * includes IE6 itself and IE7 and IE8 quirks mode. 128 * @type Boolean 129 * @example 130 * if ( CKEDITOR.env.ie6Compat ) 131 * alert( "I'm on IE6 or quirks mode!" ); 132 */ 133 env.ie6Compat = ( version < 7 || env.quirks ); 134 135 } 136 137 // Gecko. 138 if ( env.gecko ) 139 { 140 var geckoRelease = agent.match( /rv:([\d\.]+)/ ); 141 if ( geckoRelease ) 142 { 143 geckoRelease = geckoRelease[1].split( '.' ); 144 version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1; 145 } 146 } 147 148 // Opera 9.50+ 149 if ( env.opera ) 150 version = parseFloat( opera.version() ); 151 152 // Adobe AIR 1.0+ 153 // Checked before Safari because AIR have the WebKit rich text editor 154 // features from Safari 3.0.4, but the version reported is 420. 155 if ( env.air ) 156 version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] ); 157 158 // WebKit 522+ (Safari 3+) 159 if ( env.webkit ) 160 version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] ); 161 162 /** 163 * Contains the browser version. 164 * 165 * For gecko based browsers (like Firefox) it contains the revision 166 * number with first three parts concatenated with a padding zero 167 * (e.g. for revision 1.9.0.2 we have 10900). 168 * 169 * For webkit based browser (like Safari and Chrome) it contains the 170 * WebKit build version (e.g. 522). 171 * @name CKEDITOR.env.version 172 * @type Boolean 173 * @example 174 * if ( CKEDITOR.env.ie && <b>CKEDITOR.env.version</b> <= 6 ) 175 * alert( "Ouch!" ); 176 */ 177 env.version = version; 178 179 /** 180 * Indicates that CKEditor is running on a compatible browser. 181 * @name CKEDITOR.env.isCompatible 182 * @type Boolean 183 * @example 184 * if ( CKEDITOR.env.isCompatible ) 185 * alert( "Your browser is pretty cool!" ); 186 */ 187 env.isCompatible = 188 !env.mobile && ( 189 ( env.ie && version >= 6 ) || 190 ( env.gecko && version >= 10801 ) || 191 ( env.opera && version >= 9.5 ) || 192 ( env.air && version >= 1 ) || 193 ( env.webkit && version >= 522 ) || 194 false ); 195 196 // The CSS class to be appended on the main UI containers, making it 197 // easy to apply browser specific styles to it. 198 env.cssClass = 199 'cke_browser_' + ( 200 env.ie ? 'ie' : 201 env.gecko ? 'gecko' : 202 env.opera ? 'opera' : 203 env.air ? 'air' : 204 env.webkit ? 'webkit' : 205 'unknown' ); 206 207 if ( env.quirks ) 208 env.cssClass += ' cke_browser_quirks'; 209 210 if ( env.ie ) 211 { 212 env.cssClass += ' cke_browser_ie' + ( 213 env.version < 7 ? '6' : 214 env.version >= 8 ? '8' : 215 '7' ); 216 217 if ( env.quirks ) 218 env.cssClass += ' cke_browser_iequirks'; 219 } 220 221 if ( env.gecko && version < 10900 ) 222 env.cssClass += ' cke_browser_gecko18'; 223 224 return env; 225 })(); 226 } 227 228 // PACKAGER_RENAME( CKEDITOR.env ) 229 // PACKAGER_RENAME( CKEDITOR.env.ie )
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |