Blame view

mobile/source/ext/ckeditor/_samples/sample.js 1.76 KB
a1684257   Administrator   first commit
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
  /*
  Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  For licensing, see LICENSE.html or http://ckeditor.com/license
  */
  
  // This file is not required by CKEditor and may be safely ignored.
  // It is just a helper file that displays a red message about browser compatibility
  // at the top of the samples (if incompatible browser is detected).
  
  if ( window.CKEDITOR )
  {
  	(function()
  	{
  		var showCompatibilityMsg = function()
  		{
  			var env = CKEDITOR.env;
  
  			var html = '<p><strong>Your browser is not compatible with CKEditor.</strong>';
  
  			var browsers =
  			{
  				gecko : 'Firefox 2.0',
  				ie : 'Internet Explorer 6.0',
  				opera : 'Opera 9.5',
  				webkit : 'Safari 3.0'
  			};
  
  			var alsoBrowsers = '';
  
  			for ( var key in env )
  			{
  				if ( browsers[ key ] )
  				{
  					if ( env[key] )
  						html += ' CKEditor is compatible with ' + browsers[ key ] + ' or higher.';
  					else
  						alsoBrowsers += browsers[ key ] + '+, ';
  				}
  			}
  
  			alsoBrowsers = alsoBrowsers.replace( /\+,([^,]+), $/, '+ and $1' );
  
  			html += ' It is also compatible with ' + alsoBrowsers + '.';
  
  			html += '</p><p>With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.</p>';
  
  			var alertsEl = document.getElementById( 'alerts' );
  			alertsEl && ( alertsEl.innerHTML = html );
  		};
  
  		var onload = function()
  		{
  			// Show a friendly compatibility message as soon as the page is loaded,
  			// for those browsers that are not compatible with CKEditor.
  			if ( !CKEDITOR.env.isCompatible )
  				showCompatibilityMsg();
  		};
  
  		// Register the onload listener.
  		if ( window.addEventListener )
  			window.addEventListener( 'load', onload, false );
  		else if ( window.attachEvent )
  			window.attachEvent( 'onload', onload );
  	})();
  }