1var matched, browser;
2
3jQuery.uaMatch = function( ua ) {
4 ua = ua.toLowerCase();
5
6 var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
7 /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
8 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
9 /(msie)[\s?]([\w.]+)/.exec( ua ) ||
10 /(trident)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
11 ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
12 [];
13
14 return {
15 browser: match[ 1 ] || "",
16 version: match[ 2 ] || "0"
17 };
18};
19
20matched = jQuery.uaMatch( navigator.userAgent );
21//IE 11+ fix (Trident)
22matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
23browser = {};
24
25if ( matched.browser ) {
26 browser[ matched.browser ] = true;
27 browser.version = matched.version;
28}
29
30// Chrome is Webkit, but Webkit is also Safari.
31if ( browser.chrome ) {
32 browser.webkit = true;
33} else if ( browser.webkit ) {
34 browser.safari = true;
35}
36
37jQuery.browser = browser;
38// log removed - adds an extra dependency
39//log(jQuery.browser)
40