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 | |
---|
24 | var s = navigator.userAgent.toLowerCase() ; |
---|
25 | |
---|
26 | var 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) ; |
---|