PageSourceSearch

https://www.mcleodhealth.org/wp-content/themes/mcleod-health/js/jqbrowser.js?ver=1790330244

js mcleodhealth.org collected 2026-09-25 20:26:36 UTC 10,458 bytes, 333 lines download raw bytes

1/** https://css-tricks.com/snippets/jquery/browser-detetction/
2 * jQBrowser v0.2 - Extend jQuery's browser detection capabilities
3 *   * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/0.2/
4 * 		https://css-tricks.com/snippets/jquery/browser-detetction/
5 * Dave Cardwell <http://davecardwell.co.uk/>
6 *
7 * Built on the shoulders of giants:
8 *   * John Resig <http://jquery.com/>
9 *   * Peter-Paul Koch <http://www.quirksmode.org/?/js/detect.html>
10 *
11 *
12 * Copyright (c) 2006 Dave Cardwell, dual licensed under the MIT and GPL
13 * licenses:
14 *   * http://www.opensource.org/licenses/mit-license.php
15 *   * http://www.gnu.org/licenses/gpl.txt
16 */
17
18
19/**
20 * For the latest version of this plugin, and a discussion of its usage and
21 * implementation, visit:
22 *   * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/
23 */
24
25new function() {
26	var $ = jQuery;
27	/**
28	 * The following functions and attributes form the Public interface of the
29	 * jQBrowser plugin, accessed externally through the $.browser object.
30	 * See the relevant function definition later in the source for further
31	 * information.
32	 *
33	 * $.browser.browser()
34	 * $.browser.version.number()
35	 * $.browser.version.string()
36	 * $.browser.OS()
37	 *
38	 * $.browser.aol()
39	 * $.browser.camino()
40	 * $.browser.firefox()
41	 * $.browser.flock()
42	 * $.browser.icab()
43	 * $.browser.konqueror()
44	 * $.browser.mozilla()
45	 * $.browser.msie()
46	 * $.browser.netscape()
47	 * $.browser.opera()
48	 * $.browser.safari()
49	 *
50	 * $.browser.linux()
51	 * $.browser.mac()
52	 * $.browser.win()
53	 */
54	var Public = {
55		// The current browser, its version as a number or a string, and the
56		// operating system its running on.
57		  'browser': function() { return Private.browser;   },
58		  'version': {
59			  'number': function() { return Private.version.number; },
60			  'string': function() { return Private.version.string; }
61		  },
62			   'OS': function() { return Private.OS;        },
63
64		// A boolean value indicating whether or not the given browser was
65		// detected.
66			  'aol': function() { return Private.aol;       },
67		   'camino': function() { return Private.camino;    },
68		  'firefox': function() { return Private.firefox;   },
69			'flock': function() { return Private.flock;     },
70			 'icab': function() { return Private.icab;      },
71		'konqueror': function() { return Private.konqueror; },
72		  'mozilla': function() { return Private.mozilla;   },
73			 'msie': function() { return Private.msie;      },
74		 'netscape': function() { return Private.netscape;  },
75			'opera': function() { return Private.opera;     },
76		   'safari': function() { return Private.safari;    },
77
78		// A boolean value indicating whether or not the given OS was
79		// detected.
80			'linux': function() { return Private.linux;     },
81			  'mac': function() { return Private.mac;       },
82			  'win': function() { return Private.win;       }
83	};
84
85	// Allow external access to the 'Public' interface through the $.browser
86	// object.
87	$.browser = Public;
88
89
90
91	/**
92	 * The following functions and attributes form the internal methods and
93	 * state of the jQBrowser plugin.  See the relevant function definition
94	 * later in the source for further information.
95	 *
96	 * Private.browser
97	 * Private.version
98	 * Private.OS
99	 *
100	 * Private.aol
101	 * Private.camino
102	 * Private.firefox
103	 * Private.flock
104	 * Private.icab
105	 * Private.konqueror
106	 * Private.mozilla
107	 * Private.msie
108	 * Private.netscape
109	 * Private.opera
110	 * Private.safari
111	 *
112	 * Private.linux
113	 * Private.mac
114	 * Private.win
115	 */
116	var Private = {
117		// Initially set to 'Unknown', if detected each of these properties will
118		// be updated.
119		  'browser': 'Unknown',
120		  'version': {
121			  'number': undefined,
122			  'string': 'Unknown'
123		  },
124			   'OS': 'Unknown',
125
126		// Initially set to false, if detected one of the following browsers
127		// will be updated.
128			  'aol': false,
129		   'camino': false,
130		  'firefox': false,
131			'flock': false,
132			 'icab': false,
133		'konqueror': false,
134		  'mozilla': false,
135			 'msie': false,
136		 'netscape': false,
137			'opera': false,
138		   'safari': false,
139
140		// Initially set to false, if detected one of the following operating
141		// systems will be updated.
142			'linux': false,
143			  'mac': false,
144			  'win': false
145	};
146
147
148
149	/**
150	 * Loop over the items in 'data' trying to find a browser match with the
151	 * test in data[i].browser().  Once found, attempt to determine the
152	 * browser version.
153	 *
154	 *       'name': A string containing the full name of the browser.
155	 * 'identifier': By default this is a lowercase version of 'name', but
156	 *               this can be overwritten by explicitly defining an
157	 *               'identifier'.
158	 *    'browser': A function that returns a boolean value indicating
159	 *               whether or not the given browser is detected.
160	 *    'version': An optional function that overwrites the default version
161	 *               testing.  Must return the result of a .match().
162	 *
163	 * Please note that the order of the data array is important, as some
164	 * browsers contain details of others in their navigator.userAgent string.
165	 * For example, Flock's contains 'Firefox' so much come before Firefox's
166	 * test to avoid false positives.
167	 */
168	for( var  i = 0,                    // counter
169			 ua = navigator.userAgent,  // the navigator's user agent string
170			 ve = navigator.vendor,     // the navigator's vendor string
171		   data = [                     // browser tests and data
172				{ // Safari <http://www.apple.com/safari/>
173						  'name': 'Safari',
174					   'browser': function() { return /Apple/.test(ve) }
175				},
176				{ // Opera <http://www.opera.com/>
177						  'name': 'Opera',
178					   'browser': function() {
179									  return window.opera != undefined
180								  }
181				},
182				{ // iCab <http://www.icab.de/>
183						  'name': 'iCab',
184					   'browser': function() { return /iCab/.test(ve) }
185				},
186				{ // Konqueror <http://www.konqueror.org/>
187						  'name': 'Konqueror',
188					   'browser': function() { return /KDE/.test(ve) }
189				},
190				{ // AOL Explorer <http://downloads.channel.aol.com/browser>
191					'identifier': 'aol',
192						  'name': 'AOL Explorer',
193					   'browser': function() {
194									  return /America Online Browser/.test(ua)
195								  },
196					   'version': function() {
197									  return ua.match(/rev(\d+(?:\.\d+)+)/)
198								  }
199				},
200				{ // Flock <http://www.flock.com/>
201						  'name': 'Flock',
202					   'browser': function() { return /Flock/.test(ua) }
203				},
204				{ // Camino <http://www.caminobrowser.org/>
205						  'name': 'Camino',
206					   'browser': function() { return /Camino/.test(ve) }
207				},
208				{ // Firefox <http://www.mozilla.com/firefox/>
209						  'name': 'Firefox',
210					   'browser': function() { return /Firefox/.test(ua) }
211				},
212				{ // Netscape <http://browser.netscape.com/>
213						  'name': 'Netscape',
214					   'browser': function() { return /Netscape/.test(ua) }
215				},
216				{ // Internet Explorer <http://www.microsoft.com/windows/ie/>
217				  //                   <http://www.microsoft.com/mac/ie/>
218					'identifier': 'msie',
219						  'name': 'Internet Explorer',
220					   'browser': function() { return /MSIE/.test(ua) },
221					   'version': function() {
222									  return ua.match(
223										  /MSIE (\d+(?:\.\d+)+(?:b\d*)?)/
224									  )
225								  }
226				},
227				{ // Mozilla <http://www.mozilla.org/products/mozilla1.x/>
228						  'name': 'Mozilla',
229					   'browser': function() {
230									  return /Gecko|Mozilla/.test(ua)
231								  },
232					   'version': function() {
233									  return ua.match(/rv:(\d+(?:\.\d+)+)/)
234								  }
235				 }
236			 ];
237		 i < data.length;
238		 i++
239	) {
240		if( data[i].browser() ) { // we have a match
241			// If the identifier is not explicitly set, use a lowercase
242			// version of the given name.
243			var identifier = data[i].identifier ? data[i].identifier
244												: data[i].name.toLowerCase();
245
246			// Make a note that this browser was detected.
247			Private[ identifier ] = true;
248
249			// $.browser.browser() will now return the correct browser.
250			Private.browser = data[i].name;
251
252			var result;
253			if( data[i].version != undefined && (result = data[i].version()) ) {
254				// Use the explicitly set test for browser version.
255				Private.version.string = result[1];
256				Private.version.number = parseFloat( result[1] );
257			} else {
258				// Otherwise use the default test which searches for the
259				// version number after the browser name in the user agent
260				// string.
261				var re = new RegExp(
262					data[i].name + '(?:\\s|\\/)(\\d+(?:\\.\\d+)+(?:(?:a|b)\\d*)?)'
263				);
264
265				result = ua.match(re);
266				if( result != undefined ) {
267					Private.version.string = result[1];
268					Private.version.number = parseFloat( result[1] );
269				}
270			}
271
272			// Once we've detected the browser there is no need to check the
273			// others.
274			break;
275		}
276	};
277
278
279
280	/**
281	 * Loop over the items in 'data' trying to find a operating system match
282	 * with the test in data[i].os().
283	 *
284	 *       'name': A string containing the full name of the operating
285	 *               system.
286	 * 'identifier': By default this is a lowercase version of 'name', but
287	 *               this can be overwritten by explicitly defining an
288	 *               'identifier'.
289	 *         'OS': A function that returns a boolean value indicating
290	 *               whether or not the given operating system is detected.
291	 */
292	for( var  i = 0,                  // counter
293			 pl = navigator.platform, // the navigator's platform string
294		   data = [                   // OS data and tests
295				{ // Microsoft Windows <http://www.microsoft.com/windows/>
296					'identifier': 'win',
297						  'name': 'Windows',
298							'OS': function() { return /Win/.test(pl) }
299				},
300				{ // Apple Mac OS <http://www.apple.com/macos/>
301						  'name': 'Mac',
302							'OS': function() { return /Mac/.test(pl) }
303				},
304				{ // Linux <http://www.linux.org/>
305						  'name': 'Linux',
306							'OS': function() { return /Linux/.test(pl) }
307				}
308		   ];
309	   i < data.length;
310	   i++
311	) {
312		if( data[i].OS() ) { // we have a match
313			// If the identifier is not explicitly set, use a lowercase
314			// version of the given name.
315			var identifier = data[i].identifier ? data[i].identifier
316												: data[i].name.toLowerCase();
317
318			// Make a note that the OS was detected.
319			Private[ identifier ] = true;
320
321			// $.browser.OS() will now return the correct OS.
322			Private.OS = data[i].name;
323
324			// Once we've detected the browser there is no need to check the
325			// others.
326			break;
327		}
328	};
329}();
330
331
332
333

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.