()
| 320 | var _mobile; |
| 321 | |
| 322 | function _populate() { |
| 323 | if (_populated) { |
| 324 | return; |
| 325 | } |
| 326 | |
| 327 | _populated = true; |
| 328 | |
| 329 | // To work around buggy JS libraries that can't handle multi-digit |
| 330 | // version numbers, Opera 10's user agent string claims it's Opera |
| 331 | // 9, then later includes a Version/X.Y field: |
| 332 | // |
| 333 | // Opera/9.80 (foo) Presto/2.2.15 Version/10.10 |
| 334 | var uas = navigator.userAgent; |
| 335 | var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas); |
| 336 | var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas); |
| 337 | |
| 338 | _iphone = /\b(iPhone|iP[ao]d)/.exec(uas); |
| 339 | _ipad = /\b(iP[ao]d)/.exec(uas) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); |
| 340 | _android = /Android/i.exec(uas); |
| 341 | _native = /FBAN\/\w+;/i.exec(uas); |
| 342 | _mobile = /Mobile/i.exec(uas); |
| 343 | |
| 344 | // Note that the IE team blog would have you believe you should be checking |
| 345 | // for 'Win64; x64'. But MSDN then reveals that you can actually be coming |
| 346 | // from either x64 or ia64; so ultimately, you should just check for Win64 |
| 347 | // as in indicator of whether you're in 64-bit IE. 32-bit IE on 64-bit |
| 348 | // Windows will send 'WOW64' instead. |
| 349 | _win64 = !!(/Win64/.exec(uas)); |
| 350 | |
| 351 | if (agent) { |
| 352 | _ie = agent[1] ? parseFloat(agent[1]) : ( |
| 353 | agent[5] ? parseFloat(agent[5]) : NaN); |
| 354 | // IE compatibility mode |
| 355 | if (_ie && document && document.documentMode) { |
| 356 | _ie = document.documentMode; |
| 357 | } |
| 358 | // grab the "true" ie version from the trident token if available |
| 359 | var trident = /(?:Trident\/(\d+.\d+))/.exec(uas); |
| 360 | _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie; |
| 361 | |
| 362 | _firefox = agent[2] ? parseFloat(agent[2]) : NaN; |
| 363 | _opera = agent[3] ? parseFloat(agent[3]) : NaN; |
| 364 | _webkit = agent[4] ? parseFloat(agent[4]) : NaN; |
| 365 | if (_webkit) { |
| 366 | // We do not add the regexp to the above test, because it will always |
| 367 | // match 'safari' only since 'AppleWebKit' appears before 'Chrome' in |
| 368 | // the userAgent string. |
| 369 | agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas); |
| 370 | _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN; |
| 371 | } else { |
| 372 | _chrome = NaN; |
| 373 | } |
| 374 | } else { |
| 375 | _ie = _firefox = _opera = _chrome = _webkit = NaN; |
| 376 | } |
| 377 | |
| 378 | if (os) { |
| 379 | if (os[1]) { |
no test coverage detected