PageSourceSearch

https://fundacion.mtc.es/plugins/jquery.browser.js

js mtc.es collected 2026-10-02 11:05:39 UTC 5,709 bytes, 184 lines download raw bytes

vendor: 5,709 bytes, lines 1-184
1/*!
2 * jQuery Browser Plugin 0.0.7
3 * https://github.com/gabceb/jquery-browser-plugin
4 *
5 * Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
6 * http://jquery.org/license
7 *
8 * Modifications Copyright 2015 Gabriel Cebrian
9 * https://github.com/gabceb
10 *
11 * Released under the MIT license
12 *
13 * Date: 19-05-2015
14 */
15/*global window: false */
16
17(function (factory) {
18  if (typeof define === 'function' && define.amd) {
19    // AMD. Register as an anonymous module.
20    define(['jquery'], function($) {
21      factory($);
22    });
23  } else if (typeof module === 'object' && typeof module.exports === 'object') {
24    // Node-like environment
25    module.exports = factory(require('jquery'));
26  } else {
27    // Browser globals
28    factory(window.jQuery);
29  }
30}(function(jQuery) {
31  "use strict";
32
33  function uaMatch( ua ) {
34    // If an UA is not provided, default to the current browser UA.
35    if ( ua === undefined ) {
36      ua = window.navigator.userAgent;
37    }
38    ua = ua.toLowerCase();
39
40    var match = /(edge)\/([\w.]+)/.exec( ua ) ||
41        /(opr)[\/]([\w.]+)/.exec( ua ) ||
42        /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
43        /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
44        /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
45        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
46        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
47        /(msie) ([\w.]+)/.exec( ua ) ||
48        ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
49        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
50        [];
51
52    var platform_match = /(ipad)/.exec( ua ) ||
53        /(ipod)/.exec( ua ) ||
54        /(iphone)/.exec( ua ) ||
55        /(kindle)/.exec( ua ) ||
56        /(silk)/.exec( ua ) ||
57        /(android)/.exec( ua ) ||
58        /(windows phone)/.exec( ua ) ||
59        /(win)/.exec( ua ) ||
60        /(mac)/.exec( ua ) ||
61        /(linux)/.exec( ua ) ||
62        /(cros)/.exec( ua ) ||
63        /(playbook)/.exec( ua ) ||
64        /(bb)/.exec( ua ) ||
65        /(blackberry)/.exec( ua ) ||
66        [];
67
68    var browser = {},
69        matched = {
70          browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
71          version: match[ 2 ] || match[ 4 ] || "0",
72          versionNumber: match[ 4 ] || match[ 2 ] || "0",
73          platform: platform_match[ 0 ] || ""
74        };
75
76    if ( matched.browser ) {
77      browser[ matched.browser ] = true;
78      browser.version = matched.version;
79      browser.versionNumber = parseInt(matched.versionNumber, 10);
80    }
81
82    if ( matched.platform ) {
83      browser[ matched.platform ] = true;
84    }
85
86    // These are all considered mobile platforms, meaning they run a mobile browser
87    if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
88      browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
89      browser.mobile = true;
90    }
91
92    // These are all considered desktop platforms, meaning they run a desktop browser
93    if ( browser.cros || browser.mac || browser.linux || browser.win ) {
94      browser.desktop = true;
95    }
96
97    // Chrome, Opera 15+ and Safari are webkit based browsers
98    if ( browser.chrome || browser.opr || browser.safari ) {
99      browser.webkit = true;
100    }
101
102    // IE11 has a new token so we will assign it msie to avoid breaking changes
103    // IE12 disguises itself as Chrome, but adds a new Edge token.
104    if ( browser.rv || browser.edge ) {
105      var ie = "msie";
106
107      matched.browser = ie;
108      browser[ie] = true;
109    }
110
111    // Blackberry browsers are marked as Safari on BlackBerry
112    if ( browser.safari && browser.blackberry ) {
113      var blackberry = "blackberry";
114
115      matched.browser = blackberry;
116      browser[blackberry] = true;
117    }
118
119    // Playbook browsers are marked as Safari on Playbook
120    if ( browser.safari && browser.playbook ) {
121      var playbook = "playbook";
122
123      matched.browser = playbook;
124      browser[playbook] = true;
125    }
126
127    // BB10 is a newer OS version of BlackBerry
128    if ( browser.bb ) {
129      var bb = "blackberry";
130
131      matched.browser = bb;
132      browser[bb] = true;
133    }
134
135    // Opera 15+ are identified as opr
136    if ( browser.opr ) {
137      var opera = "opera";
138
139      matched.browser = opera;
140      browser[opera] = true;
141    }
142
143    // Stock Android browsers are marked as Safari on Android.
144    if ( browser.safari && browser.android ) {
145      var android = "android";
146
147      matched.browser = android;
148      browser[android] = true;
149    }
150
151    // Kindle browsers are marked as Safari on Kindle
152    if ( browser.safari && browser.kindle ) {
153      var kindle = "kindle";
154
155      matched.browser = kindle;
156      browser[kindle] = true;
157    }
158
159     // Kindle Silk browsers are marked as Safari on Kindle
160    if ( browser.safari && browser.silk ) {
161      var silk = "silk";
162
163      matched.browser = silk;
164      browser[silk] = true;
165    }
166
167    // Assign the name and platform variable
168    browser.name = matched.browser;
169    browser.platform = matched.platform;
170    return browser;
171  }
172
173  // Run the matching process, also assign the function to the returned object
174  // for manual, jQuery-free use if desired
175  window.jQBrowser = uaMatch( window.navigator.userAgent );
176  window.jQBrowser.uaMatch = uaMatch;
177
178  // Only assign to jQuery.browser if jQuery is loaded
179  if ( jQuery ) {
180    jQuery.browser = window.jQBrowser;
181  }
182
183  return window.jQBrowser;
184}));

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.