source: extensions/FCKEditor/editor/_source/internals/fckbrowserinfo.js @ 3295

Last change on this file since 3295 was 3295, checked in by patdenice, 15 years ago

New extension added:
FCK Editor (2.0.a)

File size: 2.0 KB
Line 
1/*
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2009 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 * Contains browser detection information.
22 */
23
24var s = navigator.userAgent.toLowerCase() ;
25
26var FCKBrowserInfo =
27{
28        IsIE            : /*@cc_on!@*/false,
29        IsIE7           : /*@cc_on!@*/false && ( parseInt( s.match( /msie (\d+)/ )[1], 10 ) >= 7 ),
30        IsIE6           : /*@cc_on!@*/false && ( parseInt( s.match( /msie (\d+)/ )[1], 10 ) >= 6 ),
31        IsSafari        : s.Contains(' applewebkit/'),          // Read "IsWebKit"
32        IsOpera         : !!window.opera,
33        IsAIR           : s.Contains(' adobeair/'),
34        IsMac           : s.Contains('macintosh')
35} ;
36
37// Completes the browser info with further Gecko information.
38(function( browserInfo )
39{
40        browserInfo.IsGecko = ( navigator.product == 'Gecko' ) && !browserInfo.IsSafari && !browserInfo.IsOpera ;
41        browserInfo.IsGeckoLike = ( browserInfo.IsGecko || browserInfo.IsSafari || browserInfo.IsOpera ) ;
42
43        if ( browserInfo.IsGecko )
44        {
45                var geckoMatch = s.match( /rv:(\d+\.\d+)/ ) ;
46                var geckoVersion = geckoMatch && parseFloat( geckoMatch[1] ) ;
47
48                // Actually "10" refers to Gecko versions before Firefox 1.5, when
49                // Gecko 1.8 (build 20051111) has been released.
50
51                // Some browser (like Mozilla 1.7.13) may have a Gecko build greater
52                // than 20051111, so we must also check for the revision number not to
53                // be 1.7 (we are assuming that rv < 1.7 will not have build > 20051111).
54
55                if ( geckoVersion )
56                {
57                        browserInfo.IsGecko10 = ( geckoVersion < 1.8 ) ;
58                        browserInfo.IsGecko19 = ( geckoVersion > 1.8 ) ;
59                }
60        }
61})(FCKBrowserInfo) ;
Note: See TracBrowser for help on using the repository browser.