]> git.evergreen-ils.org Git - working/Evergreen.git/blob - stylesheets/evergreen_docbook_files/docbook-xsl-1.75.2/slides/browser/ua.js
Capitalized the start of a sentence in the bucket section of cataloging.
[working/Evergreen.git] / stylesheets / evergreen_docbook_files / docbook-xsl-1.75.2 / slides / browser / ua.js
1 /*\r
2  * ua.js\r
3  * $Revision: 1.2 $ $Date: 2003/02/07 16:04:17 $\r
4  */\r
5 \r
6 /* ***** BEGIN LICENSE BLOCK *****\r
7  * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
8  *\r
9  * The contents of this file are subject to the Mozilla Public License Version\r
10  * 1.1 (the "License"); you may not use this file except in compliance with\r
11  * the License. You may obtain a copy of the License at\r
12  * http://www.mozilla.org/MPL/\r
13  *\r
14  * Software distributed under the License is distributed on an "AS IS" basis,\r
15  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
16  * for the specific language governing rights and limitations under the\r
17  * License.\r
18  *\r
19  * The Original Code is Netscape code.\r
20  *\r
21  * The Initial Developer of the Original Code is\r
22  * Netscape Corporation.\r
23  * Portions created by the Initial Developer are Copyright (C) 2001\r
24  * the Initial Developer. All Rights Reserved.\r
25  *\r
26  * Contributor(s): Bob Clary <bclary@netscape.com>\r
27  *\r
28  * ***** END LICENSE BLOCK ***** */\r
29 \r
30 function xbDetectBrowser()\r
31 {\r
32   var oldOnError = window.onerror;\r
33   var element = null;\r
34 \r
35   window.onerror = null;\r
36   \r
37   // work around bug in xpcdom Mozilla 0.9.1\r
38   window.saveNavigator = window.navigator;\r
39 \r
40   navigator.OS    = '';\r
41   navigator.version  = parseFloat(navigator.appVersion);\r
42   navigator.org    = '';\r
43   navigator.family  = '';\r
44 \r
45   var platform;\r
46   if (typeof(window.navigator.platform) != 'undefined')\r
47   {\r
48     platform = window.navigator.platform.toLowerCase();\r
49     if (platform.indexOf('win') != -1)\r
50       navigator.OS = 'win';\r
51     else if (platform.indexOf('mac') != -1)\r
52       navigator.OS = 'mac';\r
53     else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)\r
54       navigator.OS = 'nix';\r
55   }\r
56 \r
57   var i = 0;\r
58   var ua = window.navigator.userAgent.toLowerCase();\r
59   \r
60   if (ua.indexOf('opera') != -1)\r
61   {\r
62     i = ua.indexOf('opera');\r
63     navigator.family  = 'opera';\r
64     navigator.org    = 'opera';\r
65     navigator.version  = parseFloat('0' + ua.substr(i+6), 10);\r
66   }\r
67   else if ((i = ua.indexOf('msie')) != -1)\r
68   {\r
69     navigator.org    = 'microsoft';\r
70     navigator.version  = parseFloat('0' + ua.substr(i+5), 10);\r
71     \r
72     if (navigator.version < 4)\r
73       navigator.family = 'ie3';\r
74     else\r
75       navigator.family = 'ie4'\r
76   }\r
77   else if (ua.indexOf('gecko') != -1)\r
78   {\r
79     navigator.family = 'gecko';\r
80     var rvStart = ua.indexOf('rv:');\r
81     var rvEnd   = ua.indexOf(')', rvStart);\r
82     var rv      = ua.substring(rvStart+3, rvEnd);\r
83     var rvParts = rv.split('.');\r
84     var rvValue = 0;\r
85     var exp     = 1;\r
86 \r
87     for (var i = 0; i < rvParts.length; i++)\r
88     {\r
89       var val = parseInt(rvParts[i]);\r
90       rvValue += val / exp;\r
91       exp *= 100;\r
92     }\r
93     navigator.version = rvValue;\r
94 \r
95     if (ua.indexOf('netscape') != -1)\r
96       navigator.org = 'netscape';\r
97     else if (ua.indexOf('compuserve') != -1)\r
98       navigator.org = 'compuserve';\r
99     else\r
100       navigator.org = 'mozilla';\r
101   }\r
102   else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))\r
103   {\r
104     var is_major = parseFloat(navigator.appVersion);\r
105     \r
106     if (is_major < 4)\r
107       navigator.version = is_major;\r
108     else\r
109     {\r
110       i = ua.lastIndexOf('/')\r
111       navigator.version = parseFloat('0' + ua.substr(i+1), 10);\r
112     }\r
113     navigator.org = 'netscape';\r
114     navigator.family = 'nn' + parseInt(navigator.appVersion);\r
115   }\r
116   else if ((i = ua.indexOf('aol')) != -1 )\r
117   {\r
118     // aol\r
119     navigator.family  = 'aol';\r
120     navigator.org    = 'aol';\r
121     navigator.version  = parseFloat('0' + ua.substr(i+4), 10);\r
122   }\r
123   else if ((i = ua.indexOf('hotjava')) != -1 )\r
124   {\r
125     // hotjava\r
126     navigator.family  = 'hotjava';\r
127     navigator.org    = 'sun';\r
128     navigator.version  = parseFloat(navigator.appVersion);\r
129   }\r
130 \r
131   window.onerror = oldOnError;\r
132 }\r
133 \r
134 xbDetectBrowser();\r
135 \r